You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1 MiB

/*! p5.js v0.5.16 October 11, 2017 */ !function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.p5=a()}}(function(){var a;return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){b.exports={project:{name:"p5",description:"[![Build Status](https://travis-ci.org/processing/p5.js.svg?branch=master)](https://travis-ci.org/processing/p5.js) [![npm version](https://badge.fury.io/js/p5.svg)](https://www.npmjs.com/package/p5)",version:"0.5.16",url:"https://github.com/processing/p5.js#readme"},files:{"src/color/color_conversion.js":{name:"src/color/color_conversion.js",modules:{"Color Conversion":1},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/init.js":{name:"src/core/init.js",modules:{},classes:{},fors:{},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/data/p5.TypedDict.js":{name:"src/data/p5.TypedDict.js",modules:{Dictionary:1},classes:{"p5.TypedDict":1,"p5.StringDict":1,"p5.NumberDict":1},fors:{"p5.TypedDict":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:{"p5.Geometry":1},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/p5.Shader.js":{name:"src/webgl/p5.Shader.js",modules:{Shaders:1},classes:{"p5.Shader":1},fors:{p5:1},namespaces:{}},"src/webgl/p5.Texture.js":{name:"src/webgl/p5.Texture.js",modules:{},classes:{"p5.Texture":1},fors:{p5:1},namespaces:{}},"src/webgl/primitives.js":{name:"src/webgl/primitives.js",modules:{"3D Primitives":1},classes:{},fors:{p5:1},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:1,"p5.SoundFile":1,"p5.Amplitude":1,"p5.FFT":1,"p5.Signal":1,"p5.Oscillator":1,"p5.SinOsc":1,"p5.TriOsc":1,"p5.SawOsc":1,"p5.SqrOsc":1,"p5.Env":1,"p5.Pulse":1,"p5.Noise":1,"p5.AudioIn":1,"p5.Effect":1,"p5.Filter":1,"p5.LowPass":1,"p5.HighPass":1,BandPass:1,"p5.Delay":1,"p5.Reverb":1,"p5.Convolver":1,"p5.Phrase":1,"p5.Part":1,"p5.Score":1,"p5.Compressor":1,"p5.SoundRecorder":1,"p5.PeakDetect":1,"p5.Gain":1,"p5.Distortion":1},fors:{"p5.sound":1},namespaces:{}}},modules:{Conversion:{name:"Conversion",submodules:{},elements:{},classes:{},fors:{p5:1},namespaces:{},module:"Data",file:"src/utilities/conversion.js",line:1,requires:["core"]},"Color Conversion":{name:"Color Conversion",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"IO",namespace:"",file:"src/color/color_conversion.js",line:1,requires:["core"]},Color:{name:"Color",submodules:{"Creating & Reading":1,Setting:1},elements:{},classes:{"p5.Color":1},fors:{p5:1},namespaces:{},file:"src/color/p5.Color.js",line:14},"Creating & Reading":{name:"Creating & Reading",submodules:{},elements:{},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>Each color stores the color mode and level maxes that applied at the\ntime of its construction. These are used to interpret the input arguments\n(at construction and later for that instance of color) and to format the\noutput e.g. when saturation() 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:{},elements:{},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},elements:{},classes:{},fors:{p5:1},namespaces:{}},"2D Primitives":{name:"2D Primitives",submodules:{},elements:{},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:{},elements:{},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:{},elements:{},classes:{},fors:{p5:1},namespaces:{},module:"Constants",file:"src/core/constants.js",line:1},Structure:{name:"Structure",submodules:{},elements:{},classes:{},fors:{p5:1},namespaces:{},module:"Structure",file:"src/core/core.js",line:1,requires:["constants"]},Curves:{name:"Curves",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Shape",namespace:"",file:"src/core/curves.js",line:1,requires:["core"]},Environment:{name:"Environment",submodules:{},elements:{},classes:{},fors:{p5:1},namespaces:{},module:"Environment",file:"src/core/environment.js",line:1,requires:["core","constants"]},DOM:{name:"DOM",submodules:{},elements:{},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:{},elements:{},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:{},elements:{},classes:{},fors:{p5:1},namespaces:{},module:"Transform",file:"src/core/transform.js",line:1,requires:["core","constants"]},Vertex:{name:"Vertex",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Shape",namespace:"",file:"src/core/vertex.js",line:1,requires:["core","constants"]},Data:{name:"Data",submodules:{Dictionary:1,"Array Functions":1,"String Functions":1},elements:{},classes:{"p5.TypedDict":1,"p5.StringDict":1,"p5.NumberDict":1},fors:{"p5.TypedDict":1,p5:1},namespaces:{},file:"src/data/p5.TypedDict.js",line:351},Dictionary:{name:"Dictionary",submodules:{},elements:{},classes:{"p5.TypedDict":1,"p5.StringDict":1,"p5.NumberDict":1},fors:{"p5.TypedDict":1},is_submodule:1,namespaces:{},module:"Data",namespace:"",file:"src/data/p5.TypedDict.js",line:351,requires:["core\n\nThis module defines the p5 methods for the p5 Dictionary classes\nthese classes StringDict and NumberDict are for storing and working\nwith key","value pairs"],description:"<p>Base class for all p5.Dictionary types. More specifically\n typed Dictionary objects inherit from this</p>\n"},Events:{name:"Events",submodules:{Acceleration:1,Keyboard:1,Mouse:1,Touch:1},elements:{},classes:{},fors:{p5:1},namespaces:{}},Acceleration:{name:"Acceleration",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Events",namespace:"",file:"src/events/acceleration.js",line:1,requires:["core"]},Keyboard:{name:"Keyboard",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Events",namespace:"",file:"src/events/keyboard.js",line:1,requires:["core"]},Mouse:{name:"Mouse",submodules:{},elements:{},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:{},elements:{},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},elements:{},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:{},elements:{},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:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Image",namespace:"",file:"src/image/pixels.js",line:1,requires:["core"]},IO:{name:"IO",submodules:{"Color Conversion":1,Input:1,Output:1,Table:1,XML:1,"Time & Date":1},elements:{},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:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"IO",namespace:"",file:"src/io/files.js",line:1,requires:["core"]},Output:{name:"Output",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"IO",namespace:"",file:"src/io/files.js",line:1012},Table:{name:"Table",submodules:{},elements:{},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:{},elements:{},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},elements:{},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:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Math",namespace:"",file:"src/math/calculation.js",line:1,requires:["core"]},Noise:{name:"Noise",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Math",namespace:"",file:"src/math/noise.js",line:14,requires:["core"]},Random:{name:"Random",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Math",namespace:"",file:"src/math/random.js",line:1,requires:["core"]},Trigonometry:{name:"Trigonometry",submodules:{},elements:{},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},elements:{},classes:{"p5.Font":1},fors:{p5:1},namespaces:{},file:"src/typography/p5.Font.js",line:21},Font:{name:"Font",submodules:{},elements:{},classes:{"p5.Font":1},fors:{},is_submodule:1,namespaces:{},module:"Typography",namespace:"",file:"src/typography/p5.Font.js",line:21,description:"<p>This module defines the p5.Font class and functions for\ndrawing text to the display canvas.</p>\n",requires:["core","constants"]},"Array Functions":{name:"Array Functions",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Data",namespace:"",file:"src/utilities/array_functions.js",line:1,requires:["core"]},"String Functions":{name:"String Functions",submodules:{},elements:{},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:{},elements:{},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,Shaders:1},elements:{},classes:{"p5.Geometry":1,"p5.RendererGL":1,"p5.Shader":1,"p5.Texture":1},fors:{p5:1},namespaces:{},file:"src/webgl/p5.Texture.js",line:11},Camera:{name:"Camera",submodules:{},elements:{},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:{},elements:{},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:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Shape",namespace:"",file:"src/webgl/loading.js",line:1,requires:["core","p5.Geometry"]},Material:{name:"Material",submodules:{},elements:{},classes:{"p5.Texture":1},fors:{p5:1},is_submodule:1,namespaces:{},module:"Lights, Camera",namespace:"",file:"src/webgl/p5.Texture.js",line:11,requires:["core"],description:"<p>This module defines the p5.Texture class</p>\n"},Shaders:{name:"Shaders",submodules:{},elements:{},classes:{"p5.Shader":1},fors:{p5:1},is_submodule:1,namespaces:{},module:"Lights, Camera",namespace:"",file:"src/webgl/p5.Shader.js",line:11,description:"<p>This module defines the p5.Shader class</p>\n",requires:["core"]},"3D Primitives":{name:"3D Primitives",submodules:{},elements:{},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:{},elements:{},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:2482,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:{},elements:{},classes:{p5:1,"p5.sound":1,"p5.SoundFile":1,"p5.Amplitude":1,"p5.FFT":1,"p5.Signal":1,"p5.Oscillator":1,"p5.SinOsc":1,"p5.TriOsc":1,"p5.SawOsc":1,"p5.SqrOsc":1,"p5.Env":1,"p5.Pulse":1,"p5.Noise":1,"p5.AudioIn":1,"p5.Effect":1,"p5.Filter":1,"p5.LowPass":1,"p5.HighPass":1,BandPass:1,"p5.Delay":1,"p5.Reverb":1,"p5.Convolver":1,"p5.Phrase":1,"p5.Part":1,"p5.Score":1,"p5.Compressor":1,"p5.SoundRecorder":1,"p5.PeakDetect":1,"p5.Gain":1,"p5.Distortion":1},fors:{"p5.sound":1},namespaces:{},module:"p5.sound",file:"lib/addons/p5.sound.js",line:10410,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:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:409},"p5.Color":{name:"p5.Color",shortname:"p5.Color",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Color",submodule:"Creating & Reading",namespace:"",file:"src/color/p5.Color.js",line:14,description:"<p>Each color stores the color mode and level maxes that applied at the\ntime of its construction. These are used to interpret the input arguments\n(at construction and later for that instance of color) and to format the\noutput e.g. when saturation() 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:"P5",optional:!0}]},"p5.Graphics":{name:"p5.Graphics",shortname:"p5.Graphics",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Rendering",submodule:"Rendering",namespace:"",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:"w",description:"<p>width</p>\n",type:"Number"},{name:"h",description:"<p>height</p>\n",type:"Number"},{name:"renderer",description:"<p>the renderer to use, either P2D or WEBGL</p>\n",type:"Constant"},{name:"pInst",description:"<p>pointer to p5 instance</p>\n",type:"P5",optional:!0}]},"p5.Renderer":{name:"p5.Renderer",shortname:"p5.Renderer",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Rendering",submodule:"Rendering",namespace:"",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:"P5",optional:!0},{name:"isMainCanvas",description:"<p>whether we&#39;re using it as main canvas</p>\n",type:"Boolean",optional:!0}]},"p5.TypedDict":{name:"p5.TypedDict",shortname:"p5.TypedDict",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Data",submodule:"Dictionary",namespace:"",file:"src/data/p5.TypedDict.js",line:48,description:"<p>Base class for all p5.Dictionary types. More specifically\n typed Dictionary objects inherit from this</p>\n",is_constructor:1},"p5.StringDict":{name:"p5.StringDict",shortname:"p5.StringDict",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Data",submodule:"Dictionary",namespace:"",file:"src/data/p5.TypedDict.js",line:330,description:"<p>A Dictionary class for Strings.</p>\n",is_constructor:1,extends:"p5.TypedDict"},"p5.NumberDict":{name:"p5.NumberDict",shortname:"p5.NumberDict",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Data",submodule:"Dictionary",namespace:"",file:"src/data/p5.TypedDict.js",line:351,description:"<p>A simple Dictionary class for Numbers.</p>\n",is_constructor:1,extends:"p5.TypedDict"},"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"}]},"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:"p5.TableRow[]",optional:!0}]},"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:!0},{name:"separator",description:"<p>comma separated values (csv) by default</p>\n",type:"String",optional:!0}]},"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,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].getNum("id");\n var coloring = children[i].getString("species");\n var name = children[i].getContent();\n print(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>'],alt:"no image displayed"},"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:!0},{name:"y",description:"<p>y component of the vector</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>z component of the vector</p>\n",type:"Number",optional:!0}],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>"],alt:"2 white ellipses. One center-left the other bottom right and off canvas"},"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:21,description:"<p>Base class for font handling</p>\n",is_constructor:1,params:[{name:"pInst",description:"<p>pointer to p5 instance</p>\n",type:"P5",optional:!0}]},"p5.Geometry":{name:"p5.Geometry",shortname:"p5.Geometry",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Lights, Camera",namespace:"",file:"src/webgl/p5.Geometry.js",line:6,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:!0},{name:"detailY",description:"<p>number of vertices on horizontal surface</p>\n",type:"Number",optional:!0},{name:"callback",description:"<p>function to call upon object instantiation.</p>\n",type:"Function",optional:!0}]},"p5.RendererGL":{name:"p5.RendererGL",shortname:"p5.RendererGL",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Lights, Camera",namespace:"",file:"src/webgl/p5.RendererGL.js",line:36,description:"<p>3D graphics class</p>\n",is_constructor:1,extends:"p5.Renderer",todo:["extend class to include public method for offscreen\nrendering (FBO)."]},"p5.Shader":{name:"p5.Shader",shortname:"p5.Shader",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Lights, Camera",submodule:"Shaders",namespace:"",file:"src/webgl/p5.Shader.js",line:11,description:"<p>Shader class for WEBGL Mode</p>\n",is_constructor:1,params:[{name:"renderer",description:"<p>an instance of p5.RendererGL that\nwill provide the GL context for this new p5.Shader</p>\n",type:"p5.RendererGL"},{name:"vertSrc",description:"<p>source code for the vertex shader (as a string)</p>\n",type:"String"},{name:"fragSrc",description:"<p>source code for the fragment shader (as a string)</p>\n",type:"String"}]},"p5.Texture":{name:"p5.Texture",shortname:"p5.Texture",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Lights, Camera",submodule:"Material",namespace:"",file:"src/webgl/p5.Texture.js",line:11,description:"<p>Texture class for WEBGL Mode</p>\n",is_constructor:1,params:[{name:"renderer",description:"<p>an instance of p5.RendererGL that\nwill provide the GL context for this new p5.Texture</p>\n",type:"p5.RendererGL"},{name:"obj",description:"<p>the\nobject containing the image data to store in the texture.</p>\n",type:"p5.Image|p5.Graphics|p5.Element|p5.MediaElement",optional:!0}]},"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:1728,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"}]},"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:2482,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"}]},"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:754,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:!0},{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:!0},{name:"whileLoadingCallback",description:"<p>Name of a function to call while file\n is loading. That function will\n receive progress of the request to\n load the sound file\n (between 0 and 1) as its first\n parameter. This progress\n does not account for the additional\n time needed to decode the audio data.</p>\n",type:"Function",optional:!0}],example:["\n<div><code>\n\nfunction preload() {\n soundFormats('mp3', 'ogg');\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:2158,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:!0}],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:2430,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:!0},{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:!0}],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:4274,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:4419,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 instantiating a\nspecific oscillator: <a href="/reference/#/p5.SinOsc">p5.SinOsc</a>, <a\nhref="/reference/#/p5.TriOsc">p5.TriOsc</a>, <a\nhref="/reference/#/p5.SqrOsc">p5.SqrOsc</a>, or <a\nhref="/reference/#/p5.SawOsc">p5.SawOsc</a>.\n</p>',is_constructor:1,params:[{name:"freq",description:"<p>frequency defaults to 440Hz</p>\n",type:"Number",optional:!0},{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:!0}],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.SinOsc":{name:"p5.SinOsc",shortname:"p5.SinOsc",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:4854,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",is_constructor:1,extends:"{p5.Oscillator}",params:[{name:"freq",description:"<p>Set the frequency</p>\n",type:"Number",optional:!0}]},"p5.TriOsc":{name:"p5.TriOsc",shortname:"p5.TriOsc",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:4871,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",is_constructor:1,extends:"{p5.Oscillator}",params:[{name:"freq",description:"<p>Set the frequency</p>\n",type:"Number",optional:!0}]},"p5.SawOsc":{name:"p5.SawOsc",shortname:"p5.SawOsc",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:4888,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",is_constructor:1,extends:"{p5.Oscillator}",params:[{name:"freq",description:"<p>Set the frequency</p>\n",type:"Number",optional:!0}]},"p5.SqrOsc":{name:"p5.SqrOsc",shortname:"p5.SqrOsc",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:4905,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",is_constructor:1,extends:"{p5.Oscillator}",params:[{name:"freq",description:"<p>Set the frequency</p>\n",type:"Number",optional:!0}]},"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:5280,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:6076,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',extends:"p5.Oscillator",is_constructor:1,params:[{name:"freq",description:"<p>Frequency in oscillations per second (Hz)</p>\n",type:"Number",optional:!0},{name:"w",description:"<p>Width between the pulses (0 to 1.0,\n defaults to 0)</p>\n",type:"Number",optional:!0}],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:6253,description:"<p>Noise is a type of oscillator that generates a buffer with random values.</p>\n",extends:"p5.Oscillator",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"}]},"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:6439,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. Access in Chrome browser\nis limited to localhost and https, but access over http may be limited.</em></p>',is_constructor:1,params:[{name:"errorCallback",description:"<p>A function to call if there is an error\n accessing the AudioIn. For example,\n Safari and iOS devices do not\n currently allow microphone access.</p>\n",type:"Function",optional:!0}],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.Effect":{name:"p5.Effect",shortname:"p5.Effect",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:7694,description:'<p>Effect is a base class for audio effects in p5. <br>\nThis module handles the nodes and methods that are \ncommon and useful for current and future effects.</p>\n<p>This class is extended by <a href="reference/#/p5.Distortion">p5.Distortion</a>, \n<a href="reference/#/p5.Compressor">p5.Compressor</a>,\n<a href="reference/#/p5.Delay">p5.Delay</a>, \n<a href="reference/#/p5.Filter">p5.Filter</a>, \n<a href="reference/#/p5.Reverb">p5.Reverb</a>.</p>\n',is_constructor:1,params:[{name:"ac",description:"<p>Reference to the audio context of the p5 object</p>\n",type:"Object",optional:!0},{name:"input",description:"<p>Gain Node effect wrapper</p>\n",type:"WebAudioNode",optional:!0},{name:"output",description:"<p>Gain Node effect wrapper</p>\n",type:"WebAudioNode",optional:!0},{name:"_drywet",description:"<p>Tone.JS CrossFade node (defaults to value: 1)</p>\n",type:"Object",optional:!0},{name:"wet",description:"<p>Effects that extend this class should connect\n to the wet signal to this gain node, so that dry and wet \n signals are mixed properly.</p>\n",type:"WebAudioNode",optional:!0}]},"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:7825,description:'<p><p>A p5.Filter uses a Web Audio Biquad Filter to filter\nthe frequency response of an input source. Subclasses\ninclude:</p></p>\n<ul>\n<li><a href="/reference/#/p5.LowPass"><code>p5.LowPass</code></a>:\nAllows frequencies below the cutoff frequency to pass through,\nand attenuates frequencies above the cutoff.<br/></li>\n<li><a href="/reference/#/p5.HighPass"><code>p5.HighPass</code></a>:\nThe opposite of a lowpass filter. <br/></li>\n<li><a href="/reference/#/p5.BandPass"><code>p5.BandPass</code></a>:\nAllows a range of frequencies to pass through and attenuates\nthe frequencies below 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<p>This class extends <a href = "/reference/#/p5.Effect">p5.Effect</a>.<br>Methods <a href = "/reference/#/p5.Effect/amp">amp()</a>, <a href = "/reference/#/p5.Effect/chain">chain()</a>, \n<a href = "/reference/#/p5.Effect/drywet">drywet()</a>, <a href = "/reference/#/p5.Effect/connect">connect()</a>, and \n<a href = "/reference/#/p5.Effect/disconnect">disconnect()</a> are available.</p>\n',extends:"p5.Effect",is_constructor:1,params:[{name:"type",description:"<p>&#39;lowpass&#39; (default), &#39;highpass&#39;, &#39;bandpass&#39;</p>\n",type:"String",optional:!0}],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.LowPass":{name:"p5.LowPass",shortname:"p5.LowPass",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:8015,
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",is_constructor:1,extends:"{p5.Filter}"},"p5.HighPass":{name:"p5.HighPass",shortname:"p5.HighPass",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:8029,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",is_constructor:1,extends:"{p5.Filter}"},BandPass:{name:"BandPass",shortname:"BandPass",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:8043,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",is_constructor:1,extends:"{p5.Filter}"},"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:8064,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 (the\ndefaul value) will produce a looping delay that decreases in\nvolume by 50% each repeat. A filter will cut out the high\nfrequencies so that the delay does not sound as piercing as the\noriginal source.</p>\n<p>This class extends <a href = "/reference/#/p5.Effect">p5.Effect</a>.<br>Methods <a href = "/reference/#/p5.Effect/amp">amp()</a>, <a href = "/reference/#/p5.Effect/chain">chain()</a>, \n<a href = "/reference/#/p5.Effect/drywet">drywet()</a>, <a href = "/reference/#/p5.Effect/connect">connect()</a>, and \n<a href = "/reference/#/p5.Effect/disconnect">disconnect()</a> are available.</p>\n',extends:"p5.Effect",is_constructor:1,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:8341,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<p>This class extends <a href = "/reference/#/p5.Effect">p5.Effect</a>.<br>Methods <a href = "/reference/#/p5.Effect/amp">amp()</a>, <a href = "/reference/#/p5.Effect/chain">chain()</a>, \n<a href = "/reference/#/p5.Effect/drywet">drywet()</a>, <a href = "/reference/#/p5.Effect/connect">connect()</a>, and \n<a href = "/reference/#/p5.Effect/disconnect">disconnect()</a> are available.</p>\n',extends:"p5.Effect",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:8501,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>',extends:"p5.Effect",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:!0},{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:!0}],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:9074,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:9159,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:!0},{name:"tatums",description:"<p>Divisions of a beat (default is 1/16, a quarter note)</p>\n",type:"Number",optional:!0}],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:9413,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:"parts",description:"<p>One or multiple parts, to be played in sequence.</p>\n",type:"p5.Part",optional:!0,multiple:!0}]},"p5.Compressor":{name:"p5.Compressor",shortname:"p5.Compressor",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:9544,description:'<p>Compressor is an audio effect class that performs dynamics compression\non an audio input source. This is a very commonly used technique in music\nand sound production. Compression creates an overall louder, richer, \nand fuller sound by lowering the volume of louds and raising that of softs.\nCompression can be used to avoid clipping (sound distortion due to \npeaks in volume) and is especially useful when many sounds are played \nat once. Compression can be used on indivudal sound sources in addition\nto the master output. </p>\n<p>This class extends <a href = "/reference/#/p5.Effect">p5.Effect</a>.<br>Methods <a href = "/reference/#/p5.Effect/amp">amp()</a>, <a href = "/reference/#/p5.Effect/chain">chain()</a>, \n<a href = "/reference/#/p5.Effect/drywet">drywet()</a>, <a href = "/reference/#/p5.Effect/connect">connect()</a>, and \n<a href = "/reference/#/p5.Effect/disconnect">disconnect()</a> are available.</p>\n',is_constructor:1,extends:"p5.Effect"},"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:9750,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:10039,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:!0},{name:"freq2",description:"<p>highFrequency - defaults to 20000 Hz</p>\n",type:"Number",optional:!0},{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:!0},{name:"framesPerPeak",description:"<p>Defaults to 20.</p>\n",type:"Number",optional:!0}],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:10259,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"]},"p5.Distortion":{name:"p5.Distortion",shortname:"p5.Distortion",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:10410,description:'<p>A Distortion effect created with a Waveshaper Node,\nwith an approach adapted from\n<a href="http://stackoverflow.com/questions/22312841/waveshaper-node-in-webaudio-how-to-emulate-distortion">Kevin Ennis</a></p>\n<p>This class extends <a href = "/reference/#/p5.Effect">p5.Effect</a>.<br>Methods <a href = "/reference/#/p5.Effect/amp">amp()</a>, <a href = "/reference/#/p5.Effect/chain">chain()</a>, \n<a href = "/reference/#/p5.Effect/drywet">drywet()</a>, <a href = "/reference/#/p5.Effect/connect">connect()</a>, and \n<a href = "/reference/#/p5.Effect/disconnect">disconnect()</a> are available.</p>\n',extends:"p5.Effect",is_constructor:1,params:[{name:"amount",description:"<p>Unbounded distortion amount.\n Normal values range from 0-1.</p>\n",type:"Number",optional:!0,optdefault:"0.25"},{name:"oversample",description:"<p>&#39;none&#39;, &#39;2x&#39;, or &#39;4x&#39;.</p>\n",type:"String",optional:!0,optdefault:"'none'"}]}},elements:{},classitems:[{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",module:"Conversion",submodule:"Color Conversion"},{file:"src/color/color_conversion.js",line:20,description:"<p>Convert an HSBA array to HSLA.</p>\n",class:"p5",module:"Conversion",submodule:"Color Conversion"},{file:"src/color/color_conversion.js",line:46,description:"<p>Convert an HSBA array to RGBA.</p>\n",class:"p5",module:"Conversion",submodule:"Color Conversion"},{file:"src/color/color_conversion.js",line:95,description:"<p>Convert an HSLA array to HSBA.</p>\n",class:"p5",module:"Conversion",submodule:"Color Conversion"},{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",module:"Conversion",submodule:"Color Conversion"},{file:"src/color/color_conversion.js",line:176,description:"<p>Convert an RGBA array to HSBA.</p>\n",class:"p5",module:"Conversion",submodule:"Color Conversion"},{file:"src/color/color_conversion.js",line:211,description:"<p>Convert an RGBA array to HSLA.</p>\n",class:"p5",module:"Conversion",submodule:"Color Conversion"},{file:"src/color/creating_reading.js",line:16,description:"<p>Extracts the alpha value from a color or pixel array.</p>\n",itemtype:"method",name:"alpha",params:[{name:"color",description:"<p>p5.Color object or pixel array</p>\n",type:"p5.Color|Array"}],return:{description:"the alpha value",type:"Number"},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>"],alt:"Left half of canvas light blue and right half light charcoal grey.\nLeft half of canvas light purple and right half a royal blue.\nLeft half of canvas salmon pink and the right half white.\nYellow rect in middle right of canvas, with 55 pixel width and height.\nYellow ellipse in top left canvas, black ellipse in bottom right,both 80x80.\nBright fuschia rect in middle of canvas, 60 pixel width and height.\nTwo bright green rects on opposite sides of the canvas, both 45x80.\nFour blue rects in each corner of the canvas, each are 35x35.\nBright sea green rect on left and darker rect on right of canvas, both 45x80.\nDark green rect on left and light green rect on right of canvas, both 45x80.\nDark blue rect on left and light teal rect on right of canvas, both 45x80.\nblue rect on left and green on right, both with black outlines & 35x60.\nsalmon pink rect on left and black on right, both 35x60.\n4 rects, tan, brown, brownish purple and purple, with white outlines & 20x60.\nlight pastel green rect on left and dark grey rect on right, both 35x60.\nyellow rect on left and red rect on right, both with black outlines & 35x60.\ngrey canvas\ndeep pink rect on left and grey rect on right, both 35x60.",class:"p5",module:"Color",submodule:"Creating & Reading"},{file:"src/color/creating_reading.js",line:60,description:"<p>Extracts the blue value from a color or pixel array.</p>\n",itemtype:"method",name:"blue",params:[{name:"color",description:"<p>p5.Color object or pixel array</p>\n",type:"p5.Color|Array"}],return:{description:"the blue value",type:"Number"},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'\nprint(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>"],alt:"Left half of canvas light purple and right half a royal blue.",class:"p5",module:"Color",submodule:"Creating & Reading"},{file:"src/color/creating_reading.js",line:89,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:"p5.Color|Array"}],return:{description:"the brightness value",type:"Number"},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>"],alt:"Left half of canvas salmon pink and the right half white.",class:"p5",module:"Color",submodule:"Creating & Reading"},{file:"src/color/creating_reading.js",line:118,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.\n<br><br>\nIf a single string argument is provided, RGB, RGBA and Hex CSS color\nstrings and all named color strings are supported. In this case, an alpha\nnumber value as a second argument is not supported, the RGBA form should be\nused.</p>\n",itemtype:"method",name:"color",return:{description:"resulting color",type:"p5.Color"},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>"],alt:"Yellow rect in middle right of canvas, with 55 pixel width and height.\nYellow ellipse in top left of canvas, black ellipse in bottom right,both 80x80.\nBright fuschia rect in middle of canvas, 60 pixel width and height.\nTwo bright green rects on opposite sides of the canvas, both 45x80.\nFour blue rects in each corner of the canvas, each are 35x35.\nBright sea green rect on left and darker rect on right of canvas, both 45x80.\nDark green rect on left and lighter green rect on right of canvas, both 45x80.\nDark blue rect on left and light teal rect on right of canvas, both 45x80.",class:"p5",module:"Color",submodule:"Creating & Reading",overloads:[{line:118,params:[{name:"gray",description:"<p>number specifying value between white\n and black.</p>\n",type:"Number"},{name:"alpha",description:"<p>alpha value relative to current color range\n (default is 0-255)</p>\n",type:"Number",optional:!0}],return:{description:"resulting color",type:"p5.Color"}},{line:277,params:[{name:"v1",description:"<p>red or hue value relative to\n the current color range</p>\n",type:"Number"},{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:!0}],return:{description:"",type:"p5.Color"}},{line:289,params:[{name:"value",description:"<p>a color string</p>\n",type:"String"},{name:"alpha",description:"",type:"Number",optional:!0}],return:{description:"",type:"p5.Color"}},{line:295,params:[{name:"values",description:"<p>an array containing the red,green,blue &amp;\n and alpha components of the color</p>\n",type:"Array"}],return:{description:"",type:"p5.Color"}},{line:301,params:[{name:"color",description:"",type:"p5.Color"
}],return:{description:"",type:"p5.Color"}}]},{file:"src/color/creating_reading.js",line:326,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:"p5.Color|Array"}],return:{description:"the green value",type:"Number"},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'\nprint(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>"],alt:"blue rect on left and green on right, both with black outlines & 35x60.",class:"p5",module:"Color",submodule:"Creating & Reading"},{file:"src/color/creating_reading.js",line:356,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:"p5.Color|Array"}],return:{description:"the hue",type:"Number"},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>"],alt:"salmon pink rect on left and black on right, both 35x60.",class:"p5",module:"Color",submodule:"Creating & Reading"},{file:"src/color/creating_reading.js",line:392,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:"p5.Color"},{name:"c2",description:"<p>interpolate to this color</p>\n",type:"p5.Color"},{name:"amt",description:"<p>number between 0 and 1</p>\n",type:"Number"}],return:{description:"interpolated color",type:"p5.Color"},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>"],alt:"4 rects one tan, brown, brownish purple, purple, with white outlines & 20x60",class:"p5",module:"Color",submodule:"Creating & Reading"},{file:"src/color/creating_reading.js",line:489,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:"p5.Color|Array"}],return:{description:"the lightness",type:"Number"},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>"],alt:"light pastel green rect on left and dark grey rect on right, both 35x60.",class:"p5",module:"Color",submodule:"Creating & Reading"},{file:"src/color/creating_reading.js",line:518,description:"<p>Extracts the red value from a color or pixel array.</p>\n",itemtype:"method",name:"red",params:[{name:"color",description:"<p>p5.Color object or pixel array</p>\n",type:"p5.Color|Array"}],return:{description:"the red value",type:"Number"},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'\nprint(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);\nprint(myColor);\n</code>\n</div>"],alt:"yellow rect on left and red rect on right, both with black outlines and 35x60.\ngrey canvas",class:"p5",module:"Color",submodule:"Creating & Reading"},{file:"src/color/creating_reading.js",line:557,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:"p5.Color|Array"}],return:{description:"the saturation value",type:"Number"},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>"],alt:"deep pink rect on left and grey rect on right, both 35x60.",class:"p5",module:"Color",submodule:"Creating & Reading"},{file:"src/color/p5.Color.js",line:118,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:149,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:168,description:"<p>CSS named colors.</p>\n",class:"p5.Color",module:"Color",submodule:"Creating & Reading"},{file:"src/color/p5.Color.js",line:321,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:334,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:447,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",optional:!0,multiple:!0}],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:"Number[]"},example:["\n<div>\n<code>\n// todo\n</code>\n</div>"],alt:"//todo",class:"p5.Color",module:"Color",submodule:"Creating & Reading"},{file:"src/color/p5.Color.js",line:638,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.\n<br><br>\nThe color is either specified in terms of the RGB, HSB, or HSL color\ndepending on the current colorMode. (The default color space is RGB, with\neach value in 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. In this case, an alpha number\nvalue as a second argument is not supported, the RGBA form should be used.\n<br><br>\nA p5.Color object can also be provided to set the background color.\n<br><br>\nA p5.Image can also be provided to set the background iamge.</p>\n",itemtype:"method",name:"background",chainable:1,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>"],alt:"canvas with darkest charcoal grey background.\ncanvas with yellow background.\ncanvas with royal blue background.\ncanvas with red background.\ncanvas with pink background.\ncanvas with black background.\ncanvas with bright green background.\ncanvas with soft green background.\ncanvas with red background.\ncanvas with light purple background.\ncanvas with blue background.",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:!0}],chainable:1},{line:133,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:!0}],chainable:1},{line:142,params:[{name:"gray",description:"<p>specifies a value between white and black</p>\n",type:"Number"},{name:"a",description:"",type:"Number",optional:!0}],chainable:1},{line:149,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:!0}],chainable:1},{line:161,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:!0}],chainable:1}]},{file:"src/color/setting.js",line:178,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",chainable:1,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>"],alt:"20x20 white ellipses are continually drawn at mouse x and y coordinates.",class:"p5",module:"Color",submodule:"Setting"},{file:"src/color/setting.js",line:216,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",chainable:1,class:"p5",module:"Color",submodule:"Setting",overloads:[{line:216,params:[{name:"mode",description:"<p>either RGB, HSB or HSL, corresponding to\n Red/Green/Blue and Hue/Saturation/Brightness\n (or Lightness)</p>\n",type:"Constant"},{name:"max",description:"<p>range for all values</p>\n",type:"Number",optional:!0}],chainable:1},{line:235,params:[{name:"mode",description:"",type:"Constant"},{name:"max1",description:"<p>range for the red or hue depending on the\n current color mode</p>\n",type:"Number"},{name:"max2",description:"<p>range for the green or saturation depending\n on the current color mode</p>\n",type:"Number"},{name:"max3",description:"<p>range for the blue or brightness/lighntess\n depending on the current color mode</p>\n",type:"Number"},{name:"maxA",description:"<p>range for the alpha</p>\n",type:"Number",optional:!0}],chainable:1}]},{file:"src/color/setting.js",line:335,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. In this case, an alpha number\nvalue as a second argument is not supported, the RGBA form should be used.\n<br><br>\nA p5 Color object can also be provided to set the fill color.</p>\n",itemtype:"method",name:"fill",chainable:1,class:"p5",module:"Color",submodule:"Setting",overloads:[{line:335,params:[{name:"v1",description:"<p>red or hue value relative to\n the current color range</p>\n",type:"Number"},{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:!0}],chainable:1},{line:359,params:[{name:"value",description:"<p>a color string</p>\n",type:"String"},{name:"alpha",description:"",type:"Number",optional:!0}],chainable:1},{line:366,params:[{name:"values",description:"<p>an array containing the red,green,blue &amp;\n and alpha components of the color</p>\n",type:"Number[]"}],chainable:1},{line:373,params:[{name:"color",description:"<p>the fill color</p>\n",type:"p5.Color"},{name:"alpha",description:"",type:"Number",optional:!0}],chainable:1}]},{file:"src/color/setting.js",line:489,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",chainable:1,example:["\n<div>\n<code>\nrect(15, 10, 55, 55);\nnoFill();\nrect(20, 20, 60, 60);\n</code>\n</div>"],alt:"white rect top middle and noFill rect center. Both 60x60 with black outlines.",class:"p5",module:"Color",submodule:"Setting"},{file:"src/color/setting.js",line:514,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",chainable:1,example:["\n<div>\n<code>\nnoStroke();\nrect(20, 20, 60, 60);\n</code>\n</div>"],alt:"60x60 white rect at center. no outline.",class:"p5",module:"Color",submodule:"Setting"},{file:"src/color/setting.js",line:542,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. In this case, an alpha\nnumber value as a second argument is not supported, the RGBA form should be\nused.\n<br><br>\nA p5 Color object can also be provided to set the stroke color.</p>\n",itemtype:"method",name:"stroke",chainable:1,class:"p5",module:"Color",submodule:"Setting",overloads:[{line:542,params:[{name:"v1",description:"<p>red or hue value relative to\n the current color range</p>\n",type:"Number"},{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:!0}],chainable:1},{line:567,params:[{name:"value",description:"<p>a color string</p>\n",type:"String"},{name:"alpha",description:"",type:"Number",optional:!0}],chainable:1},{line:574,params:[{name:"values",description:"<p>an array containing the red,green,blue &amp;\n and alpha components of the color</p>\n",type:"Number[]"}],chainable:1},{line:581,params:[{name:"color",description:"<p>the stroke color</p>\n",type:"p5.Color"},{name:"alpha",description:"",type:"Number",optional:!0}],chainable:1}]},{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. either CHORD or PIE</p>\n",type:"Constant",optional:!0}],chainable:1,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>"],alt:"shattered outline of an ellipse with a quarter of a white circle bottom-right.\nwhite ellipse with black outline with top right missing.\nwhite ellipse with top right missing with black outline around shape.\nwhite ellipse with top right quarter missing with black outline around the shape.",class:"p5",module:"Shape",submodule:"2D Primitives"},{file:"src/core/2d_primitives.js",line:132,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. If a negative height or width is specified, the absolute value is taken.\nThe origin may be changed with the ellipseMode() function.</p>\n",itemtype:"method",name:"ellipse",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:!0}],chainable:1,example:["\n<div>\n<code>\nellipse(56, 46, 55, 55);\n</code>\n</div>"],alt:"white ellipse with black outline in middle-right of canvas that is 55x55.",class:"p5",module:"Shape",submodule:"2D Primitives"},{file:"src/core/2d_primitives.js",line:187,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"}],chainable:1,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>"],alt:"line 78 pixels long running from mid-top to bottom-right of canvas.\n3 lines of various stroke sizes. Form top, bottom and right sides of a square.",class:"p5",module:"Shape",submodule:"2D Primitives"},{file:"src/core/2d_primitives.js",line:262,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"}],chainable:1,example:["\n<div>\n<code>\npoint(30, 20);\npoint(85, 20);\npoint(85, 75);\npoint(30, 75);\n</code>\n</div>"],alt:"4 points centered in the middle-right of the canvas.",class:"p5",module:"Shape",submodule:"2D Primitives"},{file:"src/core/2d_primitives.js",line:313,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",chainable:1,example:["\n<div>\n<code>\nquad(38, 31, 86, 20, 69, 63, 30, 76);\n</code>\n</div>"],alt:"irregular white quadrilateral shape with black outline mid-right of canvas.",class:"p5",module:"Shape",submodule:"2D Primitives",overloads:[{line:313,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"}],chainable:1},{line:341,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"}],chainable:1}]},{file:"src/core/2d_primitives.js",line:393,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>"],alt:"55x55 white rect with black outline in mid-right of canvas.\n55x55 white rect with black outline and rounded edges in mid-right of canvas.\n55x55 white rect with black outline and rounded edges of different radii.",class:"p5",module:"Shape",submodule:"2D Primitives",overloads:[{line:393,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:!0},{name:"tr",description:"<p>optional radius of top-right corner.</p>\n",type:"Number",optional:!0},{name:"br",description:"<p>optional radius of bottom-right corner.</p>\n",type:"Number",optional:!0},{name:"bl",description:"<p>optional radius of bottom-left corner.</p>\n",type:"Number",optional:!0}],return:{description:"the p5 object.",type:"P5"}},{line:443,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:!0},{name:"detailY",description:"",type:"Number",optional:!0}],chainable:1}]},{file:"src/core/2d_primitives.js",line:477,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"}],chainable:1,example:["\n<div>\n<code>\ntriangle(30, 75, 58, 20, 86, 75);\n</code>\n</div>"],alt:"white triangle with black outline in mid-right of canvas.",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"}],chainable:1,
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>"],alt:"60x60 white ellipse and 30x30 grey ellipse with black outlines at center.\n60x60 white ellipse @center and 30x30 grey ellipse top-right, black outlines.",class:"p5",module:"Shape",submodule:"Attributes"},{file:"src/core/attributes.js",line:80,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",chainable:1,example:["\n<div>\n<code>\nbackground(0);\nnoStroke();\nsmooth();\nellipse(30, 48, 36, 36);\nnoSmooth();\nellipse(70, 48, 36, 36);\n</code>\n</div>"],alt:"2 pixelated 36x36 white ellipses to left & right of center, black background",class:"p5",module:"Shape",submodule:"Attributes"},{file:"src/core/attributes.js",line:108,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"}],chainable:1,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>"],alt:"50x50 white rect at center and 25x25 grey rect in the top left of the other.\n50x50 white rect at center and 25x25 grey rect in the center of the other.",class:"p5",module:"Shape",submodule:"Attributes"},{file:"src/core/attributes.js",line:174,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",chainable:1,example:["\n<div>\n<code>\nbackground(0);\nnoStroke();\nsmooth();\nellipse(30, 48, 36, 36);\nnoSmooth();\nellipse(70, 48, 36, 36);\n</code>\n</div>"],alt:"2 pixelated 36x36 white ellipses one left one right of center. On black.",class:"p5",module:"Shape",submodule:"Attributes"},{file:"src/core/attributes.js",line:203,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:"Constant"}],chainable:1,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>"],alt:"3 lines. Top line: rounded ends, mid: squared, bottom:longer squared ends.",class:"p5",module:"Shape",submodule:"Attributes"},{file:"src/core/attributes.js",line:237,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:"Constant"}],chainable:1,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>"],alt:"Right-facing arrowhead shape with pointed tip in center of canvas.\nRight-facing arrowhead shape with flat tip in center of canvas.\nRight-facing arrowhead shape with rounded tip in center of canvas.",class:"p5",module:"Shape",submodule:"Attributes"},{file:"src/core/attributes.js",line:301,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>"],alt:"3 horizontal black lines. Top line: thin, mid: medium, bottom:thick.",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:12,itemtype:"property",name:"P2D",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:17,itemtype:"property",name:"WEBGL",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:33,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",type:"Number",final:1,example:["\n<div><code>\narc(50, 50, 80, 80, 0, HALF_PI);\n</code></div>"],alt:"80x80 white quarter-circle with curve toward bottom right of canvas.",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:52,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",type:"Number",final:1,example:["\n<div><code>\narc(50, 50, 80, 80, 0, PI);\n</code></div>"],alt:"white half-circle with curve toward bottom of canvas.",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:71,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",type:"Number",final:1,example:["\n<div><code>\narc(50, 50, 80, 80, 0, QUARTER_PI);\n</code></div>"],alt:"white eighth-circle rotated about 40 degrees with curve bottom right canvas.",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:90,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",type:"Number",final:1,example:["\n<div><code>\narc(50, 50, 80, 80, 0, TAU);\n</code></div>"],alt:"80x80 white ellipse shape in center of canvas.",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:109,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",type:"Number",final:1,example:["\n<div><code>\narc(50, 50, 80, 80, 0, TWO_PI);\n</code></div>"],alt:"80x80 white ellipse shape in center of canvas.",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:128,itemtype:"property",name:"DEGREES",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:133,itemtype:"property",name:"RADIANS",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:142,itemtype:"property",name:"CORNER",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:147,itemtype:"property",name:"CORNERS",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:152,itemtype:"property",name:"RADIUS",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:157,itemtype:"property",name:"RIGHT",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:162,itemtype:"property",name:"LEFT",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:167,itemtype:"property",name:"CENTER",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:172,itemtype:"property",name:"TOP",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:177,itemtype:"property",name:"BOTTOM",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:182,itemtype:"property",name:"BASELINE",type:"String",final:1,default:"alphabetic",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:188,itemtype:"property",name:"POINTS",type:"Number",final:1,default:"0x0000",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:194,itemtype:"property",name:"LINES",type:"Number",final:1,default:"0x0001",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:200,itemtype:"property",name:"LINE_STRIP",type:"Number",final:1,default:"0x0003",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:206,itemtype:"property",name:"LINE_LOOP",type:"Number",final:1,default:"0x0002",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:212,itemtype:"property",name:"TRIANGLES",type:"Number",final:1,default:"0x0004",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:218,itemtype:"property",name:"TRIANGLE_FAN",type:"Number",final:1,default:"0x0006",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:224,itemtype:"property",name:"TRIANGLE_STRIP",type:"Number",final:1,default:"0x0005",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:230,itemtype:"property",name:"QUADS",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:235,itemtype:"property",name:"QUAD_STRIP",type:"String",final:1,default:"quad_strip",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:241,itemtype:"property",name:"CLOSE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:246,itemtype:"property",name:"OPEN",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:251,itemtype:"property",name:"CHORD",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:256,itemtype:"property",name:"PIE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:261,itemtype:"property",name:"PROJECT",type:"String",final:1,default:"square",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:267,itemtype:"property",name:"SQUARE",type:"String",final:1,default:"butt",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:273,itemtype:"property",name:"ROUND",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:278,itemtype:"property",name:"BEVEL",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:283,itemtype:"property",name:"MITER",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:290,itemtype:"property",name:"RGB",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:295,itemtype:"property",name:"HSB",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:300,itemtype:"property",name:"HSL",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:326,itemtype:"property",name:"BLEND",type:"String",final:1,default:"source-over",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:332,itemtype:"property",name:"ADD",type:"String",final:1,default:"lighter",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:340,itemtype:"property",name:"DARKEST",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:345,itemtype:"property",name:"LIGHTEST",type:"String",final:1,default:"lighten",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:351,itemtype:"property",name:"DIFFERENCE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:356,itemtype:"property",name:"EXCLUSION",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:361,itemtype:"property",name:"MULTIPLY",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:366,itemtype:"property",name:"SCREEN",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:371,itemtype:"property",name:"REPLACE",type:"String",final:1,default:"copy",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:377,itemtype:"property",name:"OVERLAY",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:382,itemtype:"property",name:"HARD_LIGHT",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:387,itemtype:"property",name:"SOFT_LIGHT",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:392,itemtype:"property",name:"DODGE",type:"String",final:1,default:"color-dodge",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:398,itemtype:"property",name:"BURN",type:"String",final:1,default:"color-burn",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:406,itemtype:"property",name:"THRESHOLD",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:411,itemtype:"property",name:"GRAY",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:416,itemtype:"property",name:"OPAQUE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:421,itemtype:"property",name:"INVERT",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:426,itemtype:"property",name:"POSTERIZE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:431,itemtype:"property",name:"DILATE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:436,itemtype:"property",name:"ERODE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:441,itemtype:"property",name:"BLUR",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:448,itemtype:"property",name:"NORMAL",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:453,itemtype:"property",name:"ITALIC",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:458,itemtype:"property",name:"BOLD",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:482,itemtype:"property",name:"LANDSCAPE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:487,itemtype:"property",name:"PORTRAIT",type:"String",final:1,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:!0},{name:"sync",description:"<p>start synchronously (optional)</p>\n",type:"Boolean",optional:!0}],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).<br><br>\nBy default the text &quot;loading...&quot; will be displayed. To make your own\nloading page, include an HTML element with id &quot;p5_loading&quot; in your\npage. More information <a href="http://bit.ly/2kQ6Nio">here</a>.</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>"],alt:"nothing displayed",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/core.js",line:85,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>"],alt:"nothing displayed",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/core.js",line:116,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>"],alt:"nothing displayed",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/core.js",line:393,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. While all functions and\nvariables and objects created by the p5 library will be removed, any\nother global variables created by your code will remain.</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>"],alt:"nothing displayed",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/curves.js",line:16,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:"P5"},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>"],alt:"stretched black s-shape in center with orange lines extending from end points.\nstretched black s-shape with 10 5x5 white ellipses along the shape.\nstretched black s-shape with 7 5x5 ellipses and orange lines along the shape.\nstretched black s-shape with 17 small orange lines extending from under shape.\nhorseshoe shape with orange ends facing left and black curved center.\nhorseshoe shape with orange ends facing left and black curved center.\nLine shaped like right-facing arrow,points move with mouse-x and warp shape.\nhorizontal line that hooks downward on the right and 13 5x5 ellipses along it.\nright curving line mid-right of canvas with 7 short lines radiating from it.",class:"p5",module:"Shape",submodule:"Curves",overloads:[{line:16,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"}],return:{description:"the p5 object",type:"P5"}},{line:59,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"}],chainable:1}]},{file:"src/core/curves.js",line:99,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"}],chainable:1,example:["\n<div>\n<code>\nbackground(204);\nbezierDetail(50);\nbezier(85, 20, 10, 10, 90, 90, 15, 80);\n</code>\n</div>"],alt:"stretched black s-shape with 7 5x5 ellipses and orange lines along the shape.",class:"p5",module:"Shape",submodule:"Curves"},{file:"src/core/curves.js",line:124,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>"],alt:"stretched black s-shape with 17 small orange lines extending from under shape.",class:"p5",module:"Shape",submodule:"Curves"},{file:"src/core/curves.js",line:175,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>"],alt:"s-shaped line with 17 short orange lines extending from underside of shape",class:"p5",module:"Shape",submodule:"Curves"},{file:"src/core/curves.js",line:256,
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:"P5"},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>"],alt:"horseshoe shape with orange ends facing left and black curved center.\nhorseshoe shape with orange ends facing left and black curved center.",class:"p5",module:"Shape",submodule:"Curves",overloads:[{line:256,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"}],return:{description:"the p5 object",type:"P5"}},{line:308,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"}],chainable:1}]},{file:"src/core/curves.js",line:353,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"}],chainable:1,example:["\n<div>\n<code>\nbackground(204);\ncurveDetail(20);\ncurve(5, 26, 5, 26, 73, 24, 73, 61);\n</code>\n</div>"],alt:"white arch shape in top-mid canvas.",class:"p5",module:"Shape",submodule:"Curves"},{file:"src/core/curves.js",line:378,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"}],chainable:1,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>"],alt:"Line shaped like right-facing arrow,points move with mouse-x and warp shape.",class:"p5",module:"Shape",submodule:"Curves"},{file:"src/core/curves.js",line:423,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>\n\nline hooking down to right-bottom with 13 5x5 white ellipse points"],class:"p5",module:"Shape",submodule:"Curves"},{file:"src/core/curves.js",line:476,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>"],alt:"right curving line mid-right of canvas with 7 short lines radiating from it.",class:"p5",module:"Shape",submodule:"Curves"},{file:"src/core/environment.js",line:22,description:"<p>The print() 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 (+).</p>\n",itemtype:"method",name:"print",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;\nprint("The value of x is " + x);\n// prints "The value of x is 10"\n</code></div>'],alt:"default grey canvas",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:51,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",type:"Number",readonly:"",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>"],alt:"numbers rapidly counting upward with frame count set to 30.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:79,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",type:"Boolean",readonly:"",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>'],alt:"green 50x50 ellipse at top left. Red X covers canvas when page focus changes",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:110,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:"String|Constant"},{name:"x",description:"<p>the horizontal active spot of the cursor</p>\n",type:"Number",optional:!0},{name:"y",description:"<p>the vertical active spot of the cursor</p>\n",type:"Number",optional:!0}],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>"],alt:"horizontal line divides canvas. cursor on left is a cross, right is hand.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:169,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. The\ndraw function must run at least once before it will return a value. 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",chainable:1,class:"p5",module:"Environment",submodule:"Environment",overloads:[{line:169,params:[{name:"fps",description:"<p>number of frames to be displayed every second</p>\n",type:"Number"}],chainable:1},{line:188,params:[],return:{description:"current frameRate",type:"Number"}}]},{file:"src/core/environment.js",line:238,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:247,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:!0}],class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:262,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>"],alt:"cursor becomes 10x 10 white ellipse the moves with mouse x and y.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:288,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",type:"Number",readonly:"",example:['\n<div class="norender"><code>\ncreateCanvas(displayWidth, displayHeight);\n</code></div>'],alt:"cursor becomes 10x 10 white ellipse the moves with mouse x and y.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:305,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",type:"Number",readonly:"",example:['\n<div class="norender"><code>\ncreateCanvas(displayWidth, displayHeight);\n</code></div>'],alt:"no display.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:322,description:"<p>System variable that stores the width of the inner window, it maps to\nwindow.innerWidth.</p>\n",itemtype:"property",name:"windowWidth",type:"Number",readonly:"",example:['\n<div class="norender"><code>\ncreateCanvas(windowWidth, windowHeight);\n</code></div>'],alt:"no display.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:338,description:"<p>System variable that stores the height of the inner window, it maps to\nwindow.innerHeight.</p>\n",itemtype:"property",name:"windowHeight",type:"Number",readonly:"",example:['\n<div class="norender"><code>\ncreateCanvas(windowWidth, windowHeight);\n</code></div>'],alt:"no display.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:354,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\nadjustments to accommodate 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>'],alt:"no display.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:404,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",type:"Number",readonly:"",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:416,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",type:"Number",readonly:"",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:428,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:!0}],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>"],alt:"no display.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:475,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:!0}],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>"],alt:"fuzzy 50x50 white ellipse with black outline in center of canvas.\nsharp 50x50 white ellipse with black outline in center of canvas.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:520,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>"],alt:"50x50 white ellipse with black outline in center of canvas.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:577,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>"],alt:"current url (http://p5js.org/reference/#/p5/getURL) moves right to left.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:608,description:"<p>Gets the current URL path as an array.</p>\n",itemtype:"method",name:"getURLPath",return:{description:"path components",type:"String[]"},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>"],alt:"no display",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:629,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>"],alt:"no display.",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:34,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:"Number|String"}],return:{description:"console logs"},class:"p5",module:"Environment"},{file:"src/core/error_helpers.js",line:106,description:"<p>Validates parameters\nparam {String} func the name of the function\nparam {Array} args user input arguments</p>\n<p>example:\n var a;\n ellipse(10,10,a,5);\nconsole ouput:\n &quot;It looks like ellipse received an empty variable in spot #2.&quot;</p>\n<p>example:\n ellipse(10,&quot;foo&quot;,5,5);\nconsole output:\n &quot;ellipse was expecting a number for parameter #1,\n received &quot;foo&quot; instead.&quot;</p>\n",class:"p5",module:"Environment"},{file:"src/core/error_helpers.js",line:273,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/init.js",line:5,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.Element",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",readonly:"",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:39,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",chainable:1,class:"p5.Element",module:"DOM",submodule:"DOM",overloads:[{line:39,params:[{name:"parent",description:"<p>the ID, DOM node, or p5.Element\n of desired parent element</p>\n",type:"String|p5.Element|Object"}],chainable:1},{line:53,params:[],return:{description:"",type:"p5.Element"}}]},{file:"src/core/p5.Element.js",line:103,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",chainable:1,class:"p5.Element",module:"DOM",submodule:"DOM",overloads:[{line:103,params:[{name:"id",description:"<p>ID of the element</p>\n",type:"String"}],chainable:1},{line:112,params:[],return:{description:"the id of the element",type:"String"}}]},{file:"src/core/p5.Element.js",line:141,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",chainable:1,class:"p5.Element",module:"DOM",submodule:"DOM",overloads:[{line:141,params:[{name:"class",description:"<p>class to add</p>\n",type:"String"}],chainable:1},{line:150,params:[],return:{description:"the class of the element",type:"String"}}]},{file:"src/core/p5.Element.js",line:163,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.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,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>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:213,description:"<p>The .doubleClicked() function is called once after every time a\nmouse button is pressed twice over the element. This can be used to\nattach element and action specific event listeners.</p>\n",itemtype:"method",name:"doubleClicked",params:[{name:"fxn",description:"<p>function to be fired when mouse is\n double clicked over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],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.doubleClicked(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 double click anywhere\nfunction doubleClicked() {\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>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:263,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.\n<br><br>\nThe function accepts a callback function as argument which will be executed\nwhen the <code>wheel</code> event is triggered on the element, the callback function is\npassed one argument <code>event</code>. The <code>event.deltaY</code> property returns negative\nvalues if the mouse wheel is rotated up or away from the user and positive\nin the other direction. The <code>event.deltaX</code> does the same as <code>event.deltaY</code>\nexcept it reads the horizontal wheel scroll of the mouse wheel.\n<br><br>\nOn OS X with &quot;natural&quot; scrolling enabled, the <code>event.deltaY</code> values are\nreversed.</p>\n",itemtype:"method",name:"mouseWheel",params:[{name:"fxn",description:"<p>function to be fired when mouse is\n scrolled over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,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(event) {\n if (event.deltaY > 0) {\n d = d + 10;\n } else {\n d = d - 10;\n }\n}\n</code></div>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:329,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.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,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>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:383,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.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:['\n<div class="norender">\n<code>\nvar cnv;\nvar d;\nvar g;\n\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>\n</div>'],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:437,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 a mouse moves\n over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,
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>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:496,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 a mouse moves\n onto the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,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>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:541,description:"<p>The .changed() function is called when the value of an\nelement changes.\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\n an element changes.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,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>"],alt:'dropdown: pear, kiwi, grape. When selected text "its a" + selection shown.',class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:608,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 when any user input is\n detected within the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,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>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:643,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 a mouse\n moves off of an element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,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>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:686,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 a touch\n starts over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,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>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:735,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 a touch moves over\n the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,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>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:776,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 a touch ends\n over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,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>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:828,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 a file is\n dragged over the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:["\n<div><code>\n// To test this sketch, simply drag a\n// file over the canvas\nfunction setup() {\n var c = createCanvas(100, 100);\n background(200);\n textAlign(CENTER);\n text('Drag file', width/2, height/2);\n c.dragOver(dragOverCallback);\n}\n\n// This function will be called whenever\n// a file is dragged over the canvas\nfunction dragOverCallback() {\n background(240);\n text('Dragged over', width/2, height/2);\n}\n</code></div>"],alt:"nothing displayed",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:866,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 a file is\n dragged off the element.\n if <code>false</code> is passed instead, the previously\n firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:["\n<div><code>\n// To test this sketch, simply drag a file\n// over and then out of the canvas area\nfunction setup() {\n var c = createCanvas(100, 100);\n background(200);\n textAlign(CENTER);\n text('Drag file', width/2, height/2);\n c.dragLeave(dragLeaveCallback);\n}\n\n// This function will be called whenever\n// a file is dragged out of the canvas\nfunction dragLeaveCallback() {\n background(240);\n text('Dragged off', width/2, height/2);\n}\n</code></div>"],alt:"nothing displayed",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:904,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>callback triggered when files are dropped.</p>\n",type:"Function|Boolean"},{name:"fxn",description:"<p>callback to receive loaded file.</p>\n",type:"Function|Boolean"}],chainable:1,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>"],alt:"Canvas turns into whatever image is dragged/dropped onto it.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:1031,description:"<p>Helper fxn for sharing pixel methods</p>\n",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Renderer.js",line:72,description:"<p>Resize our canvas element.</p>\n",class:"p5.Renderer",module:"Rendering",submodule:"Rendering"},{file:"src/core/p5.Renderer.js",line:146,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:202,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>either P2D or WEBGL</p>\n",type:"Constant",optional:!0}],return:{description:"canvas generated",type:"HTMLCanvasElement"},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>"],alt:"Black line extending from top-left of canvas to bottom right.",class:"p5",module:"Rendering",submodule:"Rendering"},{file:"src/core/rendering.js",line:112,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",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:"noRedraw",description:"<p>don&#39;t redraw the canvas immediately</p>\n",type:"Boolean",optional:!0}],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>'],alt:"No image displayed.",class:"p5",module:"Rendering",submodule:"Rendering"},{file:"src/core/rendering.js",line:162,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>"],alt:"no image displayed",class:"p5",module:"Rendering",submodule:"Rendering"},{file:"src/core/rendering.js",line:185,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>either P2D or WEBGL\nundefined defaults to p2d</p>\n",type:"Constant",optional:!0}],return:{description:"offscreen graphics buffer",type:"p5.Graphics"},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>"],alt:"4 grey squares alternating light and dark grey. White quarter circle mid-left.",class:"p5",module:"Rendering",submodule:"Rendering"},{file:"src/core/rendering.js",line:223,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.\n either BLEND, DARKEST, LIGHTEST, DIFFERENCE, MULTIPLY,\n EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\n SOFT_LIGHT, DODGE, BURN, ADD or NORMAL</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>"],alt:"translucent image thick red & blue diagonal rounded lines intersecting center\nThick red & blue diagonal rounded lines intersecting center. dark at overlap",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>"],alt:"113 pixel long line extending from top-left to bottom right of canvas.\nhorizontal line moves slowly from left. Loops but stops on mouse press.",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/structure.js",line:77,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>"],alt:"horizontal line moves slowly from left. Loops but stops on mouse press.",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/structure.js",line:119,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>"],alt:"Gold ellipse + thick black outline @center 2 white ellipses on left and right.\n2 Gold ellipses left black right blue stroke. 2 white ellipses on left+right.",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/structure.js",line:194,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>"],alt:"Gold ellipse + thick black outline @center 2 white ellipses on left and right.\n2 Gold ellipses left black right blue stroke. 2 white ellipses on left+right.",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/structure.js",line:266,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:!0}],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 class='norender'><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>"],alt:"black line on far left of canvas\n black line on far left of canvas",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 a powerful operation that can perform the equivalent of translate,\nscale, shear and rotate all at once. You can learn more about transformation\nmatrices on <a href="https://en.wikipedia.org/wiki/Transformation_matrix">\nWikipedia</a>.</p>\n<p>The naming of the arguments here follows the naming of the <a href=\n"https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-transform">\nWHATWG specification</a> and corresponds to a\ntransformation matrix of the\nform:</p>\n<blockquote>\n<p><img style="max-width: 150px" src="assets/transformation-matrix.png"\nalt="The transformation matrix used when applyMatrix is called"/></p>\n</blockquote>\n',itemtype:"method",name:"applyMatrix",params:[{name:"a",description:"<p>numbers which define the 2x3 matrix to be multiplied</p>\n",type:"Number"},{name:"b",description:"<p>numbers which define the 2x3 matrix to be multiplied</p>\n",type:"Number"},{name:"c",description:"<p>numbers which define the 2x3 matrix to be multiplied</p>\n",type:"Number"},{name:"d",description:"<p>numbers which define the 2x3 matrix to be multiplied</p>\n",type:"Number"},{name:"e",description:"<p>numbers which define the 2x3 matrix to be multiplied</p>\n",type:"Number"},{name:"f",description:"<p>numbers which define the 2x3 matrix to be multiplied</p>\n",type:"Number"}],chainable:1,example:["\n<div>\n<code>\nfunction setup() {\n frameRate(10);\n rectMode(CENTER);\n}\n\nfunction draw() {\n var step = frameCount % 20;\n background(200);\n // Equivalent to translate(x, y);\n applyMatrix(1, 0, 0, 1, 40 + step, 50);\n rect(0, 0, 50, 50);\n}\n</code>\n</div>\n<div>\n<code>\nfunction setup() {\n frameRate(10);\n rectMode(CENTER);\n}\n\nfunction draw() {\n var step = frameCount % 20;\n background(200);\n translate(50, 50);\n // Equivalent to scale(x, y);\n applyMatrix(1 / step, 0, 0, 1 / step, 0, 0);\n rect(0, 0, 50, 50);\n}\n</code>\n</div>\n<div>\n<code>\nfunction setup() {\n frameRate(10);\n rectMode(CENTER);\n}\n\nfunction draw() {\n var step = frameCount % 20\n var angle = map(step, 0, 20, 0, TWO_PI);\n var cos_a = cos(angle);\n var sin_a = sin(angle);\n background(200);\n translate(50, 50);\n // Equivalent to rotate(angle);\n applyMatrix(cos_a, sin_a, -sin_a, cos_a, 0, 0);\n rect(0, 0, 50, 50);\n}\n</code>\n</div>\n<div>\n<code>\nfunction setup() {\n frameRate(10);\n rectMode(CENTER);\n}\n\nfunction draw() {\n var step = frameCount % 20\n var angle = map(step, 0, 20, -PI/4, PI/4);\n background(200);\n translate(50, 50);\n // equivalent to shearX(angle);\n var shear_factor = 1 / tan(PI/2 - angle);\n applyMatrix(1, 0, shear_factor, 1, 0, 0);\n rect(0, 0, 50, 50);\n}\n</code>\n</div>"],alt:"A rectangle translating to the right\nA rectangle shrinking to the center\nA rectangle rotating clockwise about the center\nA rectangle shearing",class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:137,description:"<p>Replaces the current matrix with the identity matrix.</p>\n",itemtype:"method",name:"resetMatrix",chainable:1,example:["\n<div>\n<code>\ntranslate(50, 50);\napplyMatrix(0.5, 0.5, -0.5, 0.5, 0, 0);\nrect(0, 0, 20, 20);\n// Note that the translate is also reset.\nresetMatrix();\nrect(0, 0, 20, 20);\n</code>\n</div>"],alt:"A rotated retangle in the center with another at the top left corner",class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:163,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",params:[{name:"angle",
description:"<p>the angle of rotation, specified in radians\n or degrees, depending on current angleMode</p>\n",type:"Number"},{name:"axis",description:"<p>(in 3d) the axis to rotate around</p>\n",type:"p5.Vector|Array",optional:!0}],chainable:1,example:["\n<div>\n<code>\ntranslate(width/2, height/2);\nrotate(PI/3.0);\nrect(-26, -26, 52, 52);\n</code>\n</div>"],alt:"white 52x52 rect with black outline at center rotated counter 45 degrees",class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:218,description:"<p>Rotates around X axis.</p>\n",itemtype:"method",name:"rotateX",params:[{name:"rad",description:"<p>angles in radians</p>\n",type:"Number"}],chainable:1,class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:233,description:"<p>Rotates around Y axis.</p>\n",itemtype:"method",name:"rotateY",params:[{name:"rad",description:"<p>angles in radians</p>\n",type:"Number"}],chainable:1,class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:248,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"}],chainable:1,class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:263,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:!0},{name:"z",description:"<p>percent to scale the object in the z-axis (webgl only)</p>\n",type:"Number",optional:!0}],chainable:1,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>"],alt:"white 52x52 rect with black outline at center rotated counter 45 degrees\n2 white rects with black outline- 1 50x50 at center. other 25x65 bottom left",class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:345,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"}],chainable:1,example:["\n<div>\n<code>\ntranslate(width/4, height/4);\nshearX(PI/4.0);\nrect(0, 0, 30, 30);\n</code>\n</div>"],alt:"white irregular quadrilateral with black outline at top middle.",class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:386,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"}],chainable:1,example:["\n<div>\n<code>\ntranslate(width/4, height/4);\nshearY(PI/4.0);\nrect(0, 0, 30, 30);\n</code>\n</div>"],alt:"white irregular quadrilateral with black outline at middle bottom.",class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:427,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:!0}],chainable:1,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>"],alt:"white 55x55 rect with black outline at center right.\n3 white 55x55 rects with black outlines at top-l, center-r and bottom-r.",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",chainable:1,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>"],alt:"white rect and smaller grey rect with red outlines in center of canvas.",class:"p5",module:"Shape",submodule:"Vertex"},{file:"src/core/vertex.js",line:70,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",optional:!0}],chainable:1,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>"],alt:"white square-shape with black outline in middle-right of canvas.\n4 black points in a square shape in middle-right of canvas.\n2 horizontal black lines. In the top-right and bottom-right of canvas.\n3 line shape with horizontal on top, vertical in middle and horizontal bottom.\nsquare line shape in middle-right of canvas.\n2 white triangle shapes mid-right canvas. left one pointing up and right down.\n5 horizontal interlocking and alternating white triangles in mid-right canvas.\n4 interlocking white triangles in 45 degree rotated square-shape.\n2 white rectangle shapes in mid-right canvas. Both 20x55.\n3 side-by-side white rectangles center rect is smaller in mid-right canvas.\nThick white l-shape with black outline mid-top-left of canvas.",class:"p5",module:"Shape",submodule:"Vertex"},{file:"src/core/vertex.js",line:267,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"}],chainable:1,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>"],alt:"crescent-shaped line in middle of canvas. Points facing left.\nwhite crescent shape in middle of canvas. Points facing left.",class:"p5",module:"Shape",submodule:"Vertex"},{file:"src/core/vertex.js",line:332,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"}],chainable:1,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>"],alt:"Upside-down u-shape line, mid canvas. left point extends beyond canvas view.",class:"p5",module:"Shape",submodule:"Vertex"},{file:"src/core/vertex.js",line:374,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",chainable:1,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>"],alt:"white rect and smaller grey rect with red outlines in center of canvas.",class:"p5",module:"Shape",submodule:"Vertex"},{file:"src/core/vertex.js",line:434,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",optional:!0}],chainable:1,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>"],alt:"Triangle line shape with smallest interior angle on bottom and upside-down L.",class:"p5",module:"Shape",submodule:"Vertex"},{file:"src/core/vertex.js",line:502,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"}],chainable:1,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>"],alt:"arched-shaped black line with 4 pixel thick stroke weight.\nbackwards s-shaped black line with 4 pixel thick stroke weight.",class:"p5",module:"Shape",submodule:"Vertex"},{file:"src/core/vertex.js",line:579,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"},{name:"z",description:"<p>z-coordinate of the vertex</p>\n",type:"Number|Boolean",optional:!0}],chainable:1,example:["\n<div>\n<code>\nbeginShape(POINTS);\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape();\n</code>\n</div>"],alt:"4 black points in a square shape in middle-right of canvas.",class:"p5",module:"Shape",submodule:"Vertex"},{file:"src/data/p5.TypedDict.js",line:16,description:"<p>Creates a new instance of p5.StringDict using the key, value pair\n or object you provide.</p>\n",itemtype:"method",name:"createStringDict",params:[{name:"key",description:"<p>or object</p>\n",type:"String|Object"},{name:"value",description:"",type:"String"}],return:{description:"",type:"p5.StringDict"},class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:32,description:"<p>Creates a new instance of p5.NumberDict using the key, value pair\n or object you provide.</p>\n",itemtype:"method",name:"createNumberDict",params:[{name:"key",description:"<p>or object</p>\n",type:"Number|Object"},{name:"value",description:"",type:"Number"}],return:{description:"",type:"p5.NumberDict"},class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:68,description:"<p>Returns the number of key-value pairs currently in Dictionary object</p>\n",itemtype:"method",name:"size",return:{description:"the number of key-value pairs in Dictionary object",type:"Number"},example:['\n<div class="norender">\n<code>\n\nfunction setup() {\n var myDictionary = createNumberDict(1, 10);\n myDictionary.create(2, 20);\n myDictionary.create(3, 30);\n var amt = myDictionary.size(); // value of amt is 3\n}\n\n</code></div>\n'],class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:92,description:"<p>Returns true if key exists in Dictionary\notherwise returns false</p>\n",itemtype:"method",name:"hasKey",params:[{name:"key",description:"<p>that you want to access</p>\n",type:"Number|String"}],return:{description:"whether that key exists in Dictionary",type:"Boolean"},example:["\n<div class=\"norender\">\n<code>\n\nfunction setup() {\n var myDictionary = createStringDict('p5', 'js');\n print(myDictionary.hasKey('p5')); // logs true to console\n}\n\n</code></div>\n"],class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:117,description:"<p>Returns value stored at supplied key.</p>\n",itemtype:"method",name:"get",params:[{name:"key",description:"<p>that you want to access</p>\n",type:"Number|String"}],return:{description:"the value stored at that key",type:"Number|String"},example:["\n<div class=\"norender\">\n<code>\n\nfunction setup() {\n var myDictionary = createStringDict('p5', 'js');\n var myValue = myDictionary.get('p5');\n print(myValue === 'js'); // logs true to console\n}\n\n</code></div>\n"],class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:146,description:"<p>Changes the value of key if in it already exists in\nin the Dictionary otherwise makes a new key-value pair</p>\n",itemtype:"method",name:"set",params:[{name:"key",description:"",type:"Number|String"},{name:"value",description:"",type:"Number|String"}],example:["\n<div class=\"norender\">\n<code>\n\nfunction setup() {\n var myDictionary = createStringDict('p5', 'js');\n myDictionary.set('p5', 'JS');\n myDictionary.print()\n // above logs \"key: p5 - value: JS\" to console\n}\n\n</code></div>\n"],class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:179,description:"<p>private helper function to handle the user passing objects in\nduring construction or calls to create()</p>\n",class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:194,description:"<p>Removes a key-value pair in the Dictionary</p>\n",itemtype:"method",name:"create",class:"p5.TypedDict",module:"Data",submodule:"Dictionary",overloads:[{line:194,params:[{name:"key",description:"",type:"Number|String"},{name:"value",description:"",type:"Number|String"}]},{line:201,params:[{name:"obj",description:"<p>key/value pair</p>\n",type:"Object"}]}]},{file:"src/data/p5.TypedDict.js",line:234,description:"<p>Empties Dictionary of all key-value pairs</p>\n",itemtype:"method",name:"clear",class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:245,description:"<p>Removes a key-value pair in the Dictionary</p>\n",itemtype:"method",name:"remove",params:[{name:"key",description:"<p>for the pair to remove</p>\n",type:"Number|String"}],example:["\n<div class=\"norender\">\n<code>\n\nfunction setup() {\n var myDictionary = createStringDict('p5', 'js');\n myDictionary.create('happy', 'coding');\n myDictionary.print()\n // above logs \"key: p5 - value: js, key: happy - value: coding\" to console\n myDictionary.remove('p5');\n myDictionary.print();\n // above logs \"key: happy value: coding\" to console\n}\n\n</code></div>\n"],class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:277,description:"<p>Logs the list of items currently in the Dictionary to the console</p>\n",itemtype:"method",name:"print",class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:289,description:"<p>Converts the Dictionary into a CSV file for local\nstorage.</p>\n",itemtype:"method",name:"saveTable",class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:310,description:"<p>Converts the Dictionary into a JSON file for local\nstorage.</p>\n",itemtype:"method",name:"saveJSON",class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:321,description:"<p>private helper function to ensure that the user passed in valid\nvalues for the Dictionary type</p>\n",class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:368,description:"<p>private helper function to ensure that the user passed in valid\nvalues for the Dictionary type</p>\n",class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:377,description:"<p>Add to a value stored at a certain key\nThe sum is stored in that location in the Dictionary.</p>\n",itemtype:"method",name:"add",params:[{name:"Key",description:"<p>for value you wish to add to</p>\n",type:"Number"},{name:"Amount",description:"<p>to add to the value</p>\n",type:"Number"}],example:["\n<div class='norender'>\n<code>\nfunction setup() {\n var myDictionary = createNumberDict(2, 5);\n myDictionary.add(2, 2);\n console.log(myDictionary.get(2)); // logs 7 to console.\n}\n</code></div>\n\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:405,description:"<p>Subtract from a value stored at a certain key\nThe difference is stored in that location in the Dictionary.</p>\n",itemtype:"method",name:"sub",params:[{name:"Key",description:"<p>for value you wish to subtract from</p>\n",type:"Number"},{name:"Amount",description:"<p>to subtract from the value</p>\n",type:"Number"}],example:["\n<div class='norender'>\n<code>\nfunction setup() {\n var myDictionary = createNumberDict(2, 5);\n myDictionary.sub(2, 2);\n console.log(myDictionary.get(2)); // logs 3 to console.\n}\n</code></div>\n\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:429,description:"<p>Multiply a value stored at a certain key\nThe product is stored in that location in the Dictionary.</p>\n",itemtype:"method",name:"mult",params:[{name:"Key",description:"<p>for value you wish to multiply</p>\n",type:"Number"},{name:"Amount",description:"<p>to multiply the value by</p>\n",type:"Number"}],example:["\n<div class='norender'>\n<code>\nfunction setup() {\n var myDictionary = createNumberDict(2, 4);\n myDictionary.mult(2, 2);\n console.log(myDictionary.get(2)); // logs 8 to console.\n}\n</code></div>\n\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:457,description:"<p>Divide a value stored at a certain key\nThe quotient is stored in that location in the Dictionary.</p>\n",itemtype:"method",name:"div",params:[{name:"Key",description:"<p>for value you wish to divide</p>\n",type:"Number"},{name:"Amount",description:"<p>to divide the value by</p>\n",type:"Number"}],example:["\n<div class='norender'>\n<code>\nfunction setup() {\n var myDictionary = createNumberDict(2, 8);\n myDictionary.div(2, 2);\n console.log(myDictionary.get(2)); // logs 4 to console.\n}\n</code></div>\n\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:485,description:"<p>private helper function for finding lowest or highest value\nthe argument &#39;flip&#39; is used to flip the comparison arrow\nfrom &#39;less than&#39; to &#39;greater than&#39;</p>\n",class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:508,description:"<p>Return the lowest value.</p>\n",itemtype:"method",name:"minValue",return:{description:"",type:"Number"},example:["\n<div class='norender'>\n<code>\nfunction setup() {\n var myDictionary = createNumberDict({2 : -10, 4 : 0.65, 1.2 : 3});\n var lowestValue = myDictionary.minValue(); // value is -10\n}\n</code></div>\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:528,description:"<p>Return the highest value.</p>\n",itemtype:"method",name:"maxValue",return:{description:"",type:"Number"},example:["\n<div class='norender'>\n<code>\nfunction setup() {\n var myDictionary = createNumberDict({2 : -10, 4 : 0.65, 1.2 : 3});\n var highestValue = myDictionary.maxValue(); // value is 3\n}\n</code></div>\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:548,description:"<p>private helper function for finding lowest or highest key\nthe argument &#39;flip&#39; is used to flip the comparison arrow\nfrom &#39;less than&#39; to &#39;greater than&#39;</p>\n",class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:571,description:"<p>Return the lowest key.</p>\n",itemtype:"method",name:"minKey",return:{description:"",type:"Number"},example:["\n<div class='norender'>\n<code>\nfunction setup() {\n var myDictionary = createNumberDict({2 : 4, 4 : 6, 1.2 : 3});\n var lowestKey = myDictionary.minKey(); // value is 1.2\n}\n</code></div>\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:591,description:"<p>Return the highest key.</p>\n",itemtype:"method",name:"maxKey",return:{description:"",type:"Number"},example:["\n<div class='norender'>\n<code>\nfunction setup() {\n var myDictionary = createNumberDict({ 2 : 4, 4 : 6, 1.2 : 3});\n var highestKey = myDictionary.maxKey(); // value is 4\n}\n</code></div>\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{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;.\neither LANDSCAPE or PORTRAIT.</p>\n",itemtype:"property",name:"deviceOrientation",type:"Constant",readonly:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:23,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",type:"Number",readonly:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:32,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",type:"Number",readonly:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:41,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",type:"Number",readonly:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:50,
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",type:"Number",readonly:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:60,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",type:"Number",readonly:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:70,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",type:"Number",readonly:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:80,description:"<p>_updatePAccelerations updates the pAcceleration values</p>\n",access:"private",tagname:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:91,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",type:"Number",readonly:"",alt:"red horizontal line right, green vertical line bottom. black background.",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:125,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",type:"Number",readonly:"",alt:"red horizontal line right, green vertical line bottom. black background.",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:158,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",type:"Number",readonly:"",alt:"red horizontal line right, green vertical line bottom. black background.",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:194,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>"],alt:"no image to display.",itemtype:"property",name:"pRotationX",type:"Number",readonly:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:237,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>"],alt:"no image to display.",itemtype:"property",name:"pRotationY",type:"Number",readonly:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:280,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>"],alt:"no image to display.",itemtype:"property",name:"pRotationZ",type:"Number",readonly:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:346,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:359,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:372,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 class="norender">\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>'],alt:"50x50 black rect in center of canvas. turns white on mobile when device moves",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:403,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 class=\"norender\">\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>"],alt:"50x50 black rect in center of canvas. turns white on mobile when device turns\n50x50 black rect in center of canvas. turns white on mobile when x-axis turns",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:462,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 class="norender">\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>'],alt:"50x50 black rect in center of canvas. turns white on mobile when device shakes",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",type:"Boolean",readonly:"",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>"],alt:"50x50 white rect that turns black on keypress.",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/keyboard.js",line:46,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",type:"String",readonly:"",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>"],alt:"canvas displays any key value that is pressed in pink font.",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/keyboard.js",line:75,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.\nYou can also check for custom keys by looking up the keyCode of any key\non a site like this: <a href="http://keycode.info/">keycode.info</a>.</p>\n',itemtype:"property",name:"keyCode",type:"Number",readonly:"",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>"],alt:"Grey rect center. turns white when up arrow pressed and black when down",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/keyboard.js",line:108,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>'],alt:"black rect center. turns white when key pressed and black when released\nblack rect center. turns white when left arrow pressed and black when right.",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/keyboard.js",line:198,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>"],alt:"black rect center. turns white when key pressed and black when pressed again",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/keyboard.js",line:254,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>"],alt:"black rect center. turns white when 'a' key typed and black when 'b' pressed",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/keyboard.js",line:307,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:317,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>"],alt:"50x50 red ellipse moves left, right, up and down with arrow presses.",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/keyboard.js",line:364,description:"<p>The checkDownKeys function returns a boolean true if any keys pressed\nand a false if no keys are currently pressed.</p>\n<p>Helps avoid instances where a multiple keys are pressed simultaneously and\nreleasing a single key will then switch the\nkeyIsPressed property to true.</p>\n",access:"private",tagname:"",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. If touch is\nused instead of mouse input, mouseX will hold the x value of the most\nrecent touch point.</p>\n",itemtype:"property",name:"mouseX",type:"Number",readonly:"",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>"],alt:"horizontal black line moves left and right with mouse x-position",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:49,description:"<p>The system variable mouseY always contains the current vertical position\nof the mouse, relative to (0, 0) of the canvas. If touch is\nused instead of mouse input, mouseY will hold the y value of the most\nrecent touch point.</p>\n",itemtype:"property",name:"mouseY",type:"Number",readonly:"",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>"],alt:"vertical black line moves up and down with mouse y-position",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:75,description:"<p>The system variable pmouseX always contains the horizontal position of\nthe mouse or finger in the frame previous to the current frame, relative to\n(0, 0) of the canvas.</p>\n",itemtype:"property",name:"pmouseX",type:"Number",readonly:"",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 print(pmouseX + " -> " + mouseX);\n}\n\n</code>\n</div>'],alt:"line trail is created from cursor movements. faster movement make longer line.",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:107,description:"<p>The system variable pmouseY always contains the vertical position of the\nmouse or finger in the frame previous to the current frame, relative to\n(0, 0) of the canvas.</p>\n",itemtype:"property",name:"pmouseY",type:"Number",readonly:"",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 print(pmouseY + " -> " + mouseY);\n}\n\n</code>\n</div>'],alt:"60x60 black rect center, fuschia background. rect flickers on mouse movement",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:137,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",type:"Number",readonly:"",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>"],alt:"60x60 black rect y moves with mouse y and fuschia canvas moves with mouse x",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:175,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",type:"Number",readonly:"",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>"],alt:"60x60 black rect x moves with mouse x and fuschia canvas y moves with mouse y",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:213,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",type:"Number",readonly:"",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>"],alt:"fuschia ellipse moves with mouse x and y. Grows and shrinks with mouse speed",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:255,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",type:"Number",readonly:"",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>"],alt:"fuschia ellipse moves with mouse x and y. Grows and shrinks with mouse speed",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:298,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",type:"Constant",readonly:"",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 print(mouseButton);\n}\n</code>\n</div>"],alt:"50x50 black ellipse appears on center of fuschia canvas on mouse click/press.",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:334,description:"<p>The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not.</p>\n",itemtype:"property",name:"mouseIsPressed",type:"Boolean",readonly:"",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 print(mouseIsPressed);\n}\n</code>\n</div>"],alt:"black 50x50 rect becomes ellipse with mouse click/press. fuschia background.",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:416,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>'],alt:"black 50x50 rect becomes lighter with mouse movements until white then resets\nno image displayed",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:460,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>'],alt:"black 50x50 rect turns lighter with mouse click and drag until white, resets\nno image displayed",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:531,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>'],alt:"black 50x50 rect turns white with mouse click/press.\nno image displayed",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:597,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>'],alt:"black 50x50 rect turns white with mouse click/press.\nno image displayed",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:664,
description:"<p>The mouseClicked() function is called once after a mouse button has been\npressed and then released.<br><br>\nBrowsers handle clicks differently, so this function is only guaranteed to be\nrun when the left mouse button is clicked. To handle other mouse buttons\nbeing pressed or released, see mousePressed() or mouseReleased().<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}\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>'],alt:"black 50x50 rect turns white with mouse click/press.\nno image displayed",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:723,description:'<p>The doubleClicked() function is executed every time a event\nlistener has detected a dblclick event which is a part of the\nDOM L3 specification. The doubleClicked event is fired when a\npointing device button (usually a mouse&#39;s primary button)\nis clicked twice on a single element. For more info on the\ndblclick event refer to mozilla&#39;s documentation here:\n<a href="https://developer.mozilla.org/en-US/docs/Web/Events/dblclick">https://developer.mozilla.org/en-US/docs/Web/Events/dblclick</a></p>\n',itemtype:"method",name:"doubleClicked",example:['\n<div>\n<code>\n// Click within the image to change\n// the value of the rectangle\n// after the mouse has been double clicked\n\nvar value = 0;\nfunction draw() {\n fill(value);\n rect(25, 25, 50, 50);\n}\n\nfunction doubleClicked() {\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 doubleClicked() {\n ellipse(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n</code>\n</div>'],alt:"black 50x50 rect turns white with mouse doubleClick/press.\nno image displayed",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:781,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 print(event.delta);\n //move the square according to the vertical scroll amount\n pos += event.delta;\n //uncomment to block page scrolling\n //return false;\n}\n</code>\n</div>"],alt:"black 50x50 rect moves up and down with vertical scroll. fuschia background",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/touch.js",line:12,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<p>The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops).</p>\n",itemtype:"property",name:"touches",type:"Object[]",readonly:"",class:"p5",module:"Events",submodule:"Touch"},{file:"src/events/touch.js",line:53,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(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n</code>\n</div>'],alt:"50x50 black rect turns white with touch event.\nno image displayed",class:"p5",module:"Events",submodule:"Touch"},{file:"src/events/touch.js",line:116,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(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n</code>\n</div>'],alt:"50x50 black rect turns lighter with touch until white. resets\nno image displayed",class:"p5",module:"Events",submodule:"Touch"},{file:"src/events/touch.js",line:178,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(mouseX, mouseY, 5, 5);\n // prevent default\n return false;\n}\n</code>\n</div>'],alt:"50x50 black rect turns white with touch.\nno image displayed",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:"canvas",description:"<p>[description]</p>\n",type:"HTMLCanvasElement"},{name:"func",description:"<p>[description]</p>\n",type:"Function(ImageData,Object)"},{name:"filterParam",description:"<p>[description]</p>\n",type:"Object"}],class:"p5",module:"Events"},{file:"src/image/filters.js",line:167,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:202,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:224,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:239,description:"<p>Sets each pixel to its inverse value. No parameter is used.</p>\n",params:[{name:"canvas",description:"",type:"Canvas"}],class:"p5",module:"Events"},{file:"src/image/filters.js",line:255,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:286,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:367,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>"],alt:"66x66 dark turquoise rect in center of canvas.\n2 gradated dark turquoise rects fade left. 1 center 1 bottom right of canvas\nno image displayed",class:"p5",module:"Image",submodule:"Image"},{file:"src/image/image.js",line:103,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",class:"p5",module:"Image",submodule:"Image",overloads:[{line:103,params:[{name:"selectedCanvas",description:"<p>a variable\n representing a specific html5 canvas (optional)</p>\n",type:"p5.Element|HTMLCanvasElement"},{name:"filename",description:"",type:"String",optional:!0},{name:"extension",description:"<p>&#39;jpg&#39; or &#39;png&#39;</p>\n",type:"String",optional:!0}]},{line:115,params:[{name:"filename",description:"",type:"String",optional:!0},{name:"extension",description:"",type:"String",optional:!0}]}]},{file:"src/image/image.js",line:233,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<p>Note that saveFrames() will only save the first 15 frames of an animation.\nTo export longer animations, you might look into a library like\n<a href="https://github.com/spite/ccapture.js/">ccapture.js</a>.</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(Array)",optional:!0}],example:['\n<div><code>\nfunction draw() {\n background(mouseX);\n}\n\nfunction mousePressed() {\n saveFrames("out", "png", 1, 25, function(data){\n print(data);\n });\n}\n</code></div>'],alt:"canvas background goes from light to dark with mouse x.",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 image 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:!0},{name:"failureCallback",description:"<p>called with event error if\n the image fails to load.</p>\n",type:"Function(Event)",optional:!0}],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>'],alt:"image of the underside of a white umbrella and grided ceililng above\nimage of the underside of a white umbrella and grided ceililng above",class:"p5",module:"Image",submodule:"Loading & Displaying"},{file:"src/image/loading_displaying.js",line:107,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:125,description:'<p>Draw an image to the p5.js canvas.</p>\n<p>This function can be used with different numbers of parameters. The\nsimplest use requires only three parameters: img, x, and y—where (x, y) is\nthe position of the image. Two more parameters can optionally be added to\nspecify the width and height of the image.</p>\n<p>This function can also be used with all eight Number parameters. To\ndifferentiate between all these parameters, p5.js uses the language of\n&quot;destination rectangle&quot; (which corresponds to &quot;dx&quot;, &quot;dy&quot;, etc.) and &quot;source\nimage&quot; (which corresponds to &quot;sx&quot;, &quot;sy&quot;, etc.) below. Specifying the\n&quot;source image&quot; dimensions can be useful when you want to display a\nsubsection of the source image instead of the whole thing. Here&#39;s a diagram\nto explain further:\n<img src="assets/drawImage.png"></img></p>\n',itemtype:"method",name:"image",example:['\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage("assets/laDefense.jpg");\n}\nfunction setup() {\n // Top-left corner of the img is at (0, 0)\n // Width and height are the img\'s original width and height\n image(img, 0, 0);\n}\n</code>\n</div>\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage("assets/laDefense.jpg");\n}\nfunction setup() {\n background(50);\n // Top-left corner of the img is at (10, 10)\n // Width and height are 50 x 50\n image(img, 10, 10, 50, 50);\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>\n<div>\n<code>\nvar img;\nfunction preload() {\n img = loadImage("assets/gradient.png");\n}\nfunction setup() {\n // 1. Background image\n // Top-left corner of the img is at (0, 0)\n // Width and height are the img\'s original width and height, 100 x 100\n image(img, 0, 0);\n // 2. Top right image\n // Top-left corner of destination rectangle is at (50, 0)\n // Destination rectangle width and height are 40 x 20\n // The next parameters are relative to the source image:\n // - Starting at position (50, 50) on the source image, capture a 50 x 50\n // subsection\n // - Draw this subsection to fill the dimensions of the destination rectangle\n image(img, 50, 0, 40, 20, 50, 50, 50, 50);\n}\n</code>\n</div>'],alt:"image of the underside of a white umbrella and gridded ceiling above\nimage of the underside of a white umbrella and gridded ceiling above",class:"p5",module:"Image",submodule:"Loading & Displaying",overloads:[{line:125,params:[{name:"img",description:"<p>the image to display</p>\n",type:"p5.Image|p5.Graphics"},{name:"x",description:"<p>the x-coordinate of the top-left corner of the image</p>\n",type:"Number"},{name:"y",description:"<p>the y-coordinate of the top-left corner of the image</p>\n",type:"Number"},{name:"width",description:"<p>the width to draw the image</p>\n",type:"Number",optional:!0},{name:"height",description:"<p>the height to draw the image</p>\n",type:"Number",optional:!0}]},{line:213,params:[{name:"img",description:"",type:"p5.Image|p5.Graphics"},{name:"dx",description:"<p>the x-coordinate of the destination\n rectangle in which to draw the source image</p>\n",type:"Number"},{name:"dy",description:"<p>the y-coordinate of the destination\n rectangle in which to draw the source image</p>\n",type:"Number"},{name:"dWidth",description:"<p>the width of the destination rectangle</p>\n",type:"Number"},{name:"dHeight",description:"<p>the height of the destination rectangle</p>\n",type:"Number"},{name:"sx",description:"<p>the x-coordinate of the subsection of the source\nimage to draw into the destination rectangle</p>\n",type:"Number"},{name:"sy",description:"<p>the y-coordinate of the subsection of the source\nimage to draw into the destination rectangle</p>\n",type:"Number"},{name:"sWidth",description:"<p>the width of the subsection of the\n source image to draw into the destination\n rectangle</p>\n",type:"Number",optional:!0},{name:"sHeight",description:"<p>the height of the subsection of the\n source image to draw into the destination rectangle</p>\n",type:"Number",optional:!0}]}]},{file:"src/image/loading_displaying.js",line:289,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",class:"p5",module:"Image",submodule:"Loading & Displaying",overloads:[{line:289,params:[{name:"v1",description:"<p>red or hue value relative to\n the current color range</p>\n",type:"Number"},{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:!0}]},{line:313,params:[{name:"value",description:"<p>a color string</p>\n",type:"String"},{name:"alpha",description:"",type:"Number",optional:!0}]},{line:319,params:[{name:"values",description:"<p>an array containing the red,green,blue &amp;\n and alpha components of the color</p>\n",type:"Number[]"}]},{line:325,params:[{name:"color",description:"<p>the tint color</p>\n",type:"p5.Color"},{name:"alpha",description:"",type:"Number",optional:!0}]}]},{file:"src/image/loading_displaying.js",line:384,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>'],alt:"2 side by side images of bricks, left image with blue tint",class:"p5",module:"Image",submodule:"Loading & Displaying"},{file:"src/image/loading_displaying.js",line:413,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:449,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>'],alt:"small square image of bricks\nhorizontal rectangle image of bricks\nlarge square image of bricks",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:45,description:"<p>Image width.</p>\n",itemtype:"property",name:"width",type:"Number",readonly:"",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>'],alt:"rocky mountains in top and horizontal lines in corresponding colors in bottom.",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:72,description:"<p>Image height.</p>\n",itemtype:"property",name:"height",type:"Number",readonly:"",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>'],alt:"rocky mountains on right and vertical lines in corresponding colors on left.",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:106,
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):</p>\n<pre><code class="lang-javascript">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 * ((y * d + j) * width * 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</code></pre>\n<p><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",type:"Number[]",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>"],alt:"66x66 turquoise rect in center of canvas\n66x66 pink rect in center of canvas",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:177,description:"<p>Helper fxn for sharing pixel methods</p>\n",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:186,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>'],alt:"2 images of rocky mountains vertically stacked",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:222,description:"<p>Updates the backing canvas for this image with the contents of\nthe [pixels] array.</p>\n",itemtype:"method",name:"updatePixels",class:"p5.Image",module:"Image",submodule:"Image",overloads:[{line:222,params:[{name:"x",description:"<p>x-offset of the target update area for the\n underlying canvas</p>\n",type:"Integer"},{name:"y",description:"<p>y-offset of the target update area for the\n underlying canvas</p>\n",type:"Integer"},{name:"w",description:"<p>height of the target update area for the\n underlying canvas</p>\n",type:"Integer"},{name:"h",description:"<p>height of the target update area for the\n underlying canvas</p>\n",type:"Integer"}]},{line:236,params:[]}]},{file:"src/image/p5.Image.js",line:270,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:!0},{name:"y",description:"<p>y-coordinate of the pixel</p>\n",type:"Number",optional:!0},{name:"w",description:"<p>width</p>\n",type:"Number",optional:!0},{name:"h",description:"<p>height</p>\n",type:"Number",optional:!0}],return:{description:"color of pixel at x,y in array format\n [R, G, B, A] or p5.Image",type:"Number[]|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>'],alt:"image of rocky mountains with 50x50 green rect in front",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:315,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>"],alt:"2 gradated dark turquoise rects fade left. 1 center 1 bottom right of canvas",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:353,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>'],alt:"image of rocky mountains. zoomed in",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:435,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|p5.Graphics|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>'],alt:"image of rocky mountains and smaller image on top of bricks at top left",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:480,description:"<p>Masks part of an image from displaying by loading another\nimage and using it&#39;s alpha 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>'],alt:"image of rocky mountains with white at right\n\n\nhttp://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:543,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, opaque\n erode, dilate and blur. See Filters.js for docs on\n each available 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>'],alt:"2 images of rocky mountains left one in color, right in black and white",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:577,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>'],alt:"image of rocky mountains. Brick images on left and right. Right overexposed\nimage of rockies. Brickwall images on left and right. Right mortar transparent\nimage of rockies. Brickwall images on left and right. Right translucent",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:658,description:"<p>helper method for web GL mode to indicate that an image has been\nchanged or unchanged since last upload. gl texture upload will\nset this value to false after uploading the texture.</p>\n",itemtype:"method",name:"setModified",params:[{name:"val",description:"<p>sets whether or not the image has been\nmodified.</p>\n",type:"Boolean"}],access:"private",tagname:"",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:671,description:"<p>helper method for web GL mode to figure out if the image\nhas been modified and might need to be re-uploaded to texture\nmemory between frames.</p>\n",itemtype:"method",name:"isModified",access:"private",tagname:"",return:{description:"a boolean indicating whether or not the\nimage has been updated or modified since last texture upload.",type:"Boolean"},class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:684,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>'],alt:"image of rocky mountains.",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 density 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):</p>\n<pre><code class=\"lang-javascript\">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 * ((y * d + j) * width * 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</code></pre>\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",type:"Number[]",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>"],alt:"top half of canvas pink, bottom grey",class:"p5",module:"Image",submodule:"Pixels"},{file:"src/image/pixels.js",line:83,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>'],alt:"image of rocky mountains. Brick images on left and right. Right overexposed\nimage of rockies. Brickwall images on left and right. Right mortar transparent\nimage of rockies. Brickwall images on left and right. Right translucent",class:"p5",module:"Image",submodule:"Pixels"},{file:"src/image/pixels.js",line:165,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>'],alt:"image of rocky mountains. Brick images on left and right. Right overexposed\nimage of rockies. Brickwall images on left and right. Right mortar transparent\nimage of rockies. Brickwall images on left and right. Right translucent",class:"p5",module:"Image",submodule:"Pixels"},{file:"src/image/pixels.js",line:212,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:"<p>either THRESHOLD, GRAY, OPAQUE, INVERT,\n POSTERIZE, BLUR, ERODE or DILATE</p>\n",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>'],alt:"black and white image of a brick wall.\ngreyscale image of a brickwall\nimage of a brickwall\njade colored image of a brickwall\nred and pink image of a brickwall\nimage of a brickwall\nblurry image of a brickwall\nimage of a brickwall\nimage of a brickwall with less detail",class:"p5",module:"Image",submodule:"Pixels"},{file:"src/image/pixels.js",line:390,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:!0},{name:"y",description:"<p>y-coordinate of the pixel</p>\n",type:"Number",optional:!0},{name:"w",description:"<p>width</p>\n",type:"Number",optional:!0},{name:"h",description:"<p>height</p>\n",type:"Number",optional:!0}],return:{description:"values of pixel at x,y in array format\n [R, G, B, A] or p5.Image",type:"Number[]|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>'],alt:"2 images of the rocky mountains, side-by-side\nImage of the rocky mountains with 50x50 green rect in center of canvas",class:"p5",module:"Image",submodule:"Pixels"},{file:"src/image/pixels.js",line:461,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[].\nNote that only changes made with set() or direct manipulation of pixels[]\nwill occur.</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>'],alt:"two images of the rocky mountains. one on top, one on bottom of canvas.",class:"p5",module:"Image",submodule:"Pixels"},{file:"src/image/pixels.js",line:498,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 appear.\nThis should be called once all pixels have been set, and must be called before\ncalling .get() or drawing the image.\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>'],alt:"4 black points in the shape of a square middle-right of canvas.\nsquare with orangey-brown gradient lightening at bottom right.\nimage of the rocky mountains. with lines like an 'x' through the center.",class:"p5",module:"Image",submodule:"Pixels"},{file:"src/image/pixels.js",line:572,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, and only changes made with\nset() or direct changes to pixels[] will occur.</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:!0},{name:"y",description:"<p>y-coordinate of the upper-left corner of region\n to update</p>\n",type:"Number",optional:!0},{name:"w",description:"<p>width of region to update</p>\n",type:"Number",optional:!0},{name:"h",description:"<p>height of region to update</p>\n",type:"Number",optional:!0}],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>'],alt:"two images of the rocky mountains. one on top, one on bottom of canvas.",class:"p5",module:"Image",submodule:"Pixels"},{file:"src/io/files.js",line:19,
description:'<p>Loads a JSON file from a file or a URL, and returns an Object.\nNote that even if the JSON file contains an Array, an Object will be\nreturned with index numbers as keys.</p>\n<p>This method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed. JSONP is supported via a polyfill and you\ncan pass in as the second argument an object with definitions of the json\ncallback following the syntax specified <a href="https://github.com/camsong/\nfetch-jsonp">here</a>.</p>\n',itemtype:"method",name:"loadJSON",params:[{name:"path",description:"<p>name of the file or url to load</p>\n",type:"String"},{name:"jsonpOptions",description:"<p>options object for jsonp related settings</p>\n",type:"Object",optional:!0},{name:"datatype",description:"<p>&quot;json&quot; or &quot;jsonp&quot;</p>\n",type:"String",optional:!0},{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:!0},{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:!0}],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>\n// Examples use USGS Earthquake API:\n// https://earthquake.usgs.gov/fdsnws/event/1/#methods\nvar earthquakes;\nfunction preload() {\n // Get the most recent earthquake in the database\n var url = 'https://earthquake.usgs.gov/fdsnws/event/1/query?' +\n 'format=geojson&limit=1&orderby=time';\n earthquakes = loadJSON(url);\n}\n\nfunction setup() {\n noLoop();\n}\n\nfunction draw() {\n background(200);\n // Get the magnitude and name of the earthquake out of the loaded JSON\n var earthquakeMag = earthquakes.features[0].properties.mag;\n var earthquakeName = earthquakes.features[0].properties.place;\n ellipse(width/2, height/2, earthquakeMag * 10, earthquakeMag * 10);\n textAlign(CENTER);\n text(earthquakeName, 0, height - 30, width, 30);\n}\n</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 = 'https://earthquake.usgs.gov/fdsnws/event/1/query?' +\n 'format=geojson&limit=1&orderby=time';\n loadJSON(url, drawEarthquake);\n}\n\nfunction draw() {\n background(200);\n}\n\nfunction drawEarthquake(earthquakes) {\n // Get the magnitude and name of the earthquake out of the loaded JSON\n var earthquakeMag = earthquakes.features[0].properties.mag;\n var earthquakeName = earthquakes.features[0].properties.place;\n ellipse(width/2, height/2, earthquakeMag * 10, earthquakeMag * 10);\n textAlign(CENTER);\n text(earthquakeName, 0, height - 30, width, 30);\n}\n</code></div>"],alt:"50x50 ellipse that changes from black to white depending on the current humidity\n50x50 ellipse that changes from black to white depending on the current humidity",class:"p5",module:"IO",submodule:"Input"},{file:"src/io/files.js",line:145,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:!0},{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:!0}],return:{description:"Array of Strings",type:"String[]"},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>"],alt:'randomly generated text from a file, for example "i smell like butter"\nrandomly generated text from a file, for example "i have three feet"',class:"p5",module:"IO",submodule:"Input"},{file:"src/io/files.js",line:237,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",optional:!0},{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.</p>\n",type:"Function",optional:!0},{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:!0}],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 print(table.getRowCount() + " total rows in table");\n print(table.getColumnCount() + " total columns in table");\n\n print(table.getColumn("name"));\n //["Goat", "Leopard", "Zebra"]\n\n //cycle through the table\n for (var r = 0; r < table.getRowCount(); r++)\n for (var c = 0; c < table.getColumnCount(); c++) {\n print(table.getString(r, c));\n }\n}\n</code>\n</div>'],alt:'randomly generated text from a file, for example "i smell like butter"\nrandomly generated text from a file, for example "i have three feet"',class:"p5",module:"IO",submodule:"Input"},{file:"src/io/files.js",line:558,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>\n",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:!0},{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:!0}],return:{description:"XML object containing data",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\n for (var i = 0; i < children.length; i++) {\n var id = children[i].getNum("id");\n var coloring = children[i].getString("species");\n var name = children[i].getContent();\n print(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>'],alt:"no image displayed",class:"p5",module:"IO",submodule:"Input"},{file:"src/io/files.js",line:654,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. This is equivalent to\ncalling <code>httpDo(path, &#39;GET&#39;)</code>.</p>\n",itemtype:"method",name:"httpGet",params:[{name:"path",description:"<p>name of the file or url to load</p>\n",type:"String"},{name:"datatype",description:"<p>&quot;json&quot;, &quot;jsonp&quot;, &quot;xml&quot;, or &quot;text&quot;</p>\n",type:"String",optional:!0},{name:"data",description:"<p>param data passed sent with request</p>\n",type:"Object",optional:!0},{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:!0},{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:!0}],example:["\n<div class='norender'><code>\n // Examples use USGS Earthquake API:\n // https://earthquake.usgs.gov/fdsnws/event/1/#methods\n var earthquakes;\n function preload() {\n // Get the most recent earthquake in the database\n var url = 'https://earthquake.usgs.gov/fdsnws/event/1/query?' +\n 'format=geojson&limit=1&orderby=time';\n httpGet(url, \"jsonp\", false, function(response) {\n // when the HTTP request completes, populate the variable that holds the\n // earthquake data used in the visualization.\n earthquakes = response;\n });\n }\n\n function draw() {\n if (!earthquakes) {\n // Wait until the earthquake data has loaded before drawing.\n return\n }\n background(200);\n // Get the magnitude and name of the earthquake out of the loaded JSON\n var earthquakeMag = earthquakes.features[0].properties.mag;\n var earthquakeName = earthquakes.features[0].properties.place;\n ellipse(width/2, height/2, earthquakeMag * 10, earthquakeMag * 10);\n textAlign(CENTER);\n text(earthquakeName, 0, height - 30, width, 30);\n noLoop();\n }\n</code></div>"],class:"p5",module:"IO",submodule:"Input"},{file:"src/io/files.js",line:707,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. This is equivalent to\ncalling <code>httpDo(path, &#39;POST&#39;)</code>.</p>\n",itemtype:"method",name:"httpPost",params:[{name:"path",description:"<p>name of the file or url to load</p>\n",type:"String"},{name:"datatype",description:"<p>&quot;json&quot;, &quot;jsonp&quot;, &quot;xml&quot;, or &quot;text&quot;.\n If omitted, httpPost() will guess.</p>\n",type:"String",optional:!0},{name:"data",description:"<p>param data passed sent with request</p>\n",type:"Object",optional:!0},{name:"callback",description:"<p>function to be executed after\n httpPost() completes, data is passed in\n as first argument</p>\n",type:"Function",optional:!0},{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:!0}],example:["\n<div>\n<code>\n// Examples use jsonplaceholder.typicode.com for a Mock Data API\n\nvar url = 'https://jsonplaceholder.typicode.com/posts';\nvar postData = { userId: 1, title: 'p5 Clicked!', body: 'p5.js is way cool.' };\n\nfunction setup() {\n createCanvas(800, 800);\n}\n\nfunction mousePressed() {\n // Pick new random color values\n var r = random(255);\n var g = random(255);\n var b = random(255);\n\n httpPost(url, 'json',\n postData,\n function (result) {\n strokeWeight(2);\n stroke(r, g, b);\n fill(r, g, b, 127);\n ellipse(mouseX, mouseY, 200, 200);\n text(result.body, mouseX, mouseY);\n });\n}\n</code>\n</div>\n\n\n<div><code>\n\n var url = 'https://invalidURL'; // A bad URL that will cause errors\n var postData = { title: 'p5 Clicked!', body: 'p5.js is way cool.' };\n\n function setup() {\n createCanvas(800, 800);\n }\n\n function mousePressed() {\n // Pick new random color values\n var r = random(255);\n var g = random(255);\n var b = random(255);\n\n httpPost(url, 'json',\n postData,\n function (result) {\n // ... won't be called\n },\n function (error) {\n strokeWeight(2);\n stroke(r, g, b);\n fill(r, g, b, 127);\n text(error.toString(), mouseX, mouseY);\n });\n }\n\n</code>\n</div>\n"],class:"p5",module:"IO",submodule:"Input"},{file:"src/io/files.js",line:794,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>\nFor more advanced use, you may also pass in the path as the first argument\nand a object as the second argument, the signature follows the one specified\nin the Fetch API specification.</p>\n",itemtype:"method",name:"httpDo",example:["\n<div>\n<code>\n// Examples use USGS Earthquake API:\n// https://earthquake.usgs.gov/fdsnws/event/1/#methods\n\n// displays an animation of all USGS earthquakes\nvar earthquakes;\nvar eqFeatureIndex = 0;\n\nfunction preload() {\n var url = 'https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson';\n httpDo(url,\n {\n method: 'GET',\n // Other Request options, like special headers for apis\n headers: { authorization: 'Bearer secretKey' }\n },\n function(res) {\n earthquakes = res;\n });\n}\n\nfunction draw() {\n // wait until the data is loaded\n if (!earthquakes || !earthquakes.features[eqFeatureIndex]) {\n return;\n }\n clear();\n\n var feature = earthquakes.features[eqFeatureIndex];\n var mag = feature.properties.mag;\n var rad = mag / 11 * ((width + height) / 2);\n fill(255, 0, 0, 100);\n ellipse(\n width / 2 + random(-2, 2),\n height / 2 + random(-2, 2),\n rad, rad\n );\n\n if (eqFeatureIndex >= earthquakes.features.length) {\n eqFeatureIndex = 0;\n } else {\n eqFeatureIndex += 1;\n }\n}\n</code>\n</div>"],class:"p5",module:"IO",submodule:"Input",overloads:[{line:794,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:!0},{name:"datatype",description:"<p>&quot;json&quot;, &quot;jsonp&quot;, &quot;xml&quot;, or &quot;text&quot;</p>\n",type:"String",optional:!0},{name:"data",description:"<p>param data passed sent with request</p>\n",type:"Object",optional:!0},{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:!0},{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:!0}]},{line:865,params:[{name:"path",description:"",type:"String"},{name:"options",description:'<p>Request object options as documented in the\n &quot;fetch&quot; API\n<a href="https://developer.mozilla.org/en/docs/Web/API/Fetch_API">reference</a></p>\n',type:"Object"},{name:"callback",description:"",type:"Function",optional:!0},{name:"errorCallback",description:"",type:"Function",optional:!0}]}]},{file:"src/io/files.js",line:1077,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",optional:!0},{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",optional:!0},{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",optional:!0}],class:"p5",module:"IO",submodule:"Output"},{file:"src/io/files.js",line:1194,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:!0}],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>'],alt:"no image displayed",class:"p5",module:"IO",submodule:"Output"},{file:"src/io/files.js",line:1248,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>"],alt:"no image displayed",class:"p5",module:"IO",submodule:"Output"},{file:"src/io/files.js",line:1306,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:!0}],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>"],alt:"no image displayed",class:"p5",module:"IO",submodule:"Output"},{file:"src/io/files.js",line:1433,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:1456,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:1496,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:"String[]"},access:"private",tagname:"",class:"p5",module:"IO",submodule:"Output"},{file:"src/io/files.js",line:1528,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:1540,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:46,itemtype:"property",name:"columns",type:"String[]",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:51,itemtype:"property",name:"rows",type:"p5.TableRow[]",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:58,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:!0}],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 print(table.getString(r, c));\n }\n </code>\n </div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:121,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 print(table.getString(r, c));\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:170,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:"p5.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 print(row.getString(c));\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:215,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:"p5.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 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 print(table.getString(r, c));\n }\n </code>\n </div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:263,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:"p5.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 print(row.getString("species"));\n }\n </code>\n </div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:329,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:"p5.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 //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 print(rows.length + " Goats found");\n }\n </code>\n </div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:399,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:"p5.TableRow"},class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:431,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:!0}],return:{description:"An Array of TableRow objects",type:"p5.TableRow[]"},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 print(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:498,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 print(table.getColumn("species"));\n //outputs ["Capra hircus", "Panthera pardus", "Equus zebra"]\n }\n </code>\n </div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:551,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 print(table.getRowCount() + " total rows in table");\n print(table.getColumnCount() + " total columns in table");\n }\n </code>\n </div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:593,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:!0}],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 print(table.getString(r, c));\n }\n </code>\n </div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:644,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:653,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:664,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:!0}],class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:715,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:757,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 print(table.getColumnCount());\n }\n </code>\n </div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:826,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 print(table.getString(r, c));\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:875,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 print(table.getColumn(0));\n //["0", 1, "2"]\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:922,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:937,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 print(table.get(0, 1));\n //Capra hircus\n print(table.get(0, "species"));\n //Capra hircus\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:984,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 print(table.getNum(1, 0) + 100);\n //id 1 + 100 = 101\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:1029,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 print(tableArray[i]);\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:1077,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 print(tableObject);\n //outputs an object\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:1141,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:43,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:79,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:95,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:110,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:127,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:151,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:66,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:"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 var parent = children[1].getParent();\n print(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:104,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 print(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:139,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 print(xml.getName());\n xml.setName("fish");\n print(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:177,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 print(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:213,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:"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 print(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:250,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:!0}],return:{description:"children of the element",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 animals = xml.getChildren("animal");\n\n for (var i = 0; i < animals.length; i++) {\n print(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:299,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 print(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 print(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:360,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:"p5.XML"}],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:377,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 print(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 print(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:450,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 print(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:486,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:"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 print(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:523,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 print(firstChild.hasAttribute("species"));\n print(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:562,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:"getNum",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:!0}],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 print(firstChild.getNum("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:603,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:!0}],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 print(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:644,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 print(firstChild.getString("species"));\n firstChild.setAttribute("species", "Jamides zebra");\n print(firstChild.getString("species"));\n}\n\n// Sketch prints:\n// "Capra hircus"\n// "Jamides zebra"\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:687,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:!0}],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 print(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:725,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 print(firstChild.getContent());\n firstChild.setContent("Mountain Goat");\n print(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:767,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:784,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 print(x); // -3\n print(y); // 3\n}\n</code></div>'],alt:"no image displayed",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:36,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>"],alt:"2 horizontal lines & number sets. increase with mouse x. bottom to 2 decimals",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:76,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>"],alt:"2 vertical lines. 2 ellipses move with mouse X 1 does not move passed lines",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:120,description:"<p>Calculates the distance between two points.</p>\n",itemtype:"method",name:"dist",return:{description:"distance between the two points",type:"Number"},class:"p5",module:"Math",submodule:"Calculation",overloads:[{line:120,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"}],return:{description:"distance between the two points",type:"Number"}},{line:130,params:[{name:"x1",description:"",type:"Number"},{name:"y1",description:"",type:"Number"},{name:"z1",description:"<p>z-coordinate of the first point</p>\n",type:"Number"},{name:"x2",description:"",type:"Number"},{name:"y2",description:"",type:"Number"},{name:"z2",description:"<p>z-coordinate of the second point</p>\n",type:"Number"}],return:{description:"distance between the two points",type:"Number"}}]},{file:"src/math/calculation.js",line:184,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>'],alt:"ellipse moves along a curve with mouse x. e^n displayed.",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:234,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>"],alt:"2 horizontal lines & number sets. increase with mouse x. bottom to 2 decimals",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:273,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>"],alt:"5 points horizontally staggered mid-canvas. mid 3 are grey, outer black",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:317,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>'],alt:"ellipse moves along a curve with mouse x. natural logarithm of n displayed.",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:371,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 print(mag(x1, y1)); // Prints "36.05551275463989"\n line(0, 0, x2, y1);\n print(mag(x2, y1)); // Prints "85.44003745317531"\n line(0, 0, x1, y2);\n print(mag(x1, y2)); // Prints "72.80109889280519"\n line(0, 0, x2, y2);\n print(mag(x2, y2)); // Prints "106.3014581273465"\n}\n</code></div>'],alt:"4 lines of different length radiate from top left of canvas.",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:409,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"},{name:"withinBounds",description:"<p>constrain the value to the newly mapped range</p>\n",type:"Boolean",optional:!0}],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 //This ellipse is constrained to the 0-100 range\n //after setting withinBounds to true\n var x2 = map(mouseX, 0, width, 0, 100, true);\n ellipse(x2, 75, 25, 25);\n }\n </code></div>"],alt:"10 by 10 white ellipse with in mid left canvas\n2 25 by 25 white ellipses move with mouse x. Bottom has more range from X",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:464,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>'],alt:"Small text at top reads: Array Elements 2 1 5 4 8 9. Large text at center: 9",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:507,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>'],alt:"Small text at top reads: Array Elements 2 1 5 4 8 9. Large text at center: 1",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:550,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>'],alt:"ellipse moves with mouse. 0 shown left & 100 right and updating values center",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:602,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>"],alt:"small to large ellipses radiating from top left of canvas",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:636,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>"],alt:"horizontal center line squared values displayed on top and regular on bottom.",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:675,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>'],alt:"horizontal center line squared values displayed on top and regular on bottom.",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:720,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>'],alt:"horizontal center line squareroot values displayed on top and regular on bottom.",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:!0},{name:"y",description:"<p>y component of the vector</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>z component of the vector</p>\n",type:"Number",optional:!0}],return:{description:"",type:"p5.Vector"},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",optional:!0},{name:"z",description:"<p>z-coordinate in noise space</p>\n",type:"Number",optional:!0}],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>"],alt:"vertical line moves left to right with updating noise values.\nhorizontal wave pattern effected by mouse x-position & updating noise values.",class:"p5",module:"Math",submodule:"Noise"},{file:"src/math/noise.js",line:171,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>"],alt:"2 vertical grey smokey patterns affected my mouse x-position and noise.",class:"p5",module:"Math",submodule:"Noise"},{file:"src/math/noise.js",line:233,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>"],alt:"vertical grey lines drawing in pattern affected by noise.",class:"p5",module:"Math",submodule:"Noise"},{file:"src/math/p5.Vector.js",line:69,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:74,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:79,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:87,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 print(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:105,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:!0},{name:"y",description:"<p>the y component of the vector</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>the z component of the vector</p>\n",type:"Number",optional:!0}],chainable:1,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:147,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();\nprint(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:170,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,example:['\n<div class="norender">\n<code>\nvar v = createVector(1, 2, 3);\nv.add(4,5,6);\n// v\'s components 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",overloads:[{line:170,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:!0},{name:"z",description:"<p>the z component of the vector to be\n added</p>\n",type:"Number",optional:!0}],chainable:1},{line:907,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>the vector to receive the result</p>\n",type:"p5.Vector"}],static:1},{line:914,params:[{name:"v1",description:"",type:"p5.Vector"},{name:"v2",description:"",type:"p5.Vector"}],static:1,return:{description:"the resulting p5.Vector",type:"p5.Vector"}}]},{file:"src/math/p5.Vector.js",line:222,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,example:['\n<div class="norender">\n<code>\nvar v = createVector(4, 5, 6);\nv.sub(1, 1, 1);\n// v\'s components 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 components [1, 1, 1]\n</code>\n</div>'],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:222,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:!0},{name:"z",description:"<p>the z component of the vector</p>\n",type:"Number",optional:!0}],chainable:1},{line:937,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"}],static:1},{line:944,params:[{name:"v1",description:"",type:"p5.Vector"},{name:"v2",description:"",type:"p5.Vector"}],static:1,return:{description:"the resulting p5.Vector",type:"p5.Vector"}}]},{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,example:['\n<div class="norender">\n<code>\nvar v = createVector(1, 2, 3);\nv.mult(2);\n// v\'s components 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 components [2, 4, 6]\n</code>\n</div>'],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:273,params:[{name:"n",description:"<p>the number to multiply with the vector</p>\n",type:"Number"}],chainable:1},{line:966,params:[{name:"v",description:"<p>the vector to multiply</p>\n",type:"p5.Vector"},{name:"n",description:"",type:"Number"},{name:"target",description:"<p>if undefined a new vector will be created</p>\n",type:"p5.Vector"}],static:1},{line:973,params:[{name:"v",description:"",type:"p5.Vector"},{name:"n",description:"",type:"Number"}],static:1,return:{description:"the resulting new p5.Vector",type:"p5.Vector"}}]},{file:"src/math/p5.Vector.js",line:306,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,example:['\n<div class="norender">\n<code>\nvar v = createVector(6, 4, 2);\nv.div(2); //v\'s components 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 components [3, 2, 1]\n</code>\n</div>'],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:306,params:[{name:"n",description:"<p>the number to divide the vector by</p>\n",type:"Number"}],chainable:1},{line:993,params:[{name:"v",description:"<p>the vector to divide</p>\n",type:"p5.Vector"},{name:"n",description:"",type:"Number"},{name:"target",description:"<p>if undefined a new vector will be created</p>\n",type:"p5.Vector"}],static:1},{line:1e3,params:[{name:"v",description:"",type:"p5.Vector"},{name:"n",description:"",type:"Number"}],static:1,return:{description:"the resulting new p5.Vector",type:"p5.Vector"}}]},{file:"src/math/p5.Vector.js",line:338,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();\nprint(m); // Prints "53.85164807134504"\n</code>\n</div>'],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:338,params:[],return:{description:"magnitude of the vector",type:"Number"}},{line:1091,params:[{name:"vecT",description:"<p>the vector to return the magnitude of</p>\n",type:"p5.Vector"}],static:1,return:{description:"the magnitude of vecT",type:"Number"}}]},{file:"src/math/p5.Vector.js",line:357,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);\nprint(v1.magSq()); // Prints "56"\n</code>\n</div>'],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:379,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",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\nprint(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",overloads:[{line:379,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:!0},{name:"z",description:"<p>z component of the vector</p>\n",type:"Number",optional:!0}],return:{description:"the dot product",type:"Number"}},{line:1021,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"}],static:1,return:{description:"the dot product",type:"Number"}}]},{file:"src/math/p5.Vector.js",line:419,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",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",overloads:[{line:419,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"}},{line:1035,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"}],static:1,return:{description:"the cross product",type:"Number"}}]},{file:"src/math/p5.Vector.js",line:459,description:"<p>Calculates the Euclidean distance between two points (considering a\npoint as a vector object).</p>\n",itemtype:"method",name:"dist",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",overloads:[{line:459,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"}},{line:1050,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"}],static:1,return:{description:"the distance",type:"Number"}}]},{file:"src/math/p5.Vector.js",line:491,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 components [10.0, 20.0, 2.0]\nv.normalize();\n// v\'s components 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:512,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"}],chainable:1,example:['\n<div class="norender">\n<code>\nvar v = createVector(10, 20, 2);\n// v has components [10.0, 20.0, 2.0]\nv.limit(5);\n// v\'s components 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:539,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"}],chainable:1,example:['\n<div class="norender">\n<code>\nvar v = createVector(10, 20, 2);\n// v has components [10.0, 20.0, 2.0]\nv.setMag(10);\n// v\'s components 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:560,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 print(v1.heading()); // 1.0303768265243125\n\n var v1 = createVector(40,50);\n print(v1.heading()); // 0.8960553845713439\n\n var v1 = createVector(30,70);\n print(v1.heading()); // 1.1659045405098132\n}\n</div></code>'],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:592,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"}],chainable:1,example:['\n<div class="norender">\n<code>\nvar v = createVector(10.0, 20.0);\n// v has components [10.0, 20.0, 0.0]\nv.rotate(HALF_PI);\n// v\'s components 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:622,description:"<p>Calculates and returns the angle (in radians) between two vectors.</p>\n",itemtype:"method",name:"angleBetween",params:[{name:"the",description:"<p>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 = v1.angleBetween(v2);\n// angle is PI/2\n</code>\n</div>'],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:654,description:"<p>Linear interpolate the vector to another vector</p>\n",itemtype:"method",name:"lerp",chainable:1,class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:654,params:[{name:"x",description:"<p>the x component</p>\n",type:"p5.Vector"},{name:"y",description:"<p>the y component</p>\n",type:"p5.Vector"},{name:"z",description:"<p>the z component</p>\n",type:"p5.Vector"},{name:"amt",description:"<p>the amount of interpolation; some value between 0.0\n (old vector) and 1.0 (new vector). 0.9 is very near\n the new vector. 0.5 is halfway in between.</p>\n",type:"Number"}],chainable:1},{line:666,params:[{name:"v",description:"<p>the p5.Vector to lerp to</p>\n",type:"p5.Vector"},{name:"amt",description:"",type:"Number"}],chainable:1},{line:1065,params:[{name:"v1",description:"",type:"p5.Vector"},{name:"v2",description:"",type:"p5.Vector"},{name:"amt",description:"",type:"Number"},{name:"target",description:"<p>if undefined a new vector will be created</p>\n",type:"p5.Vector"}],static:1},{line:1073,params:[{name:"v1",description:"",type:"p5.Vector"},{name:"v2",description:"",type:"p5.Vector"},{name:"amt",description:"",type:"Number"}],static:1,return:{description:"the lerped value",type:"Number"}}]},{file:"src/math/p5.Vector.js",line:701,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:"Number[]"},example:['\n<div class = "norender"><code>\nfunction setup() {\n var v = createVector(20,30);\n print(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();\nprint(f[0]); // Prints "10.0"\nprint(f[1]); // Prints "20.0"\nprint(f[2]); // Prints "30.0"\n</code>\n</div>'],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:730,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:!0},{name:"y",description:"<p>the y component of the vector</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>the z component of the vector</p>\n",type:"Number",optional:!0}],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\nprint(v1.equals(v2.x,v2.y,v2.z)); // true\nprint(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:780,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:837,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:870,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:963,description:"<p>Multiplies a vector by a scalar and returns a new vector.</p>\n",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:990,description:"<p>Divides a vector by a scalar and returns a new vector.</p>\n",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1018,description:"<p>Calculates the dot product of two vectors.</p>\n",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1032,description:"<p>Calculates the cross product of two vectors.</p>\n",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1046,description:"<p>Calculates the Euclidean distance between two points (considering a\npoint as a vector object).</p>\n",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1061,description:"<p>Linear interpolate a vector to another vector and return the result as a\nnew vector.</p>\n",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/random.js",line:47,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>"],alt:"many vertical lines drawn in white, black or grey.",class:"p5",module:"Math",submodule:"Random"},{file:"src/math/random.js",line:78,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",type:"Number"},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>'],alt:"100 horizontal lines from center canvas to right. size+fill change each time\n100 horizontal lines from center of canvas. height & side change each render\nword displayed at random. Either apple, bear, cat, or dog",class:"p5",module:"Math",submodule:"Random",overloads:[{line:78,params:[{name:"min",description:"<p>the lower bound (inclusive)</p>\n",type:"Number",optional:!0},{name:"max",description:"<p>the upper bound (exclusive)</p>\n",type:"Number",optional:!0}],return:{description:"the random number",type:"Number"}},{line:132,params:[{name:"choices",description:"<p>the array to choose from</p>\n",type:"Array"}],return:{description:"the random element from the array",type:"*"}}]},{file:"src/math/random.js",line:168,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>"],alt:"100 horizontal lines from center of canvas. height & side change each render\n black lines radiate from center of canvas. size determined each render",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"\nprint(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"\nprint(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"\nprint(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"\nprint(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"\nprint(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"\nprint(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>"],alt:"60 by 10 rect at center of canvas rotates with mouse movements",class:"p5",module:"Math",submodule:"Trigonometry"},{file:"src/math/trigonometry.js",line:174,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>"],alt:"vertical black lines form wave patterns, extend-down on left and right side",class:"p5",module:"Math",submodule:"Trigonometry"},{file:"src/math/trigonometry.js",line:206,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>"],alt:"vertical black lines extend down and up from center to form wave pattern",class:"p5",module:"Math",submodule:"Trigonometry"},{file:"src/math/trigonometry.js",line:238,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>"],alt:"vertical black lines end down and up from center to form spike pattern",class:"p5",module:"Math",submodule:"Trigonometry"},{file:"src/math/trigonometry.js",line:270,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);\nprint(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:296,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);\nprint(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:320,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>"],alt:"40 by 10 rect in center rotates with mouse moves. 20 by 10 rect moves faster.",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",optional:!0}],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>'],alt:"Letters ABCD displayed at top right, EFGH at center and IJKL at bottom left.",class:"p5",module:"Typography",submodule:"Attributes"},{file:"src/typography/attributes.js",line:55,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",chainable:1,class:"p5",module:"Typography",submodule:"Attributes",overloads:[{line:55,params:[{name:"leading",description:"<p>the size in pixels for spacing between lines</p>\n",type:"Number"}],chainable:1},{line:63,params:[],return:{description:"",type:"Number"}}]},{file:"src/typography/attributes.js",line:92,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",chainable:1,class:"p5",module:"Typography",submodule:"Attributes",overloads:[{line:92,params:[{name:"theSize",description:"<p>the size of the letters in units of pixels</p>\n",type:"Number"}],chainable:1},{line:100,params:[],return:{description:"",type:"Number"}}]},{file:"src/typography/attributes.js",line:123,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",chainable:1,class:"p5",module:"Typography",submodule:"Attributes",overloads:[{line:123,params:[{name:"theStyle",description:"<p>styling for text, either NORMAL,\n ITALIC, or BOLD</p>\n",type:"Constant"}],chainable:1},{line:133,params:[],return:{description:"",type:"String"}}]},{file:"src/typography/attributes.js",line:158,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>"],alt:"Letter P and p5.js are displayed with vertical lines at end. P is wide",class:"p5",module:"Typography",submodule:"Attributes"},{file:"src/typography/attributes.js",line:192,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",itemtype:"method",name:"textAscent",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:220,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",itemtype:"method",name:"textDescent",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:248,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>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:!0}],return:{description:"p5.Font object",type:"p5.Font"},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>"],alt:"p5*js in p5's theme dark pink\np5*js in p5's theme dark pink",class:"p5",module:"Typography",submodule:"Loading & Displaying"},{file:"src/typography/loading_displaying.js",line:135,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",optional:!0},{name:"y2",description:"<p>by default, the height of the text box,\n see rectMode() for more info</p>\n",type:"Number",optional:!0}],return:{description:"this",type:"P5"},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>'],alt:"'word' displayed 3 times going from black, blue to translucent blue\nThe quick brown fox jumped over the lazy dog.",class:"p5",module:"Typography",submodule:"Loading & Displaying"},{file:"src/typography/loading_displaying.js",line:191,description:"<p>Sets the current font that will be drawn with the text() function.</p>\n",itemtype:"method",name:"textFont",return:{description:"the current font",type:"Object"},class:"p5",module:"Typography",submodule:"Loading & Displaying",overloads:[{line:191,params:[],return:{description:"the current font",type:"Object"}},{line:197,params:[{name:"font",description:'<p>a font loaded via loadFont(), or a String\nrepresenting a <a href="https://mzl.la/2dOw8WD">web safe font</a> (a font\nthat is generally available across all systems)</p>\n',type:"Object|String"},{name:"size",description:"<p>the font size to use</p>\n",type:"Number",optional:!0}],chainable:1}]},{file:"src/typography/p5.Font.js",line:33,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:47,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>"],alt:"words Lorem ipsum dol go off canvas and contained by white bounding box",class:"p5.Font",module:"Typography",submodule:"Font"},{file:"src/typography/p5.Font.js",line:148,description:"<p>Computes an array of points following the path for specified text</p>\n",itemtype:"method",name:"textToPoints",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:206,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:221,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")\nprint(myArray) // ["Mango", "Apple", "Papaya"]\n\nappend(myArray, "Peach")\nprint(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",class:"p5",module:"Data",submodule:"Array Functions",overloads:[{line:37,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"},{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"},{name:"length",description:"<p>number of Array elements to be copied</p>\n",type:"Number"}]},{line:59,params:[{name:"src",description:"",type:"Array"},{name:"dst",description:"",type:"Array"},{name:"length",description:"",type:"Number",optional:!0}]}]},{file:"src/utilities/array_functions.js",line:124,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 print(arr1); // ["A","B","C"]\n print(arr2); // [1,2,3]\n\n var arr3 = concat(arr1, arr2);\n\n print(arr1); // ["A","B","C"]\n print(arr2); // [1,2,3]\n print(arr3); // ["A","B","C",1,2,3]\n\n}\n</div></code>'],class:"p5",module:"Data",submodule:"Array Functions"},{file:"src/utilities/array_functions.js",line:155,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 print(myArray); // ["A","B","C"]\n\n reverse(myArray);\n print(myArray); // ["C","B","A"]\n}\n</div></code>'],class:"p5",module:"Data",submodule:"Array Functions"},{file:"src/utilities/array_functions.js",line:175,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 print(myArray); // ["A","B","C"]\n\n var newArray = shorten(myArray);\n print(myArray); // ["A","B","C"]\n print(newArray); // ["A","B"]\n}\n</div></code>'],class:"p5",module:"Data",submodule:"Array Functions"},{file:"src/utilities/array_functions.js",line:199,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:!0}],return:{description:"shuffled Array",type:"Array"},example:["\n<div><code>\nfunction setup() {\n var regularArr = ['ABC', 'def', createVector(), TAU, Math.E];\n print(regularArr);\n shuffle(regularArr, true); // force modifications to passed array\n print(regularArr);\n\n // By default shuffle() returns a shuffled cloned array:\n var newArr = shuffle(regularArr);\n print(regularArr);\n print(newArr);\n}\n</code></div>"],class:"p5",module:"Data",submodule:"Array Functions"},{file:"src/utilities/array_functions.js",line:239,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:!0}],example:['\n<div class = "norender"><code>\nfunction setup() {\n var words = new Array("banana", "apple", "pear","lime");\n print(words); // ["banana", "apple", "pear", "lime"]\n var count = 4; // length of array\n\n words = sort(words, count);\n print(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 print(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 print(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:283,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 print(myArray); // [0,1,2,3,4]\n print(insArray); // ["A","B","C"]\n\n splice(myArray, insArray, 3);\n print(myArray); // [0,1,2,"A","B","C",3,4]\n}\n</div></code>'],class:"p5",module:"Data",submodule:"Array Functions"},{file:"src/utilities/array_functions.js",line:317,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:!0}],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 print(myArray); // [1,2,3,4,5]\n\n var sub1 = subset(myArray, 0, 3);\n var sub2 = subset(myArray, 2, 2);\n print(sub1); // [1,2,3]\n print(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<p>When an array of values is passed in, then an array of floats of the same\nlength is returned.</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>"],alt:"20 by 20 white ellipse in the center of the canvas",class:"p5",module:"Data",submodule:"Conversion"},{file:"src/utilities/conversion.js",line:42,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",return:{description:"integer representation of value",type:"Number"},class:"p5",module:"Data",submodule:"Conversion",overloads:[{line:42,params:[{name:"n",description:"<p>value to parse</p>\n",type:"String|Boolean|Number"}],return:{description:"integer representation of value",type:"Number"}},{line:51,params:[{name:"ns",description:"<p>values to parse</p>\n",type:"Array"}],return:{description:"integer representation of values",type:"Number[]"}}]},{file:"src/utilities/conversion.js",line:79,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>\nprint(str("10")); // "10"\nprint(str(10.31)); // "10.31"\nprint(str(-10)); // "-10"\nprint(str(true)); // "true"\nprint(str(false)); // "false"\nprint(str([true, "10.3", 9.8])); // [ "true", "10.3", "9.8" ]\n</code></div>'],class:"p5",module:"Data",submodule:"Conversion"},{file:"src/utilities/conversion.js",line:105,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>\nprint(boolean(0)); // false\nprint(boolean(1)); // true\nprint(boolean("true")); // true\nprint(boolean("abcd")); // false\nprint(boolean([0, 12, "true"])); // [false, true, false]\n</code></div>'],class:"p5",module:"Data",submodule:"Conversion"},{file:"src/utilities/conversion.js",line:137,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",return:{description:"byte representation of value",type:"Number"},class:"p5",module:"Data",submodule:"Conversion",overloads:[{line:137,params:[{name:"n",description:"<p>value to parse</p>\n",type:"String|Boolean|Number"}],return:{description:"byte representation of value",type:"Number"}},{line:148,params:[{name:"ns",description:"<p>values to parse</p>\n",type:"Array"}],return:{description:"array of byte representation of values",type:"Number[]"}}]},{file:"src/utilities/conversion.js",line:171,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",return:{description:"string representation of value",type:"String"},class:"p5",module:"Data",submodule:"Conversion",overloads:[{line:171,params:[{name:"n",description:"<p>value to parse</p>\n",type:"String|Number"}],return:{description:"string representation of value",type:"String"}},{line:182,params:[{name:"ns",description:"<p>values to parse</p>\n",type:"Array"}],return:{description:"array of string representation of values",type:"String[]"}}]},{file:"src/utilities/conversion.js",line:204,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",return:{description:"integer representation of value",type:"Number"},class:"p5",module:"Data",submodule:"Conversion",overloads:[{line:204,params:[{name:"n",description:"<p>value to parse</p>\n",type:"String"}],return:{description:"integer representation of value",type:"Number"}},{line:213,params:[{name:"ns",description:"<p>values to parse</p>\n",type:"Array"}],return:{description:"integer representation of values",type:"Number[]"}}]},{file:"src/utilities/conversion.js",line:232,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",return:{description:"hexadecimal string representation of value",type:"String"},class:"p5",module:"Data",submodule:"Conversion",overloads:[{line:232,params:[{name:"n",description:"<p>value to parse</p>\n",type:"Number"},{name:"digits",description:"",type:"Number",optional:!0}],return:{description:"hexadecimal string representation of value",type:"String"}},{line:243,params:[{name:"ns",description:"<p>array of values to parse</p>\n",type:"Number[]"},{name:"digits",description:"",type:"Number",optional:!0}],return:{description:"hexadecimal string representation of values",type:"String[]"}}]},{file:"src/utilities/conversion.js",line:274,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",return:{description:"integer representation of hexadecimal value",type:"Number"},class:"p5",module:"Data",submodule:"Conversion",overloads:[{line:274,params:[{name:"n",description:"<p>value to parse</p>\n",type:"String"}],return:{description:"integer representation of hexadecimal value",type:"Number"}},{line:283,params:[{name:"ns",description:"<p>values to parse</p>\n",type:"Array"}],return:{description:"integer representations of hexadecimal value",type:"Number[]"}}]},{file:"src/utilities/string_functions.js",line:15,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>'],alt:'"hello world!" displayed middle left of canvas.',class:"p5",module:"Data",submodule:"String Functions"},{file:"src/utilities/string_functions.js",line:44,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:"String[]"},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>'],alt:'"p5js*" displayed middle left of canvas.',class:"p5",module:"Data",submodule:"String Functions"},{file:"src/utilities/string_functions.js",line:85,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:"String[]"},example:['\n<div class="norender">\n<code>\nvar string = "Hello p5js*! Hello world!"\nvar regexp = "Hello"\nmatchAll(string, regexp);\n</code>\n</div>'],class:"p5",module:"Data",submodule:"String Functions"},{file:"src/utilities/string_functions.js",line:132,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",return:{description:"formatted String",type:"String"},class:"p5",module:"Data",submodule:"String Functions",overloads:[{line:132,params:[{name:"num",description:"<p>the Number to format</p>\n",type:"Number|String"},{name:"left",description:"<p>number of digits to the left of the\n decimal point</p>\n",type:"Number|String",optional:!0},{name:"right",description:"<p>number of digits to the right of the\n decimal point</p>\n",type:"Number|String",optional:!0}],return:{description:"formatted String",type:"String"}},{line:146,params:[{name:"nums",description:"<p>the Numbers to format</p>\n",type:"Array"},{name:"left",description:"",type:"Number|String",optional:!0},{name:"right",description:"",type:"Number|String",optional:!0}],return:{description:"formatted Strings\\",type:"Array"}}]},{file:"src/utilities/string_functions.js",line:245,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",return:{description:"formatted String",type:"String"},class:"p5",module:"Data",submodule:"String Functions",overloads:[{line:245,params:[{name:"num",description:"<p>the Number to format</p>\n",type:"Number|String"},{name:"right",description:"<p>number of digits to the right of the\n decimal point</p>\n",type:"Number|String",optional:!0}],return:{description:"formatted String",type:"String"}},{line:257,params:[{name:"nums",description:"<p>the Numbers to format</p>\n",type:"Array"},{name:"right",description:"",type:"Number|String",optional:!0}],return:{description:"formatted Strings",type:"Array"}}]},{file:"src/utilities/string_functions.js",line:324,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",return:{description:"formatted String",type:"String"},class:"p5",module:"Data",submodule:"String Functions",overloads:[{line:324,params:[{name:"num",description:"<p>the Number to format</p>\n",type:"Number"},{name:"left",description:"<p>number of digits to the left of the decimal\n point</p>\n",type:"Number",optional:!0},{name:"right",description:"<p>number of digits to the right of the\n decimal point</p>\n",type:"Number",optional:!0}],return:{description:"formatted String",type:"String"}},{line:339,params:[{name:"nums",description:"<p>the Numbers to format</p>\n",type:"Number[]"},{name:"left",description:"",type:"Number",optional:!0},{name:"right",description:"",type:"Number",optional:!0}],return:{description:"formatted Strings",type:"String[]"}}]},{file:"src/utilities/string_functions.js",line:389,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",return:{description:"formatted String",type:"String"},class:"p5",module:"Data",submodule:"String Functions",overloads:[{line:389,params:[{name:"num",description:"<p>the Number to format</p>\n",type:"Number"},{name:"left",description:"<p>number of digits to the left of the decimal\n point</p>\n",type:"Number",optional:!0},{name:"right",description:"<p>number of digits to the right of the\n decimal point</p>\n",type:"Number",optional:!0}],return:{description:"formatted String",type:"String"}},{line:404,params:[{name:"nums",description:"<p>the Numbers to format</p>\n",type:"Array"},{name:"left",description:"",type:"Number",optional:!0},{name:"right",description:"",type:"Number",optional:!0}],return:{description:"formatted Strings",type:"Array"}}]},{file:"src/utilities/string_functions.js",line:454,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:"String[]"},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>'],alt:'"pat" top left, "Xio" mid left and "Alex" displayed bottom left',class:"p5",module:"Data",submodule:"String Functions"},{file:"src/utilities/string_functions.js",line:488,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:!0}],return:{description:"Array of Strings",type:"String[]"},example:['\n<div class = "norender">\n<code>\nfunction setup() {\n var myStr = "Mango, Banana, Lime";\n var myStrArr = splitTokens(myStr, ",");\n\n print(myStrArr); // prints : ["Mango"," Banana"," Lime"]\n}\n</code>\n</div>'],class:"p5",module:"Data",submodule:"String Functions"},{file:"src/utilities/string_functions.js",line:541,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",return:{description:"a trimmed String",type:"String"},class:"p5",module:"Data",submodule:"String Functions",overloads:[{line:541,params:[{name:"str",description:"<p>a String to be trimmed</p>\n",type:"String"}],return:{description:"a trimmed String",type:"String"}},{line:550,params:[{name:"strs",description:"<p>an Array of Strings to be trimmed</p>\n",type:"Array"}],return:{description:"an Array of trimmed Strings",type:"Array"}}]},{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>'],alt:"Current day is displayed",class:"p5",module:"IO",submodule:"Time & Date"},{file:"src/utilities/time_date.js",line:34,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>'],alt:"Current hour is displayed",class:"p5",module:"IO",submodule:"Time & Date"},{file:"src/utilities/time_date.js",line:56,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>'],alt:"Current minute is displayed",class:"p5",module:"IO",submodule:"Time & Date"},{file:"src/utilities/time_date.js",line:78,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>'],alt:"number of milliseconds since program has started displayed",class:"p5",module:"IO",submodule:"Time & Date"},{file:"src/utilities/time_date.js",line:101,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>'],alt:"Current month is displayed",class:"p5",module:"IO",submodule:"Time & Date"},{file:"src/utilities/time_date.js",line:123,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>'],alt:"Current second is displayed",class:"p5",module:"IO",submodule:"Time & Date"},{file:"src/utilities/time_date.js",line:145,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>'],alt:"Current year is displayed",class:"p5",module:"IO",submodule:"Time & Date"},{file:"src/webgl/camera.js",line:12,description:"<p>Sets camera position for a 3D sketch. The function behaves similarly\ngluLookAt, except that it replaces the existing modelview matrix instead\nof applying any transformations calculated here on top of the existing\nmodel view.\nWhen called with no arguments, this function\nsets a default camera equivalent to calling\ncamera(0, 0, (height/2.0) / tan(PI*30.0 / 180.0), 0, 0, 0, 0, 1, 0);</p>\n",itemtype:"method",name:"camera",params:[{name:"x",description:"<p>camera position value on x axis</p>\n",type:"Number",optional:!0},{name:"y",description:"<p>camera position value on y axis</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>camera position value on z axis</p>\n",type:"Number",optional:!0},{name:"centerX",description:"<p>x coordinate representing center of the sketch</p>\n",type:"Number",optional:!0},{name:"centerY",description:"<p>y coordinate representing center of the sketch</p>\n",type:"Number",optional:!0},{name:"centerZ",description:"<p>z coordinate representing center of the sketch</p>\n",type:"Number",optional:!0},{name:"upX",description:"<p>x component of direction &#39;up&#39; from camera</p>\n",type:"Number",optional:!0},{name:"upY",description:"<p>y component of direction &#39;up&#39; from camera</p>\n",type:"Number",optional:!0},{name:"upZ",description:"<p>z component of direction &#39;up&#39; from camera</p>\n",type:"Number",optional:!0}],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, 0, 0, 0, 0, 1, 0);\n plane(120, 120);\n}\n</code>\n</div>"],alt:"blue square shrinks in size grows to fill canvas. disappears then loops.",class:"p5",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/camera.js",line:160,description:"<p>Sets perspective camera. When called with no arguments, the defaults\nprovided are equivalent to\nperspective(PI/3.0, width/height, cameraZ/10.0, cameraZ<em>10.0)\nwhere cameraZ is ((height/2.0) / tan(PI</em>60.0/360.0));</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",optional:!0},{name:"aspect",description:"<p>camera frustum aspect ratio</p>\n",type:"Number",optional:!0},{name:"near",description:"<p>frustum near plane length</p>\n",type:"Number",optional:!0},{name:"far",description:"<p>frustum far plane length</p>\n",type:"Number",optional:!0}],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 var fov = 60 / 180 * PI;\n var cameraZ = (height/2.0) / tan(fov/2.0);\n perspective(60 / 180 * PI, width/height, cameraZ * 0.1, cameraZ * 10);\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>"],alt:"colored 3d boxes toggleable with mouse position",class:"p5",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/camera.js",line:232,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, 500);\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>"],alt:"3 3d boxes, reveal several more boxes on 3d plane when mouse used to toggle",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",chainable:1,class:"p5",module:"Lights, Camera",submodule:"Lights",overloads:[{line:12,params:[{name:"v1",description:"<p>red or hue value relative to\n the current color range</p>\n",type:"Number"},{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:!0}],chainable:1},{line:26,params:[{name:"value",description:"<p>a color string</p>\n",type:"String"},{name:"alpha",description:"",type:"Number",optional:!0}],chainable:1},{line:33,params:[{name:"values",description:"<p>an array containing the red,green,blue &amp;\n and alpha components of the color</p>\n",type:"Number[]"}],chainable:1},{line:40,params:[{name:"color",description:"<p>the ambient light color</p>\n",type:"p5.Color"},{name:"alpha",description:"",type:"Number",optional:!0}],chainable:1}]},{file:"src/webgl/light.js",line:89,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>green or saturation value</p>\n",type:"Number",optional:!0},{name:"v3",description:"<p>blue or brightness value</p>\n",type:"Number",optional:!0},{name:"a",description:"<p>opacity</p>\n",type:"Number",optional:!0},{name:"x",description:"<p>x axis direction or a p5.Vector</p>\n",type:"Number|p5.Vector"},{name:"y",description:"<p>y axis direction</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>z axis direction</p>\n",type:"Number",optional:!0}],chainable:1,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(50);\n}\n</code>\n</div>"],alt:"light source on canvas changeable with mouse position",class:"p5",module:"Lights, Camera",submodule:"Lights"},{file:"src/webgl/light.js",line:168,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>green or saturation value</p>\n",type:"Number",optional:!0},{name:"v3",description:"<p>blue or brightness value</p>\n",type:"Number",optional:!0},{name:"a",description:"<p>opacity</p>\n",type:"Number",optional:!0},{name:"x",description:"<p>x axis position or a p5.Vector</p>\n",type:"Number|p5.Vector"},{name:"y",description:"<p>y axis position</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>z axis position</p>\n",type:"Number",optional:!0}],chainable:1,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(50);\n}\n</code>\n</div>"],alt:"spot light on canvas changes position with mouse",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",return:{description:"the p5.Geometry object",type:"p5.Geometry"},class:"p5",module:"Shape",submodule:"3D Models",overloads:[{line:14,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"},{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.Geometry)",optional:!0},{name:"failureCallback",description:"<p>called with event error if\n the image fails to load.</p>\n",type:"Function(Event)",optional:!0}],return:{description:"the p5.Geometry object",type:"p5.Geometry"}},{line:35,params:[{name:"path",description:"",type:"String"},{name:"successCallback",description:"",type:"function(p5.Geometry)",optional:!0},{name:"failureCallback",description:"",type:"Function(Event)",optional:!0}],return:{description:"the p5.Geometry object",type:"p5.Geometry"}}]},{file:"src/webgl/loading.js",line:98,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:197,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>"],alt:"Vertically rotating 3-d teapot with red, green and blue gradient.",class:"p5",module:"Shape",submodule:"3D Models"},{file:"src/webgl/material.js",line:15,description:"<p>Loads a custom shader from the provided vertex and fragment\nshader paths. The shader files are loaded asynchronously in the\nbackground, so this method should be used in preload().</p>\n<p>For now, there are three main types of shaders. p5 will automatically\nsupply appropriate vertices, normals, colors, and lighting attributes\nif the parameters defined in the shader match the names.</p>\n",itemtype:"method",name:"loadShader",params:[{name:"vertFilename",description:"<p>path to file containing vertex shader\nsource code</p>\n",type:"String",optional:!0},{name:"fragFilename",description:"<p>path to file containing fragment shader\nsource code</p>\n",type:"String",optional:!0}],return:{description:"a shader object created from the provided\nvertex and fragment shader files.",type:"p5.Shader"},class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/material.js",line:58,description:"<p>The shader() function lets the user provide a custom shader\nto fill in shapes in WEBGL mode. Users can create their\nown shaders by loading vertex and fragment shaders with\nloadShader().</p>\n",itemtype:"method",name:"shader",chainable:1,params:[{name:"s",description:"<p>the desired p5.Shader to use for rendering\nshapes.</p>\n",type:"p5.Shader",optional:!0}],class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/material.js",line:81,description:'<p>Normal material for geometry. You can view all\npossible materials in this\n<a href="https://p5js.org/examples/3d-materials.html">example</a>.</p>\n',itemtype:"method",name:"normalMaterial",chainable:1,example:["\n<div>\n<code>\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw(){\n background(200);\n normalMaterial();\n sphere(50);\n}\n</code>\n</div>"],alt:"Red, green and blue gradient.",class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/material.js",line:113,description:'<p>Texture for geometry. You can view other possible materials in this\n<a href="https://p5js.org/examples/3d-materials.html">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"}],chainable:1,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>'],alt:"Rotating view of many images umbrella and grid roof on a 3d plane\nblack canvas\nblack canvas",class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/material.js",line:210,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/3d-materials.html">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>green or saturation value</p>\n",type:"Number",optional:!0},{name:"v3",description:"<p>blue or brightness value</p>\n",type:"Number",optional:!0},{name:"a",description:"<p>opacity</p>\n",type:"Number",optional:!0}],chainable:1,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(50);\n}\n</code>\n</div>"],alt:"radiating light source from top right of canvas",class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/material.js",line:253,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/3d-materials.html">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>green or saturation value</p>\n",type:"Number",optional:!0},{name:"v3",description:"<p>blue or brightness value</p>\n",type:"Number",optional:!0},{name:"a",description:"<p>opacity</p>\n",type:"Number",optional:!0}],chainable:1,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(50);\n}\n</code>\n</div>"],alt:"diffused radiating light source from top right of canvas",class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/material.js",line:297,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:86,description:"<p>computes smooth normals per vertex as an average of each\nface.</p>\n",chainable:1,class:"p5.Geometry",module:"Lights, Camera"},{file:"src/webgl/p5.Geometry.js",line:111,description:"<p>Averages the vertex normals. Used in curved\nsurfaces</p>\n",chainable:1,class:"p5.Geometry",module:"Lights, Camera"},{file:"src/webgl/p5.Geometry.js",line:130,description:"<p>Averages pole normals. Used in spherical primitives</p>\n",chainable:1,class:"p5.Geometry",module:"Lights, Camera"},{file:"src/webgl/p5.Geometry.js",line:161,description:"<p>Create a 2D array for establishing stroke connections</p>\n",return:{description:"",type:"p5.Geometry"},class:"p5.Geometry",module:"Lights, Camera"},{file:"src/webgl/p5.Geometry.js",line:182,description:"<p>Create 4 vertices for each stroke line, two at the beginning position\nand two at the end position. These vertices are displaced relative to\nthat line&#39;s normal on the GPU</p>\n",return:{description:"",type:"p5.Geometry"},class:"p5.Geometry",module:"Lights, Camera"},{file:"src/webgl/p5.Geometry.js",line:209,description:"<p>Modifies all vertices to be centered within the range -100 to 100.</p>\n",chainable:1,class:"p5.Geometry",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:!0}],class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.Matrix.js",line:75,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|Float32Array|Array",optional:!0},{name:"n00..n33",description:"<p>16 numbers passed by value to avoid\n array copying.</p>\n",type:"Number",optional:!0}],chainable:1,class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.Matrix.js",line:113,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:122,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:147,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:155,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|Float32Array|Array"}],chainable:1,class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.Matrix.js",line:215,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|Float32Array|Array"}],chainable:1,class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.Matrix.js",line:300,description:"<p>Inverts a 3x3 matrix</p>\n",chainable:1,class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.Matrix.js",line:336,description:"<p>transposes a 3x3 p5.Matrix by a mat3</p>\n",params:[{name:"mat3",description:"<p>1-dimensional array</p>\n",type:"[Number]"}],chainable:1,class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.Matrix.js",line:352,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"}],chainable:1,todo:["finish implementation"],class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.Matrix.js",line:380,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:403,description:"<p>multiply two mat4s</p>\n",params:[{name:"multMatrix",description:"<p>The matrix\n we want to multiply by</p>\n",type:"p5.Matrix|Float32Array|Array"}],chainable:1,class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.Matrix.js",line:460,description:"<p>scales a p5.Matrix by scalars or a vector</p>\n",params:[{name:"s",description:"<p>vector to scale by</p>\n",type:"p5.Vector|Float32Array|Array"}],chainable:1,class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.Matrix.js",line:505,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"}],chainable:"inspired by Toji's gl-matrix lib, mat4 rotation",class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.Matrix.js",line:584,todo:["finish implementing this method!\ntranslates"],params:[{name:"v",description:"<p>vector to translate by</p>\n",type:"Number[]"}],chainable:1,class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.Matrix.js",line:614,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"}],chainable:1,class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.Matrix.js",line:648,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"}],chainable:1,class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.Matrix.js",line:683,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"}],chainable:1,class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.Immediate.js",line:60,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"}],chainable:1,todo:["implement handling of p5.Vector args"],class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.Immediate.js",line:103,description:"<p>End shape drawing and render vertices to screen.</p>\n",chainable:1,class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.Retained.js",line:8,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:33,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:84,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"}],chainable:1,class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:69,description:"<p>model view, projection, &amp; normal\nmatrices</p>\n",class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:184,description:"<p>Set attributes for the WebGL Drawing context.\n This is a way of adjusting ways that the WebGL\n renderer works to fine-tune the display and performance.\n This should be put in setup().\n The available attributes are:\n <br>\n alpha - indicates if the canvas contains an alpha buffer\n default is true\n <br><br>\n depth - indicates whether the drawing buffer has a depth buffer\n of at least 16 bits - default is true\n <br><br>\n stencil - indicates whether the drawing buffer has a stencil buffer\n of at least 8 bits\n <br><br>\n antialias - indicates whether or not to perform anti-aliasing\n default is false\n <br><br>\n premultipliedAlpha - indicates that the page compositor will assume\n the drawing buffer contains colors with pre-multiplied alpha\n default is false\n <br><br>\n preserveDrawingBuffer - if true the buffers will not be cleared and\n and will preserve their values until cleared or overwritten by author\n (note that p5 clears automatically on draw loop)\n default is true\n <br><br></p>\n<div>\n <code>\n function setup() {\n createCanvas(150,150,WEBGL);\n }\n function draw() {\n background(255);\n push();\n rotateZ(frameCount <em> 0.02);\n rotateX(frameCount </em> 0.02);\n rotateY(frameCount <em> 0.02);\n fill(0,0,0);\n box(50);\n pop();\n }\n </code>\n </div>\n <br>\n Now with the antialias attribute set to true.\n <br>\n <div>\n <code>\n function setup() {\n createCanvas(150,150,WEBGL);\n setAttributes(&#39;antialias&#39;, true);\n }\n function draw() {\n background(255);\n push();\n rotateZ(frameCount </em> 0.02);\n rotateX(frameCount <em> 0.02);\n rotateY(frameCount </em> 0.02);\n fill(0,0,0);\n box(50);\n pop();\n }\n </code>\n </div>",itemtype:"method",name:"setAttributes",params:[{name:"String",description:"<p>name of attribute or object with key-value pairs</p>\n",type:"String|Object"},{name:"New",description:"<p>value of named attribute</p>\n",type:"Boolean"}],class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:331,description:"<p>[background description]</p>\n",class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:352,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>green or saturation value</p>\n",type:"Number",optional:!0},{name:"v3",description:"<p>blue or brightness value</p>\n",type:"Number",optional:!0},{name:"a",description:"<p>opacity</p>\n",type:"Number",optional:!0}],return:{description:"the p5 object",type:"P5"},example:["\n<div>\n<code>\nfunction setup(){\n createCanvas(200, 200, WEBGL);\n}\n\nfunction draw(){\n background(0);\n noStroke();\n fill(100, 100, 240);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n box(75, 75, 75);\n}\n</code>\n</div>"],alt:"black canvas with purple cube spinning",class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:400,description:"<p>Does not render fill material</p>\n",itemtype:"method",name:"noFill",example:["\n<div>\n<code>\nfunction setup(){\n createCanvas(200, 200, WEBGL);\n}\n\nfunction draw(){\n background(0);\n noFill();\n stroke(100, 100, 240);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n box(75, 75, 75);\n}\n</code>\n</div>"],alt:"black canvas with purple cube wireframe spinning",class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:431,description:"<p>Does not render stroke</p>\n",itemtype:"method",name:"noStroke",example:["\n<div>\n<code>\nfunction setup(){\n createCanvas(200, 200, WEBGL);\n}\n\nfunction draw(){\n background(0);\n noStroke();\n fill(240, 150, 150);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n box(75, 75, 75);\n}\n</code>\n</div>"],alt:"black canvas with pink cube spinning",class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:460,description:"<p>Basic stroke material for geometry with a given color</p>\n",itemtype:"method",name:"stroke",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>green or saturation value</p>\n",type:"Number",optional:!0},{name:"v3",description:"<p>blue or brightness value</p>\n",type:"Number",optional:!0},{name:"a",description:"<p>opacity</p>\n",type:"Number",optional:!0}],example:["\n<div>\n<code>\nfunction setup(){\n createCanvas(200, 200, WEBGL);\n}\n\nfunction draw(){\n background(0);\n stroke(240, 150, 150);\n fill(100, 100, 240);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n box(75, 75, 75);\n}\n</code>\n</div>"],alt:"black canvas with purple cube with pink outline spinning",class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:505,description:"<p>Change weight of stroke</p>\n",itemtype:"method",name:"strokeWeight",params:[{name:"stroke",description:"<p>weight to be used for drawing</p>\n",type:"Number"}],example:["\n<div>\n<code>\nfunction setup(){\n createCanvas(200, 400, WEBGL);\n setAttributes('antialias', true);\n}\n\nfunction draw(){\n background(0);\n noStroke();\n translate(0,-100,0);\n stroke(240,150,150);\n fill(100,100,240);\n push();\n strokeWeight(8);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n sphere(75);\n pop();\n push();\n translate(0,200,0);\n strokeWeight(1);\n rotateX(frameCount * 0.01);\n rotateY(frameCount * 0.01);\n sphere(75);\n pop();\n}\n\n</code>\n</div>"],alt:"black canvas with two purple rotating spheres with pink\noutlines the sphere on top has much heavier outlines,",class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:569,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.\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) is using pixels[] with pixel density d</p>\n",itemtype:"method",name:"get",params:[{name:"x",description:"<p>x-coordinate of the pixel</p>\n",type:"Number",optional:!0},{name:"y",description:"<p>y-coordinate of the pixel</p>\n",type:"Number",optional:!0},{name:"w",description:"<p>width</p>\n",type:"Number",optional:!0},{name:"h",description:"<p>height</p>\n",type:"Number",optional:!0}],return:{description:"color of pixel at x,y in array format\n [R, G, B, A] or p5.Image",type:"Array|Color|p5.Image"},class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:597,description:"<p>Loads the pixels data for this canvas into the pixels[] attribute.\nNote that updatePixels() and set() do not work.\nAny pixel manipulation must be done directly to the pixels[] array.</p>\n",itemtype:"method",name:"loadPixels",params:[{name:"x",description:"<p>starting pixel x position, defaults to 0</p>\n",type:"Number",optional:!0},{name:"y",description:"<p>starting pixel y position, defaults to 0</p>\n",type:"Number",optional:!0},{name:"w",description:"<p>width of pixels to load, defaults to sketch width</p>\n",type:"Number",optional:!0},{name:"h",description:"<p>height of pixels to load, defaults to sketch height</p>\n",type:"Number",optional:!0}],class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:642,description:"<p>[resize description]</p>\n",params:[{name:"w",description:"<p>[description]</p>\n",type:"Number"},{name:"h",description:"<p>[description]</p>\n",type:"Number"}],class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:659,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:675,description:"<p>[translate description]</p>\n",params:[{name:"x",description:"<p>[description]</p>\n",type:"Number"},{name:"y",description:"<p>[description]</p>\n",type:"Number"},{name:"z",description:"<p>[description]</p>\n",type:"Number"}],chainable:1,todo:["implement handle for components or vector as args"],class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:693,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:!0},{name:"z",description:"<p>z-axis scalar</p>\n",type:"Number",optional:!0}],chainable:1,class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:725,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:734,description:"<p>[pop description]</p>\n",class:"p5.RendererGL",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:904,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.js",line:918,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.Shader.js",line:40,description:"<p>Creates, compiles, and links the shader based on its\nsources for the vertex and fragment shaders (provided\nto the constructor). Populates known attributes and\nuniforms from the shader.</p>\n",itemtype:"method",name:"init",chainable:1,access:"private",tagname:"",class:"p5.Shader",module:"Lights, Camera",submodule:"Shaders"},{file:"src/webgl/p5.Shader.js",line:98,description:"<p>Queries the active attributes for this shader and loads\ntheir names and locations into the attributes array.</p>\n",itemtype:"method",name:"_loadAttributes",access:"private",tagname:"",class:"p5.Shader",module:"Lights, Camera",submodule:"Shaders"},{file:"src/webgl/p5.Shader.js",line:130,description:"<p>Queries the active uniforms for this shader and loads\ntheir names and locations into the uniforms array.</p>\n",itemtype:"method",name:"_loadUniforms",access:"private",tagname:"",class:"p5.Shader",module:"Lights, Camera",submodule:"Shaders"},{file:"src/webgl/p5.Shader.js",line:179,description:"<p>initializes (if needed) and binds the shader program.</p>\n",itemtype:"method",name:"bindShader",access:"private",tagname:"",class:"p5.Shader",module:"Lights, Camera",submodule:"Shaders"},{file:"src/webgl/p5.Shader.js",line:202,itemtype:"method",name:"unbindShader",chainable:1,access:"private",tagname:"",class:"p5.Shader",module:"Lights, Camera",submodule:"Shaders"},{file:"src/webgl/p5.Shader.js",line:253,itemtype:"method",name:"useProgram",chainable:1,access:"private",tagname:"",class:"p5.Shader",module:"Lights, Camera",submodule:"Shaders"},{file:"src/webgl/p5.Shader.js",line:264,description:"<p>Wrapper around gl.uniform functions.\nAs we store uniform info in the shader we can use that\nto do type checking on the supplied data and call\nthe appropriate function.</p>\n",itemtype:"method",name:"setUniform",chainable:1,params:[{name:"uniformName",description:"<p>the name of the uniform in the\nshader program</p>\n",type:"String"},{name:"data",description:"<p>the data to be associated with that uniform; type\nvaries (could be a single numerical value, array, matrix, or\ntexture / sampler reference)</p>\n",type:"Object"}],class:"p5.Shader",module:"Lights, Camera",submodule:"Shaders"},{file:"src/webgl/p5.Shader.js",line:394,itemtype:"method",name:"enableAttrib",chainable:1,access:"private",tagname:"",class:"p5.Shader",module:"Lights, Camera",submodule:"Shaders"},{file:"src/webgl/p5.Texture.js",line:66,description:"<p>Initializes common texture parameters, creates a gl texture,\ntries to upload the texture for the first time if data is\nalready available.</p>\n",access:"private",tagname:"",itemtype:"method",name:"init",class:"p5.Texture",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/p5.Texture.js",line:98,description:"<p>Checks if the source data for this texture has changed (if it&#39;s\neasy to do so) and reuploads the texture if necessary. If it&#39;s not\npossible or to expensive to do a calculation to determine wheter or\nnot the data has occurred, this method simply re-uploads the texture.</p>\n",itemtype:"method",name:"update",class:"p5.Texture",module:"Lights, Camera",submodule:"Material"},{
file:"src/webgl/p5.Texture.js",line:185,description:"<p>Binds the texture to the appropriate GL target.</p>\n",itemtype:"method",name:"bindTexture",class:"p5.Texture",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/p5.Texture.js",line:199,description:"<p>Unbinds the texture from the appropriate GL target.</p>\n",itemtype:"method",name:"unbindTexture",class:"p5.Texture",module:"Lights, Camera",submodule:"Material"},{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:!0},{name:"detailY",description:"<p>Optional number of triangle\n subdivisions in y-dimension</p>\n",type:"Number",optional:!0}],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(50, 50);\n}\n</code>\n</div>"],alt:"Nothing displayed on canvas\nRotating interior view of a box with sides that change color.\n3d red and green gradient.\nRotating interior view of a cylinder with sides that change color.\nRotating view of a cylinder with sides that change color.\n3d red and green gradient.\nrotating view of a multi-colored cylinder with concave sides.",class:"p5",module:"Shape",submodule:"3D Primitives"},{file:"src/webgl/primitives.js",line:93,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",optional:!0},{name:"depth",description:"<p>depth of the box</p>\n",type:"Number",optional:!0},{name:"detailX",description:"<p>Optional number of triangle\n subdivisions in x-dimension</p>\n",type:"Number",optional:!0},{name:"detailY",description:"<p>Optional number of triangle\n subdivisions in y-dimension</p>\n",type:"Number",optional:!0}],chainable:1,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:190,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>number of segments,\n the more segments the smoother geometry\n default is 24</p>\n",type:"Number",optional:!0},{name:"detailY",description:"<p>number of segments,\n the more segments the smoother geometry\n default is 16</p>\n",type:"Number",optional:!0}],chainable:1,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(50);\n}\n</code>\n</div>"],class:"p5",module:"Shape",submodule:"3D Primitives"},{file:"src/webgl/primitives.js",line:265,access:"private",tagname:"helper function for creating both cones and cyllinders",class:"p5",module:"Shape",submodule:"3D Primitives"},{file:"src/webgl/primitives.js",line:343,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>number of segments,\n the more segments the smoother geometry\n default is 24</p>\n",type:"Number",optional:!0},{name:"detailY",description:"<p>number of segments in y-dimension,\n the more segments the smoother geometry\n default is 16</p>\n",type:"Number",optional:!0}],chainable:1,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:409,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>number of segments,\n the more segments the smoother geometry\n default is 24</p>\n",type:"Number",optional:!0},{name:"detailY",description:"<p>number of segments,\n the more segments the smoother geometry\n default is 16</p>\n",type:"Number",optional:!0}],chainable:1,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:475,description:"<p>Draw an ellipsoid with given radius</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>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:!0},{name:"detailY",description:"<p>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:!0}],chainable:1,example:["\n<div>\n<code>\n// draw an ellipsoid with radius 20, 30 and 40.\nfunction setup(){\n createCanvas(100, 100, WEBGL);\n}\n\nfunction draw(){\n background(200);\n ellipsoid(20, 30, 40);\n}\n</code>\n</div>"],class:"p5",module:"Shape",submodule:"3D Primitives"},{file:"src/webgl/primitives.js",line:556,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>number of segments in x-dimension,\n the more segments the smoother geometry\n default is 24</p>\n",type:"Number",optional:!0},{name:"detailY",description:"<p>number of segments in y-dimension,\n the more segments the smoother geometry\n default is 16</p>\n",type:"Number",optional:!0}],chainable:1,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/webgl/primitives.js",line:860,description:"<p>Draw a line given two points</p>\n",params:[{name:"x0",description:"<p>x-coordinate of first vertex</p>\n",type:"Number"},{name:"y0",description:"<p>y-coordinate of first vertex</p>\n",type:"Number"},{name:"z0",description:"<p>z-coordinate of first vertex</p>\n",type:"Number"},{name:"x1",description:"<p>x-coordinate of second vertex</p>\n",type:"Number"},{name:"y1",description:"<p>y-coordinate of second vertex</p>\n",type:"Number"},{name:"z1",description:"<p>z-coordinate of second vertex</p>\n",type:"Number"}],chainable:1,example:["\n<div>\n<code>\n//draw a line\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 // Use fill instead of stroke to change the color of shape.\n fill(255, 0, 0);\n line(10, 10, 0, 60, 60, 20);\n}\n</code>\n</div>"],class:"p5",module:"Shape",submodule:"3D Primitives"},{file:"lib/addons/p5.dom.js",line:41,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:!0}],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:100,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:!0}],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:156,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:172,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:199,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:225,description:"<p>Helpers for create methods.</p>\n",class:"p5.dom",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:236,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",optional:!0}],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:253,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",optional:!0}],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:271,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",optional:!0}],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:297,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:!0},{name:"successCallback",description:"<p>callback to be called once image data is loaded</p>\n",type:"Function",optional:!0}],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:342,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:!0}],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:369,class:"p5.dom",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:372,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:!0},{name:"step",description:"<p>step size for each tick of the slider (if step is set to 0, the slider will move continuously from the minimum to the maximum value)</p>\n",type:"Number",optional:!0}],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:428,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:!0}],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:463,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:!0},{name:"value",description:"<p>value of the checkbox; checked is true, unchecked is false.Unchecked if no value given</p>\n",type:"Boolean",optional:!0}],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:528,description:"<p>Creates a dropdown menu &lt;select&gt;&lt;/select&gt; element in the DOM.\nIt also helps to assign select-box methods to p5.Element when selecting existing select box</p>\n",itemtype:"method",name:"createSelect",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>"],class:"p5.dom",module:"p5.dom",submodule:"p5.dom",overloads:[{line:528,params:[{name:"multiple",description:"<p>true if dropdown should support multiple selections</p>\n",type:"Boolean",optional:!0}],return:{description:"",type:"p5.Element"}},{line:556,params:[{name:"existing",description:"<p>DOM select element</p>\n",type:"Object"}],return:{description:"",type:"p5.Element"}}]},{file:"lib/addons/p5.dom.js",line:633,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:!0}],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:759,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:!0},{name:"type",description:"<p>type of text, ie text, password etc. Defaults to text</p>\n",type:"String",optional:!0}],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:789,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:!0},{name:"multiple",description:"<p>optional to allow multiple files selected</p>\n",type:"String",optional:!0}],return:{description:"pointer to p5.Element holding created DOM element",type:"Object|p5.Element"},example:["\nvar input;\nvar img;\n\nfunction setup() {\n input = createFileInput(handleFile);\n input.position(0, 0);\n}\n\nfunction draw() {\n if (img) {\n image(img, 0, 0, width, height);\n }\n}\n\nfunction handleFile(file) {\n print(file);\n if (file.type === 'image') {\n img = createImg(file.data);\n img.hide();\n }\n}"],class:"p5.dom",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:874,class:"p5.dom",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:911,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:!0}],return:{description:"pointer to video p5.Element",type:"p5.MediaElement|p5.Element"},class:"p5.dom",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:937,class:"p5.dom",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:939,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:!0}],return:{description:"pointer to audio p5.Element",type:"p5.MediaElement|p5.Element"},class:"p5.dom",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:965,class:"p5.dom",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:998,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:1111,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:!0}],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:1137,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:1164,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:1179,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:!0}],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:1223,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:1276,description:"<p>If an argument is given, sets the inner HTML of the element,\n replacing any existing html. If true is included as a second\n argument, html is appended instead of replacing existing html.\n 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:!0},{name:"append",description:"<p>whether to append HTML to existing</p>\n",type:"Boolean",optional:!0}],return:{description:"",type:"Object|p5.Element|String"},example:["\n <div class='norender'><code>\n var div = createDiv('').size(100,100);\n div.html('hi');\n </code></div>\n <div class='norender'><code>\n var div = createDiv('Hello ').size(100,100);\n div.html('World', true);\n </code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1311,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:!0},{name:"y",description:"<p>y-position relative to upper left of window</p>\n",type:"Number",optional:!0}],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:1392,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 (only String|Number for rotate/translate)</p>\n",type:"String|Number|p5.Color",optional:!0}],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:1474,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:!0}],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:1514,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:1558,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:!0}],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:1601,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:1619,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:1635,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:!0},{name:"h",description:"<p>height of the element</p>\n",type:"Number",optional:!0}],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:1701,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:1750,description:"<p>Path to the media element source.</p>\n",itemtype:"property",name:"src",return:{description:"src",type:"String"},example:["\n<div><code>\nvar ele;\n\nfunction setup() {\n background(250);\n\n //p5.MediaElement objects are usually created\n //by calling the createAudio(), createVideo(),\n //and createCapture() functions.\n\n //In this example we create\n //a new p5.MediaElement via createAudio().\n ele = createAudio('assets/beat.mp3');\n\n //We'll set up our example so that\n //when you click on the text,\n //an alert box displays the MediaElement's\n //src field.\n textAlign(CENTER);\n text(\"Click Me!\", width/2, height/2);\n}\n\nfunction mouseClicked() {\n //here we test if the mouse is over the\n //canvas element when it's clicked\n if(mouseX >= 0 && mouseX <= width &&\n mouseY >= 0 && mouseY <= height) {\n //Show our p5.MediaElement's src field\n alert(ele.src);\n }\n}\n\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1820,description:"<p>Play an HTML5 media element.</p>\n",itemtype:"method",name:"play",return:{description:"",type:"Object|p5.Element"},example:['\n<div><code>\nvar ele;\n\nfunction setup() {\n //p5.MediaElement objects are usually created\n //by calling the createAudio(), createVideo(),\n //and createCapture() functions.\n\n //In this example we create\n //a new p5.MediaElement via createAudio().\n ele = createAudio(\'assets/beat.mp3\');\n\n background(250);\n textAlign(CENTER);\n text("Click to Play!", width/2, height/2);\n}\n\nfunction mouseClicked() {\n //here we test if the mouse is over the\n //canvas element when it\'s clicked\n if(mouseX >= 0 && mouseX <= width &&\n mouseY >= 0 && mouseY <= height) {\n\n //Here we call the play() function on\n //the p5.MediaElement we created above.\n //This will start the audio sample.\n ele.play();\n\n background(200);\n text("You clicked Play!", width/2, height/2);\n }\n}\n</code></div>'],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1875,description:"<p>Stops an HTML5 media element (sets current time to zero).</p>\n",itemtype:"method",name:"stop",return:{description:"",type:"Object|p5.Element"},example:['\n<div><code>\n\n//This example both starts \n//and stops a sound sample\n//when the user clicks the canvas\n\n//We will store the p5.MediaElement\n//object in here\nvar ele;\n\n//while our audio is playing,\n//this will be set to true\nvar sampleIsPlaying = false;\n\nfunction setup() {\n //Here we create a p5.MediaElement object\n //using the createAudio() function.\n ele = createAudio(\'assets/beat.mp3\');\n background(200);\n textAlign(CENTER);\n text("Click to play!", width/2, height/2);\n}\n\nfunction mouseClicked() {\n //here we test if the mouse is over the\n //canvas element when it\'s clicked\n if(mouseX >= 0 && mouseX <= width &&\n mouseY >= 0 && mouseY <= height) {\n background(200);\n\n if(sampleIsPlaying) {\n //if the sample is currently playing\n //calling the stop() function on\n //our p5.MediaElement will stop\n //it and reset its current\n //time to 0 (i.e. it will start\n //at the beginning the next time\n //you play it)\n ele.stop();\n\n sampleIsPlaying = false;\n text("Click to play!", width/2, height/2);\n } else {\n //loop our sound element until we\n //call ele.stop() on it.\n ele.loop(); \n\n sampleIsPlaying = true;\n text("Click to stop!", width/2, height/2);\n }\n }\n}\n\n</code></div>'],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1942,description:"<p>Pauses an HTML5 media element.</p>\n",itemtype:"method",name:"pause",return:{description:"",type:"Object|p5.Element"},example:['\n<div><code>\n//This example both starts\n//and pauses a sound sample\n//when the user clicks the canvas\n\n//We will store the p5.MediaElement\n//object in here\nvar ele;\n\n//while our audio is playing,\n//this will be set to true\nvar sampleIsPlaying = false;\n\nfunction setup() {\n //Here we create a p5.MediaElement object\n //using the createAudio() function.\n ele = createAudio(\'assets/lucky_dragons_-_power_melody.mp3\');\n background(200);\n textAlign(CENTER);\n text("Click to play!", width/2, height/2);\n}\n\nfunction mouseClicked() {\n //here we test if the mouse is over the\n //canvas element when it\'s clicked\n if(mouseX >= 0 && mouseX <= width &&\n mouseY >= 0 && mouseY <= height) {\n background(200);\n\n if(sampleIsPlaying) {\n //Calling pause() on our\n //p5.MediaElement will stop it\n //playing, but when we call the\n //loop() or play() functions\n //the sample will start from\n //where we paused it.\n ele.pause();\n\n sampleIsPlaying = false;\n text("Click to resume!", width/2, height/2);\n } else {\n //loop our sound element until we\n //call ele.pause() on it.\n ele.loop(); \n\n sampleIsPlaying = true;\n text("Click to pause!", width/2, height/2);\n }\n }\n}\n\n</code></div>'],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2006,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"},example:['\n<div><code>\n//Clicking the canvas will loop\n//the audio sample until the user\n//clicks again to stop it\n\n//We will store the p5.MediaElement\n//object in here\nvar ele;\n\n//while our audio is playing,\n//this will be set to true\nvar sampleIsLooping = false;\n\nfunction setup() {\n //Here we create a p5.MediaElement object\n //using the createAudio() function.\n ele = createAudio(\'assets/lucky_dragons_-_power_melody.mp3\');\n background(200);\n textAlign(CENTER);\n text("Click to loop!", width/2, height/2);\n}\n\nfunction mouseClicked() {\n //here we test if the mouse is over the\n //canvas element when it\'s clicked\n if(mouseX >= 0 && mouseX <= width &&\n mouseY >= 0 && mouseY <= height) {\n background(200);\n\n if(sampleIsLooping == false) {\n //loop our sound element until we\n //call ele.stop() on it.\n ele.loop();\n\n sampleIsLooping = true;\n text("Click to stop!", width/2, height/2);\n } else {\n ele.stop();\n\n sampleIsLooping = false;\n text("Click to loop!", width/2, height/2);\n }\n }\n}\n\n</code></div>'],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2064,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:2077,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:2089,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:!0}],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:2105,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:!0}],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:2124,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:!0}],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:2141,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:2201,description:"<p>helper method for web GL mode to figure out if the element\nhas been modified and might need to be re-uploaded to texture\nmemory between frames.</p>\n",itemtype:"method",name:"isModified",access:"private",tagname:"",return:{description:"a boolean indicating whether or not the\nimage has been updated or modified since last texture upload.",type:"Boolean"},class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2213,description:"<p>helper method for web GL mode to indicate that an element has been\nchanged or unchanged since last upload. gl texture upload will\nset this value to false after uploading the texture; or might set\nit to true if metadata has become available but there is no actual\ntexture data available yet..</p>\n",itemtype:"method",name:"setModified",params:[{name:"val",description:"<p>sets whether or not the element has been\nmodified.</p>\n",type:"Boolean"}],access:"private",tagname:"",class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2227,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:2259,class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2261,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|Object"}],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2313,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:2329,class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2331,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:2342,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:2351,class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2353,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:!0}],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:2415,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:2435,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:2491,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:2503,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:2509,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:2515,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:2521,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:2528,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:46,description:'<p>p5.sound \n<a href="https://p5js.org/reference/#/libraries/p5.sound">https://p5js.org/reference/#/libraries/p5.sound</a></p>\n<p>From the Processing Foundation and contributors\n<a href="https://github.com/processing/p5.js-sound/graphs/contributors">https://github.com/processing/p5.js-sound/graphs/contributors</a></p>\n<p>MIT License (MIT)\n<a href="https://github.com/processing/p5.js-sound/blob/master/LICENSE">https://github.com/processing/p5.js-sound/blob/master/LICENSE</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. 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. 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:212,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:226,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:296,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:331,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:342,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:!0},{name:"timeFromNow",description:"<p>Schedule this event to happen at\n t seconds in the future</p>\n",type:"Number",optional:!0}],class:"p5.sound",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:384,description:"<p><code>p5.soundOut</code> 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:"soundOut",type:"Object",class:"p5.sound",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:393,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:412,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",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:425,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",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:438,
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",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:471,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",optional:!0,multiple:!0}],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('assets/beatbox.mp3');\n}\n\nfunction setup() {\n mySound.play();\n}\n</code></div>"],class:"p5",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:584,description:"<p>Used by Osc and Env to chain signal math</p>\n",class:"p5",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:869,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:!0},{name:"errorCallback",description:"<p>Name of a function to call if there is\n an error loading the file.</p>\n",type:"Function",optional:!0},{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:!0}],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:917,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:!0},{name:"errorCallback",description:"<p>Name of a function to call if there is an error</p>\n",type:"Function",optional:!0}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1009,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:1022,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:!0},{name:"rate",description:"<p>(optional) playback rate</p>\n",type:"Number",optional:!0},{name:"amp",description:"<p>(optional) amplitude (volume)\n of playback</p>\n",type:"Number",optional:!0},{name:"cueStart",description:"<p>(optional) cue start time in seconds</p>\n",type:"Number",optional:!0},{name:"duration",description:"<p>(optional) duration of playback in seconds</p>\n",type:"Number",optional:!0}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1119,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:1161,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:!0}],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}\n</code>\n</div>"],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1217,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:!0},{name:"rate",description:"<p>(optional) playback rate</p>\n",type:"Number",optional:!0},{name:"amp",description:"<p>(optional) playback volume</p>\n",type:"Number",optional:!0},{name:"cueLoopStart",description:"<p>(optional) startTime in seconds</p>\n",type:"Number",optional:!0},{name:"duration",description:"<p>(optional) loop duration in seconds</p>\n",type:"Number",optional:!0}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1233,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:1253,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:1267,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:1277,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:1287,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:!0}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1311,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:1333,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:!0},{name:"timeFromNow",description:"<p>Schedule this event to happen at\n t seconds in the future</p>\n",type:"Number",optional:!0}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1374,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:!0},{name:"timeFromNow",description:"<p>schedule this event to happen\n seconds from now</p>\n",type:"Number",optional:!0}],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:1413,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:1423,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 Values less than zero play backwards.</p>\n",type:"Number",optional:!0}],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:1495,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:1509,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:1525,description:"<p>Move the playhead of the song to a position, in seconds. Start timing\nand playback duration. 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:"duration",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:1548,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:1558,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:1567,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:1577,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:!0}],return:{description:"Array of peaks.",type:"Float32Array"},class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1629,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:1664,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:1717,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:!0}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1738,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:1746,class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1751,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:1764,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:1835,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:!0},{name:"minThreshold",description:"<p>minimum threshold defaults to 0.22</p>\n",type:"Number",optional:!0},{name:"minPeaks",description:"<p>minimum number of peaks defaults to 200</p>\n",type:"Number",optional:!0}],return:{description:"Array of timestamped peaks",type:"Array"},class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2026,class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2035,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:!0}],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:2110,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:2128,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:2236,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:!0},{name:"smoothing",description:"<p>a range between 0.0 and 1.0\n to smooth amplitude readings</p>\n",type:"Number|undefined",optional:!0}],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:2341,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:!0}],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:2382,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:!0}],class:"p5.Amplitude",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2402,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:2571,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:!0}],class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2590,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:!0},{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:!0}],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:2633,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:!0},{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:!0}],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:2725,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:!0}],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:2805,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:2886,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:2906,description:"<p>Returns an array of average amplitude values for a given number\nof frequency bands split equally. N defaults to 16.\n<em>NOTE: analyze() must be called prior to linAverages(). Analyze()\ntells the FFT to analyze frequency data, and linAverages() uses\nthe results to group them into a smaller set of averages.</em></p></p>\n",itemtype:"method",name:"linAverages",params:[{name:"N",description:"<p>Number of returned frequency groups</p>\n",type:"Number"}],return:{description:"linearAverages Array of average amplitude values for each group",type:"Array"},class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2936,description:'<p>Returns an array of average amplitude values of the spectrum, for a given\nset of <a href="https://en.wikipedia.org/wiki/Octave_band" target="_blank">\nOctave Bands</a>\n<em>NOTE: analyze() must be called prior to logAverages(). Analyze()\ntells the FFT to analyze frequency data, and logAverages() uses\nthe results to group them into a smaller set of averages.</em></p></p>\n',itemtype:"method",name:"logAverages",params:[{name:"octaveBands",description:"<p>Array of Octave Bands objects for grouping</p>\n",type:"Array"}],return:{description:"logAverages Array of average amplitude values for each group",type:"Array"},class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2966,description:'<p>Calculates and Returns the 1/N\n<a href="https://en.wikipedia.org/wiki/Octave_band" target="_blank">Octave Bands</a>\nN defaults to 3 and minimum central frequency to 15.625Hz.\n(1/3 Octave Bands ~= 31 Frequency Bands)\nSetting fCtr0 to a central value of a higher octave will ignore the lower bands\nand produce less frequency groups.</p>\n',itemtype:"method",name:"getOctaveBands",params:[{name:"N",description:"<p>Specifies the 1/N type of generated octave bands</p>\n",type:"Number"},{name:"fCtr0",description:"<p>Minimum central frequency for the lowest band</p>\n",type:"Number"}],return:{description:"octaveBands Array of octave band objects with their bounds",type:"Array"},class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3024,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3427,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3448,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3507,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3960,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4097,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4130,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4176,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4197,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4217,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4319,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",optional:!0}],class:"p5.Signal",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4330,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:4343,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:4362,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:4381,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:4515,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:!0},{name:"frequency",description:"<p>frequency in Hz.</p>\n",type:"Number",optional:!0}],class:"p5.Oscillator",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4555,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:4571,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:!0},{name:"timeFromNow",description:"<p>schedule this event to happen\n seconds from now</p>\n",type:"Number",optional:!0}],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:4606,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:!0},{name:"timeFromNow",description:"<p>Schedule this event to happen\n at x seconds from now</p>\n",type:"Number",optional:!0}],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:4665,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:4677,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:4694,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:4705,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:4737,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:4791,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:4808,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:4824,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:4923,class:"p5.SqrOsc",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5109,class:"p5.SqrOsc",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5333,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:5338,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:5343,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:5348,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:5353,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:5358,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:5394,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"}],example:["\n<div><code>\nvar t1 = 0.1; // attack time in seconds\nvar l1 = 0.7; // attack level 0.0 to 1.0\nvar t2 = 0.3; // decay time in seconds\nvar l2 = 0.1; // decay level 0.0 to 1.0\nvar t3 = 0.2; // sustain time in seconds\nvar l3 = dL; // sustain level 0.0 to 1.0\n// release level defaults to zero\n\nvar env;\nvar triOsc;\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 env = new p5.Env(t1, l1, t2, l2, t3, l3);\n triOsc = new p5.Oscillator('triangle');\n triOsc.amp(env); // give the env control of the triOsc's amp\n triOsc.start();\n}\n\n// mouseClick triggers envelope if over canvas\nfunction mouseClicked() {\n // is mouse over canvas?\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n env.play(triOsc);\n }\n}\n</code></div>\n"],class:"p5.Env",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5453,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:!0},{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:!0},{name:"releaseTime",description:"<p>Time in seconds from now (defaults to 0)</p>\n",type:"Number",optional:!0}],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:5518,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:5597,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:"inputs",description:"<p>A p5.sound object or\n Web Audio Param.</p>\n",type:"Object",optional:!0,multiple:!0}],class:"p5.Env",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5612,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:5630,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:!0},{name:"sustainTime",description:"<p>time to sustain before releasing the envelope</p>\n",type:"Number",optional:!0}],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:5691,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:5800,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:5899,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:!0}],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:6004,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:6020,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:6036,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:6140,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:!0}],class:"p5.Pulse",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6325,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:!0}],class:"p5.Noise",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6355,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:6372,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:6384,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:6393,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:!0},{name:"timeFromNow",description:"<p>schedule this event to happen\n seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.Noise",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6403,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:6409,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:6481,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:6506,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<p>Certain browsers limit access to the user&#39;s microphone. For example,\nChrome only allows access from localhost and over https. For this reason,\nyou may want to include an errorCallback—a function that is called in case\nthe browser won&#39;t provide mic access.</p>\n",itemtype:"method",name:"start",params:[{name:"successCallback",
description:"<p>Name of a function to call on\n success.</p>\n",type:"Function",optional:!0},{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",optional:!0}],class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6571,description:"<p>Turn the AudioIn off. If the AudioIn is stopped, it cannot getLevel().\nIf re-starting, the user may be prompted for permission access.</p>\n",itemtype:"method",name:"stop",class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6583,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:!0}],class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6604,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:6616,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:!0}],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:6634,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:6649,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:!0}],class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6677,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:6726,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:6763,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6779,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6803,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6829,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6858,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6888,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6936,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6959,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6984,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7005,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7012,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7034,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7063,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7090,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7118,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7146,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7192,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7223,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7241,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7629,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7651,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7721,description:"<p>The p5.Effect class is built\n using Tone.js CrossFade</p>\n",access:"private",tagname:"",class:"p5.Effect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7727,description:"<p>In classes that extend\np5.Effect, connect effect nodes\nto the wet parameter</p>\n",class:"p5.Effect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7740,description:"<p>Set the output volume of the filter.</p>\n",itemtype:"method",name:"amp",params:[{name:"vol",description:"<p>amplitude between 0 and 1.0</p>\n",type:"Number",optional:!0},{name:"rampTime",description:"<p>create a fade that lasts until rampTime</p>\n",type:"Number",optional:!0},{name:"tFromNow",description:"<p>schedule this event to happen in tFromNow seconds</p>\n",type:"Number",optional:!0}],class:"p5.Effect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7757,description:"<p>Link effects together in a chain<br>Example usage: filter.chain(reverb, delay, panner);\nMay be used with an open-ended number of arguments</p>\n",itemtype:"method",name:"chain",params:[{name:"arguments",description:"<p>Chain together multiple sound objects</p>\n",type:"Object",optional:!0}],class:"p5.Effect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7774,description:"<p>Adjust the dry/wet value.</p>\n",itemtype:"method",name:"drywet",params:[{name:"fade",description:"<p>The desired drywet value (0 - 1.0)</p>\n",type:"Number",optional:!0}],class:"p5.Effect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7786,description:"<p>Send output to a p5.js-sound, Web Audio Node, or use signal to\ncontrol an AudioParam</p>\n",itemtype:"method",name:"connect",params:[{name:"unit",description:"",type:"Object"}],class:"p5.Effect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7797,description:"<p>Disconnect all output.</p>\n",itemtype:"method",name:"disconnect",class:"p5.Effect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7904,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:"DelayNode",class:"p5.Filter",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7919,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",optional:!0},{name:"res",description:"<p>Resonance/Width of the filter frequency\n from 0.001 to 1000</p>\n",type:"Number",optional:!0}],class:"p5.Filter",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7933,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",optional:!0},{name:"res",description:"<p>Resonance (Q) from 0.001 to 1000</p>\n",type:"Number",optional:!0},{name:"timeFromNow",description:"<p>schedule this event to happen\n seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.Filter",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7950,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:!0}],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:7975,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:!0}],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:7997,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:"t",description:"",type:"String"}],class:"p5.Filter",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8124,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:"DelayNode",class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8132,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:"DelayNode",class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8164,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:!0},{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:!0},{name:"lowPass",description:"<p>Cutoff frequency. Only frequencies\n below the lowPass will be part of the\n delay.</p>\n",type:"Number",optional:!0}],class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8199,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:8218,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. The default value is 0.5</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"}],return:{description:"Feedback value",type:"Number"},class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8246,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:8263,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:8296,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:!0},{name:"timeFromNow",description:"<p>schedule this event to happen\n seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8305,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:8311,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:8390,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:!0},{name:"decayRate",description:"<p>Percentage of decay with each echo.\n Min: 0, Max: 100. Defaults to 2.</p>\n",type:"Number",optional:!0},{name:"reverse",description:"<p>Play the reverb backwards or forwards.</p>\n",type:"Boolean",optional:!0}],class:"p5.Reverb",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8419,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:!0},{name:"decayRate",description:"<p>Percentage of decay with each echo.\n Min: 0, Max: 100. Defaults to 2.</p>\n",type:"Number",optional:!0},{name:"reverse",description:"<p>Play the reverb backwards or forwards.</p>\n",type:"Boolean",optional:!0}],class:"p5.Reverb",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8447,description:"<p>Set the output level of the reverb 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:!0},{name:"timeFromNow",description:"<p>schedule this event to happen\n seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.Reverb",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8456,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:8462,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:8467,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:8556,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:"convolverNod",type:"ConvolverNode",class:"p5.Convolver",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8581,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:!0},{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:!0}],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:8631,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:8697,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:8729,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",class:"p5.Convolver",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8737,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:8755,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:8773,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:8817,class:"p5.Convolver",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8842,class:"p5.Convolver",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9059,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:9148,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:9236,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:!0}],class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9246,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:9255,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:!0}],class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9271,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:!0}],class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9288,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:9300,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:!0}],class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9310,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:9322,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:9343,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:9357,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:9371,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:9399,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:9452,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:9461,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:9471,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:9479,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:9488,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:9513,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:9567,
description:'<p>The p5.Compressor is built with a <a href="https://www.w3.org/TR/webaudio/#the-dynamicscompressornode-interface" \n target="_blank" title="W3 spec for Dynamics Compressor Node">Web Audio Dynamics Compressor Node\n </a></p>\n',itemtype:"property",name:"compressor",type:"WebAudioNode",class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9578,description:"<p>Performs the same function as .connect, but also accepts\noptional parameters to set compressor&#39;s audioParams</p>\n",itemtype:"method",name:"process",params:[{name:"src",description:"<p>Sound source to be connected</p>\n",type:"Object"},{name:"attack",description:"<p>The amount of time (in seconds) to reduce the gain by 10dB,\n default = .003, range 0 - 1</p>\n",type:"Number",optional:!0},{name:"knee",description:"<p>A decibel value representing the range above the \n threshold where the curve smoothly transitions to the &quot;ratio&quot; portion.\n default = 30, range 0 - 40</p>\n",type:"Number",optional:!0},{name:"ratio",description:"<p>The amount of dB change in input for a 1 dB change in output\n default = 12, range 1 - 20</p>\n",type:"Number",optional:!0},{name:"threshold",description:"<p>The decibel value above which the compression will start taking effect\n default = -24, range -100 - 0</p>\n",type:"Number",optional:!0},{name:"release",description:"<p>The amount of time (in seconds) to increase the gain by 10dB\n default = .25, range 0 - 1</p>\n",type:"Number",optional:!0}],class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9601,description:"<p>Set the paramters of a compressor.</p>\n",itemtype:"method",name:"set",params:[{name:"attack",description:"<p>The amount of time (in seconds) to reduce the gain by 10dB,\n default = .003, range 0 - 1</p>\n",type:"Number"},{name:"knee",description:"<p>A decibel value representing the range above the \n threshold where the curve smoothly transitions to the &quot;ratio&quot; portion.\n default = 30, range 0 - 40</p>\n",type:"Number"},{name:"ratio",description:"<p>The amount of dB change in input for a 1 dB change in output\n default = 12, range 1 - 20</p>\n",type:"Number"},{name:"threshold",description:"<p>The decibel value above which the compression will start taking effect\n default = -24, range -100 - 0</p>\n",type:"Number"},{name:"release",description:"<p>The amount of time (in seconds) to increase the gain by 10dB\n default = .25, range 0 - 1</p>\n",type:"Number"}],class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9633,description:"<p>Get current attack or set value w/ time ramp</p>\n",itemtype:"method",name:"attack",params:[{name:"attack",description:"<p>Attack is the amount of time (in seconds) to reduce the gain by 10dB,\n default = .003, range 0 - 1</p>\n",type:"Number",optional:!0},{name:"time",description:"<p>Assign time value to schedule the change in value</p>\n",type:"Number",optional:!0}],class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9653,description:"<p>Get current knee or set value w/ time ramp</p>\n",itemtype:"method",name:"knee",params:[{name:"knee",description:"<p>A decibel value representing the range above the \n threshold where the curve smoothly transitions to the &quot;ratio&quot; portion.\n default = 30, range 0 - 40</p>\n",type:"Number",optional:!0},{name:"time",description:"<p>Assign time value to schedule the change in value</p>\n",type:"Number",optional:!0}],class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9673,description:"<p>Get current ratio or set value w/ time ramp</p>\n",itemtype:"method",name:"ratio",params:[{name:"ratio",description:"<p>The amount of dB change in input for a 1 dB change in output\n default = 12, range 1 - 20</p>\n",type:"Number",optional:!0},{name:"time",description:"<p>Assign time value to schedule the change in value</p>\n",type:"Number",optional:!0}],class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9692,description:"<p>Get current threshold or set value w/ time ramp</p>\n",itemtype:"method",name:"threshold",params:[{name:"threshold",description:"<p>The decibel value above which the compression will start taking effect\n default = -24, range -100 - 0</p>\n",type:"Number"},{name:"time",description:"<p>Assign time value to schedule the change in value</p>\n",type:"Number",optional:!0}],class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9711,description:"<p>Get current release or set value w/ time ramp</p>\n",itemtype:"method",name:"release",params:[{name:"release",description:"<p>The amount of time (in seconds) to increase the gain by 10dB\n default = .25, range 0 - 1</p>\n",type:"Number"},{name:"time",description:"<p>Assign time value to schedule the change in value</p>\n",type:"Number",optional:!0}],class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9731,description:"<p>Return the current reduction value</p>\n",return:{description:"Value of the amount of gain reduction that is applied to the signal",type:"Number"},class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9828,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:9841,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:!0}],class:"p5.SoundRecorder",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9862,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:!0},{name:"callback",description:"<p>The name of a function that will be\n called once the recording completes</p>\n",type:"Function",optional:!0}],class:"p5.SoundRecorder",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9895,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:9914,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:9968,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:10144,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:10157,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:10188,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:!0}],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:10334,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:10344,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:10354,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:10362,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:!0},{name:"timeFromNow",description:"<p>schedule this event to happen\n seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.Gain",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10443,description:'<p>The p5.Distortion is built with a\n<a href="http://www.w3.org/TR/webaudio/#WaveShaperNode">\nWeb Audio WaveShaper Node</a>.</p>\n',itemtype:"property",name:"WaveShaperNode",type:"AudioNode",class:"p5.Distortion",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10458,description:"<p>Process a sound source, optionally specify amount and oversample values.</p>\n",itemtype:"method",name:"process",params:[{name:"amount",description:"<p>Unbounded distortion amount.\n Normal values range from 0-1.</p>\n",type:"Number",optional:!0,optdefault:"0.25"},{name:"oversample",description:"<p>&#39;none&#39;, &#39;2x&#39;, or &#39;4x&#39;.</p>\n",type:"String",optional:!0,optdefault:"'none'"}],class:"p5.Distortion",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10470,description:"<p>Set the amount and oversample of the waveshaper distortion.</p>\n",itemtype:"method",name:"set",params:[{name:"amount",description:"<p>Unbounded distortion amount.\n Normal values range from 0-1.</p>\n",type:"Number",optional:!0,optdefault:"0.25"},{name:"oversample",description:"<p>&#39;none&#39;, &#39;2x&#39;, or &#39;4x&#39;.</p>\n",type:"String",optional:!0,optdefault:"'none'"}],class:"p5.Distortion",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10488,description:"<p>Return the distortion amount, typically between 0-1.</p>\n",itemtype:"method",name:"getAmount",return:{description:"Unbounded distortion amount.\n Normal values range from 0-1.",type:"Number"},class:"p5.Distortion",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10498,description:"<p>Return the oversampling.</p>\n",itemtype:"method",name:"getOversample",return:{description:"Oversample can either be 'none', '2x', or '4x'.",type:"String"},class:"p5.Distortion",module:"p5.sound",submodule:"p5.sound"}],warnings:[{message:"unknown tag: alt",line:" src/color/creating_reading.js:16"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:60"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:89"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:118"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:326"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:356"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:392"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:489"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:518"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:557"},{message:"unknown tag: alt",line:" src/color/p5.Color.js:447"},{message:"unknown tag: alt",line:" src/color/setting.js:15"},{message:"unknown tag: alt",line:" src/color/setting.js:178"},{message:"unknown tag: alt",line:" src/color/setting.js:235"},{message:"unknown tag: alt",line:" src/color/setting.js:373"},{message:"unknown tag: alt",line:" src/color/setting.js:489"},{message:"unknown tag: alt",line:" src/color/setting.js:514"},{message:"unknown tag: alt",line:" src/color/setting.js:581"},{message:"unknown tag: alt",line:" src/core/2d_primitives.js:16"},{message:"unknown tag: alt",line:" src/core/2d_primitives.js:132"},{message:"unknown tag: alt",line:" src/core/2d_primitives.js:187"},{message:"unknown tag: alt",line:" src/core/2d_primitives.js:262"},{message:"unknown tag: alt",line:" src/core/2d_primitives.js:313"},{message:"unknown tag: alt",line:" src/core/2d_primitives.js:393"},{message:"unknown tag: alt",line:" src/core/2d_primitives.js:477"},{message:"unknown tag: alt",line:" src/core/attributes.js:14"},{message:"unknown tag: alt",line:" src/core/attributes.js:80"},{message:"unknown tag: alt",line:" src/core/attributes.js:108"},{message:"unknown tag: alt",line:" src/core/attributes.js:174"},{message:"unknown tag: alt",line:" src/core/attributes.js:203"},{message:"unknown tag: alt",line:" src/core/attributes.js:237"},{message:"unknown tag: alt",line:" src/core/attributes.js:301"},{message:"unknown tag: alt",line:" src/core/constants.js:33"},{message:"unknown tag: alt",line:" src/core/constants.js:52"},{message:"unknown tag: alt",line:" src/core/constants.js:71"},{message:"unknown tag: alt",line:" src/core/constants.js:90"},{message:"unknown tag: alt",line:" src/core/constants.js:109"},{message:"unknown tag: alt",line:" src/core/core.js:49"},{message:"unknown tag: alt",line:" src/core/core.js:85"},{message:"unknown tag: alt",line:" src/core/core.js:116"},{message:"unknown tag: alt",line:" src/core/core.js:393"},{message:"unknown tag: alt",line:" src/core/curves.js:16"},{message:"unknown tag: alt",line:" src/core/curves.js:99"},{message:"unknown tag: alt",line:" src/core/curves.js:124"},{message:"unknown tag: alt",line:" src/core/curves.js:175"},{message:"unknown tag: alt",line:" src/core/curves.js:256"},{message:"unknown tag: alt",line:" src/core/curves.js:308"},{message:"unknown tag: alt",line:" src/core/curves.js:353"},{message:"unknown tag: alt",line:" src/core/curves.js:378"},{message:"unknown tag: alt",line:" src/core/curves.js:476"},{message:"unknown tag: alt",line:" src/core/environment.js:22"},{message:"unknown tag: alt",line:" src/core/environment.js:51"},{message:"unknown tag: alt",line:" src/core/environment.js:79"},{message:"unknown tag: alt",line:" src/core/environment.js:110"},{message:"unknown tag: alt",line:" src/core/environment.js:188"},{message:"unknown tag: alt",line:" src/core/environment.js:262"},{message:"unknown tag: alt",line:" src/core/environment.js:288"},{message:"unknown tag: alt",line:" src/core/environment.js:305"},{message:"unknown tag: alt",line:" src/core/environment.js:322"},{message:"unknown tag: alt",line:" src/core/environment.js:338"},{message:"unknown tag: alt",line:" src/core/environment.js:354"},{message:"unknown tag: alt",line:" src/core/environment.js:428"},{message:"replacing incorrect tag: returns with return",line:" src/core/environment.js:475"},{message:"unknown tag: alt",line:" src/core/environment.js:475"},{message:"replacing incorrect tag: returns with return",line:" src/core/environment.js:520"},{message:"unknown tag: alt",line:" src/core/environment.js:520"},{message:"unknown tag: alt",line:" src/core/environment.js:577"},{message:"unknown tag: alt",line:" src/core/environment.js:608"},{message:"unknown tag: alt",line:" src/core/environment.js:629"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:53"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:112"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:163"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:213"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:263"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:329"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:383"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:437"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:496"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:541"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:608"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:643"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:686"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:735"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:776"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:828"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:866"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:904"},{message:"unknown tag: alt",line:" src/core/rendering.js:14"},{message:"unknown tag: alt",line:" src/core/rendering.js:112"},{message:"unknown tag: alt",line:" src/core/rendering.js:162"},{message:"unknown tag: alt",line:" src/core/rendering.js:185"},{message:"unknown tag: alt",line:" src/core/rendering.js:223"},{message:"unknown tag: alt",line:" src/core/structure.js:15"},{message:"unknown tag: alt",line:" src/core/structure.js:77"},{message:"unknown tag: alt",line:" src/core/structure.js:119"},{message:"unknown tag: alt",line:" src/core/structure.js:194"},{message:"unknown tag: alt",line:" src/core/structure.js:266"},{message:"unknown tag: alt",line:" src/core/transform.js:15"},{message:"unknown tag: alt",line:" src/core/transform.js:137"},{message:"unknown tag: alt",line:" src/core/transform.js:163"},{message:"unknown tag: alt",line:" src/core/transform.js:263"},{message:"unknown tag: alt",line:" src/core/transform.js:345"},{message:"unknown tag: alt",line:" src/core/transform.js:386"},{message:"unknown tag: alt",line:" src/core/transform.js:427"},{message:"unknown tag: alt",line:" src/core/vertex.js:22"},{message:"unknown tag: alt",line:" src/core/vertex.js:70"},{message:"unknown tag: alt",line:" src/core/vertex.js:267"},{message:"unknown tag: alt",line:" src/core/vertex.js:332"},{message:"unknown tag: alt",line:" src/core/vertex.js:374"},{message:"unknown tag: alt",line:" src/core/vertex.js:434"},{message:"unknown tag: alt",line:" src/core/vertex.js:502"},{message:"unknown tag: alt",line:" src/core/vertex.js:579"},{message:"unknown tag: alt",line:" src/events/acceleration.js:91"},{message:"unknown tag: alt",line:" src/events/acceleration.js:125"},{message:"unknown tag: alt",line:" src/events/acceleration.js:158"},{message:"unknown tag: alt",line:" src/events/acceleration.js:194"},{message:"unknown tag: alt",line:" src/events/acceleration.js:237"},{message:"unknown tag: alt",line:" src/events/acceleration.js:280"},{message:"unknown tag: alt",line:" src/events/acceleration.js:372"},{message:"unknown tag: alt",line:" src/events/acceleration.js:403"},{message:"unknown tag: alt",line:" src/events/acceleration.js:462"},{message:"unknown tag: alt",line:" src/events/keyboard.js:18"},{message:"unknown tag: alt",line:" src/events/keyboard.js:46"},{message:"unknown tag: alt",line:" src/events/keyboard.js:75"},{message:"unknown tag: alt",line:" src/events/keyboard.js:108"},{message:"unknown tag: alt",line:" src/events/keyboard.js:198"},{message:"unknown tag: alt",line:" src/events/keyboard.js:254"},{message:"unknown tag: alt",line:" src/events/keyboard.js:317"},{message:"unknown tag: alt",line:" src/events/mouse.js:23"},{message:"unknown tag: alt",line:" src/events/mouse.js:49"},{message:"unknown tag: alt",line:" src/events/mouse.js:75"},{message:"unknown tag: alt",line:" src/events/mouse.js:107"},{message:"unknown tag: alt",line:" src/events/mouse.js:137"},{message:"unknown tag: alt",line:" src/events/mouse.js:175"},{message:"unknown tag: alt",line:" src/events/mouse.js:213"},{message:"unknown tag: alt",line:" src/events/mouse.js:255"},{message:"unknown tag: alt",line:" src/events/mouse.js:298"},{message:"unknown tag: alt",line:" src/events/mouse.js:334"},{message:"unknown tag: alt",line:" src/events/mouse.js:416"},{message:"unknown tag: alt",line:" src/events/mouse.js:460"},{message:"unknown tag: alt",line:" src/events/mouse.js:531"},{message:"unknown tag: alt",line:" src/events/mouse.js:597"},{message:"unknown tag: alt",line:" src/events/mouse.js:664"},{message:"unknown tag: alt",line:" src/events/mouse.js:723"},{message:"unknown tag: alt",line:" src/events/mouse.js:781"},{message:"unknown tag: alt",line:" src/events/touch.js:53"},{message:"unknown tag: alt",line:" src/events/touch.js:116"},{message:"unknown tag: alt",line:" src/events/touch.js:178"},{message:"unknown tag: alt",line:" src/image/image.js:24"},{message:"unknown tag: alt",line:" src/image/image.js:115"},{message:"unknown tag: alt",line:" src/image/image.js:233"},{message:"unknown tag: alt",line:" src/image/loading_displaying.js:17"},{message:"replacing incorrect tag: returns with return",line:" src/image/loading_displaying.js:107"},{message:"unknown tag: alt",line:" src/image/loading_displaying.js:125"},{message:"unknown tag: alt",line:" src/image/loading_displaying.js:325"},{message:"unknown tag: alt",line:" src/image/loading_displaying.js:384"},{message:"unknown tag: alt",line:" src/image/loading_displaying.js:449"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:45"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:72"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:106"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:186"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:236"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:270"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:315"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:353"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:435"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:480"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:543"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:577"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:684"},{message:"unknown tag: alt",line:" src/image/pixels.js:14"},{message:"unknown tag: alt",line:" src/image/pixels.js:83"},{message:"unknown tag: alt",line:" src/image/pixels.js:165"},{message:"unknown tag: alt",line:" src/image/pixels.js:212"},{message:"unknown tag: alt",line:" src/image/pixels.js:390"},{message:"unknown tag: alt",line:" src/image/pixels.js:461"},{message:"unknown tag: alt",line:" src/image/pixels.js:498"},{message:"unknown tag: alt",line:" src/image/pixels.js:572"},{message:"unknown tag: alt",line:" src/io/files.js:19"},{message:"unknown tag: alt",line:" src/io/files.js:145"},{message:"unknown tag: alt",line:" src/io/files.js:237"},{message:"unknown tag: alt",line:" src/io/files.js:558"},{message:"unknown tag: alt",line:" src/io/files.js:1194"},{message:"unknown tag: alt",line:" src/io/files.js:1248"},{message:"unknown tag: alt",line:" src/io/files.js:1306"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:58"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:121"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:170"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:215"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:263"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:329"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:498"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:551"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:593"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:757"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:826"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:875"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:937"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:984"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:1029"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:1077"},{message:"unknown tag: alt",line:" src/io/p5.XML.js:11"},{message:"unknown tag: alt",line:" src/math/calculation.js:12"},{message:"unknown tag: alt",line:" src/math/calculation.js:36"},{message:"unknown tag: alt",line:" src/math/calculation.js:76"},{message:"unknown tag: alt",line:" src/math/calculation.js:130"},{message:"unknown tag: alt",line:" src/math/calculation.js:184"},{message:"unknown tag: alt",line:" src/math/calculation.js:234"},{message:"unknown tag: alt",line:" src/math/calculation.js:273"},{message:"unknown tag: alt",line:" src/math/calculation.js:317"},{message:"unknown tag: alt",line:" src/math/calculation.js:371"},{message:"unknown tag: alt",line:" src/math/calculation.js:409"},{message:"unknown tag: alt",line:" src/math/calculation.js:464"},{message:"unknown tag: alt",line:" src/math/calculation.js:507"},{message:"unknown tag: alt",line:" src/math/calculation.js:550"},{message:"unknown tag: alt",line:" src/math/calculation.js:602"},{message:"unknown tag: alt",line:" src/math/calculation.js:636"},{message:"unknown tag: alt",line:" src/math/calculation.js:675"},{message:"unknown tag: alt",line:" src/math/calculation.js:720"},{message:"unknown tag: alt",line:" src/math/noise.js:41"},{message:"unknown tag: alt",line:" src/math/noise.js:171"},{message:"unknown tag: alt",line:" src/math/noise.js:233"},{message:"unknown tag: alt",line:" src/math/p5.Vector.js:13"},{message:"unknown tag: alt",line:" src/math/random.js:47"},{message:"unknown tag: alt",line:" src/math/random.js:78"},{message:"unknown tag: alt",line:" src/math/random.js:168"},{message:"unknown tag: alt",line:" src/math/trigonometry.js:134"},{message:"unknown tag: alt",line:" src/math/trigonometry.js:174"},{message:"unknown tag: alt",line:" src/math/trigonometry.js:206"},{message:"unknown tag: alt",line:" src/math/trigonometry.js:238"},{message:"unknown tag: alt",line:" src/math/trigonometry.js:320"},{message:"unknown tag: alt",line:" src/typography/attributes.js:13"},{message:"unknown tag: alt",line:" src/typography/attributes.js:63"},{message:"unknown tag: alt",line:" src/typography/attributes.js:100"},{message:"unknown tag: alt",line:" src/typography/attributes.js:133"},{message:"unknown tag: alt",line:" src/typography/attributes.js:158"},{message:"unknown tag: alt",line:" src/typography/loading_displaying.js:16"},{message:"unknown tag: alt",line:" src/typography/loading_displaying.js:135"},{message:"unknown tag: alt",line:" src/typography/loading_displaying.js:197"},{message:"unknown tag: alt",line:" src/typography/p5.Font.js:47"},{message:"unknown tag: alt",line:" src/utilities/conversion.js:12"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:15"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:44"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:146"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:257"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:339"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:404"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:454"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:550"},{message:"unknown tag: alt",line:" src/utilities/time_date.js:12"},{message:"unknown tag: alt",line:" src/utilities/time_date.js:34"},{message:"unknown tag: alt",line:" src/utilities/time_date.js:56"},{message:"unknown tag: alt",line:" src/utilities/time_date.js:78"},{message:"unknown tag: alt",line:" src/utilities/time_date.js:101"},{message:"unknown tag: alt",line:" src/utilities/time_date.js:123"},{message:"unknown tag: alt",line:" src/utilities/time_date.js:145"},{message:"unknown tag: alt",line:" src/webgl/camera.js:12"},{message:"unknown tag: alt",line:" src/webgl/camera.js:160"},{message:"unknown tag: alt",line:" src/webgl/camera.js:232"},{message:"unknown tag: alt",line:" src/webgl/light.js:40"},{message:"unknown tag: alt",line:" src/webgl/light.js:89"},{message:"unknown tag: alt",line:" src/webgl/light.js:168"},{message:"unknown tag: alt",line:" src/webgl/loading.js:35"},{message:"unknown tag: alt",line:" src/webgl/loading.js:197"},{message:"unknown tag: alt",line:" src/webgl/material.js:81"},{message:"unknown tag: alt",line:" src/webgl/material.js:113"},{message:"unknown tag: alt",line:" src/webgl/material.js:210"},{message:"unknown tag: alt",line:" src/webgl/material.js:253"},{message:"unknown tag: alt",line:" src/webgl/p5.RendererGL.js:352"},{message:"unknown tag: alt",line:" src/webgl/p5.RendererGL.js:400"},{message:"unknown tag: alt",line:" src/webgl/p5.RendererGL.js:431"},{message:"unknown tag: alt",line:" src/webgl/p5.RendererGL.js:460"},{message:"unknown tag: alt",line:" src/webgl/p5.RendererGL.js:505"},{message:"unknown tag: alt",line:" src/webgl/primitives.js:13"},{message:"replacing incorrect tag: params with param",line:" lib/addons/p5.sound.js:1577"},{message:"replacing incorrect tag: returns with return",line:" lib/addons/p5.sound.js:1577"},{message:"replacing incorrect tag: returns with return",line:" lib/addons/p5.sound.js:8218"},{
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:118"},{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:149"},{message:"Missing item type\nCSS named colors.",line:" src/color/p5.Color.js:168"},{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:321"},{message:"Missing item type\nFull color string patterns. The capture groups are necessary.",line:" src/color/p5.Color.js:334"},{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:447"},{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:638"},{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:99"},{message:"Missing item type\nSets the resolution at which curves display.\n\nThe default value is 20.",line:" src/core/curves.js:353"},{message:"Missing item type\nReturns the current framerate.",line:" src/core/environment.js:238"},{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:247"},{message:"Missing item type",line:" src/core/error_helpers.js:1"},{message:"Missing item type\nPrints out a fancy, colorful message to the console log",line:" src/core/error_helpers.js:34"},{message:'Missing item type\nValidates parameters\nparam {String} func the name of the function\nparam {Array} args user input arguments\n\nexample:\n var a;\n ellipse(10,10,a,5);\nconsole ouput:\n "It looks like ellipse received an empty variable in spot #2."\n\nexample:\n ellipse(10,"foo",5,5);\nconsole output:\n "ellipse was expecting a number for parameter #1,\n received "foo" instead."',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:273"},{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/core/init.js:5"},{message:"Missing item type\nHelper fxn for sharing pixel methods",line:" src/core/p5.Element.js:1031"},{message:"Missing item type\nResize our canvas element.",line:" src/core/p5.Renderer.js:72"},{message:"Missing item type\nHelper fxn to check font type (system or otf)",line:" src/core/p5.Renderer.js:146"},{message:"Missing item type\nHelper fxn to measure ascent and descent.\nAdapted from http://stackoverflow.com/a/25355178",line:" src/core/p5.Renderer.js:202"},{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\nprivate helper function to handle the user passing objects in\nduring construction or calls to create()",line:" src/data/p5.TypedDict.js:179"},{message:"Missing item type\nprivate helper function to ensure that the user passed in valid\nvalues for the Dictionary type",line:" src/data/p5.TypedDict.js:321"},{message:"Missing item type\nprivate helper function to ensure that the user passed in valid\nvalues for the Dictionary type",line:" src/data/p5.TypedDict.js:368"},{message:"Missing item type\nprivate helper function for finding lowest or highest value\nthe argument 'flip' is used to flip the comparison arrow\nfrom 'less than' to 'greater than'",line:" src/data/p5.TypedDict.js:485"},{message:"Missing item type\nprivate helper function for finding lowest or highest key\nthe argument 'flip' is used to flip the comparison arrow\nfrom 'less than' to 'greater than'",line:" src/data/p5.TypedDict.js:548"},{message:"Missing item type\n_updatePAccelerations updates the pAcceleration values",line:" src/events/acceleration.js:80"},{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:307"},{message:"Missing item type\nThe checkDownKeys function returns a boolean true if any keys pressed\nand a false if no keys are currently pressed.\n\nHelps avoid instances where a multiple keys are pressed simultaneously and\nreleasing a single key will then switch the\nkeyIsPressed property to true.",line:" src/events/keyboard.js:364"},{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:167"},{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:202"},{message:"Missing item type\nSets the alpha channel to entirely opaque. No parameter is used.",line:" src/image/filters.js:224"},{message:"Missing item type\nSets each pixel to its inverse value. No parameter is used.",line:" src/image/filters.js:239"},{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:255"},{message:"Missing item type\nreduces the bright areas in an image",line:" src/image/filters.js:286"},{message:"Missing item type\nincreases the bright areas in an image",line:" src/image/filters.js:367"},{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:107"},{message:"Missing item type\nApply the current tint color to the input image, return the resulting\ncanvas.",line:" src/image/loading_displaying.js:413"},{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:177"},{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:1433"},{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:1456"},{message:"Missing item type\nReturns a file extension, or another string\nif the provided parameter has no extension.",line:" src/io/files.js:1496"},{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:1528"},{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:1540"},{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:644"},{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:767"},{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:784"},{message:"Missing item type\nMultiplies a vector by a scalar and returns a new vector.",line:" src/math/p5.Vector.js:963"},{message:"Missing item type\nDivides a vector by a scalar and returns a new vector.",line:" src/math/p5.Vector.js:990"},{message:"Missing item type\nCalculates the dot product of two vectors.",line:" src/math/p5.Vector.js:1018"},{message:"Missing item type\nCalculates the cross product of two vectors.",line:" src/math/p5.Vector.js:1032"},{message:"Missing item type\nCalculates the Euclidean distance between two points (considering a\npoint as a vector object).",line:" src/math/p5.Vector.js:1046"},{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:1061"},{message:"Missing item type\nHelper function to measure ascent and descent.",line:" src/typography/attributes.js:248"},{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:206"},{message:"Missing item type\nReturns an opentype path for the supplied string and position.",line:" src/typography/p5.Font.js:221"},{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:98"},{message:"Missing item type",line:" src/webgl/material.js:297"},{message:"Missing item type\ncomputes smooth normals per vertex as an average of each\nface.",line:" src/webgl/p5.Geometry.js:86"},{message:"Missing item type\nAverages the vertex normals. Used in curved\nsurfaces",line:" src/webgl/p5.Geometry.js:111"},{message:"Missing item type\nAverages pole normals. Used in spherical primitives",line:" src/webgl/p5.Geometry.js:130"},{message:"Missing item type\nCreate a 2D array for establishing stroke connections",line:" src/webgl/p5.Geometry.js:161"},{message:"Missing item type\nCreate 4 vertices for each stroke line, two at the beginning position\nand two at the end position. These vertices are displaced relative to\nthat line's normal on the GPU",line:" src/webgl/p5.Geometry.js:182"},{message:"Missing item type\nModifies all vertices to be centered within the range -100 to 100.",line:" src/webgl/p5.Geometry.js:209"},{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:75"},{message:"Missing item type\nGets a copy of the vector, returns a p5.Matrix object.",line:" src/webgl/p5.Matrix.js:113"},{message:"Missing item type\nreturn a copy of a matrix",line:" src/webgl/p5.Matrix.js:122"},{message:"Missing item type\nreturn an identity matrix",line:" src/webgl/p5.Matrix.js:147"},{message:"Missing item type\ntranspose according to a given matrix",line:" src/webgl/p5.Matrix.js:155"},{message:"Missing item type\ninvert matrix according to a give matrix",line:" src/webgl/p5.Matrix.js:215"},{message:"Missing item type\nInverts a 3x3 matrix",line:" src/webgl/p5.Matrix.js:300"},{message:"Missing item type\ntransposes a 3x3 p5.Matrix by a mat3",line:" src/webgl/p5.Matrix.js:336"},{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:352"},{message:"Missing item type\ninspired by Toji's mat4 determinant",line:" src/webgl/p5.Matrix.js:380"},{message:"Missing item type\nmultiply two mat4s",line:" src/webgl/p5.Matrix.js:403"},{message:"Missing item type\nscales a p5.Matrix by scalars or a vector",line:" src/webgl/p5.Matrix.js:460"},{message:"Missing item type\nrotate our Matrix around an axis by the given angle.",line:" src/webgl/p5.Matrix.js:505"},{message:"Missing item type",line:" src/webgl/p5.Matrix.js:584"},{message:"Missing item type\nsets the perspective matrix",line:" src/webgl/p5.Matrix.js:614"},{message:"Missing item type\nsets the ortho matrix",line:" src/webgl/p5.Matrix.js:648"},{message:"Missing item type\nPRIVATE",line:" src/webgl/p5.Matrix.js:683"},{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:60"},{message:"Missing item type\nEnd shape drawing and render vertices to screen.",line:" src/webgl/p5.RendererGL.Immediate.js:103"},{message:"Missing item type\ninitializes buffer defaults. runs each time a new geometry is\nregistered",line:" src/webgl/p5.RendererGL.Retained.js:8"},{message:"Missing item type\ncreateBuffers description",line:" src/webgl/p5.RendererGL.Retained.js:33"},{message:"Missing item type\nDraws buffers given a geometry key ID",line:" src/webgl/p5.RendererGL.Retained.js:84"},{message:"Missing item type\nmodel view, projection, & normal\nmatrices",line:" src/webgl/p5.RendererGL.js:69"},{message:"Missing item type\n[background description]",line:" src/webgl/p5.RendererGL.js:331"},{message:"Missing item type\n[resize description]",line:" src/webgl/p5.RendererGL.js:642"},{message:"Missing item type\nclears color and depth buffers\nwith r,g,b,a",line:" src/webgl/p5.RendererGL.js:659"},{message:"Missing item type\n[translate description]",line:" src/webgl/p5.RendererGL.js:675"},{message:"Missing item type\nScales the Model View Matrix by a vector",line:" src/webgl/p5.RendererGL.js:693"},{message:"Missing item type\npushes a copy of the model view matrix onto the\nMV Matrix stack.",line:" src/webgl/p5.RendererGL.js:725"},{message:"Missing item type\n[pop description]",line:" src/webgl/p5.RendererGL.js:734"},{message:"Missing item type\nturn a two dimensional array into one dimensional array",line:" src/webgl/p5.RendererGL.js:904"},{message:"Missing item type\nturn a p5.Vector Array into a one dimensional number array",line:" src/webgl/p5.RendererGL.js:918"},{message:"Missing item type",line:" src/webgl/primitives.js:265"},{message:"Missing item type\nDraw a line given two points",line:" src/webgl/primitives.js:860"},{message:"Missing item type\nHelper function for select and selectAll",line:" lib/addons/p5.dom.js:156"},{message:"Missing item type\nHelper function for getElement and getElements.",line:" lib/addons/p5.dom.js:172"},{message:"Missing item type\nHelpers for create methods.",line:" lib/addons/p5.dom.js:225"},{message:"Missing item type",line:" lib/addons/p5.dom.js:369"},{message:"Missing item type",line:" lib/addons/p5.dom.js:874"},{message:"Missing item type",line:" lib/addons/p5.dom.js:937"},{message:"Missing item type",line:" lib/addons/p5.dom.js:965"},{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:1223"},{message:"Missing item type",line:" lib/addons/p5.dom.js:2259"},{message:"Missing item type",line:" lib/addons/p5.dom.js:2329"},{message:"Missing item type",line:" lib/addons/p5.dom.js:2351"},{message:"Missing item type\np5.sound \nhttps://p5js.org/reference/#/libraries/p5.sound\n\nFrom the Processing Foundation and contributors\nhttps://github.com/processing/p5.js-sound/graphs/contributors\n\nMIT License (MIT)\nhttps://github.com/processing/p5.js-sound/blob/master/LICENSE\n\nSome of the many audio libraries & resources that inspire p5.sound:\n - TONE.js (c) Yotam Mann. Licensed under The MIT License (MIT). https://github.com/TONEnoTONE/Tone.js\n - buzz.js (c) Jay Salvat. 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:46"},{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:226"},{message:"Missing item type\nMaster contains AudioContext and the master sound output.",line:" lib/addons/p5.sound.js:296"},{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:393"},{message:"Missing item type\nReturns the closest MIDI note value for\na given frequency.",line:" lib/addons/p5.sound.js:425"},{message:"Missing item type\nUsed by Osc and Env to chain signal math",line:" lib/addons/p5.sound.js:584"},{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:917"},{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:1233"},{message:"Missing item type\nReturns 'true' if a p5.SoundFile is currently looping and playing, 'false' if not.",line:" lib/addons/p5.sound.js:1253"},{message:"Missing item type\nStop playback on all of this soundfile's sources.",line:" lib/addons/p5.sound.js:1311"},{message:"Missing item type\nReturns the current stereo pan position (-1.0 to 1.0)",line:" lib/addons/p5.sound.js:1413"},{message:"Missing item type",line:" lib/addons/p5.sound.js:1746"},{message:"Missing item type\nReplace the current Audio Buffer with a new Buffer.",line:" lib/addons/p5.sound.js:1764"},{message:"Missing item type",line:" lib/addons/p5.sound.js:2026"},{message:"Missing item type",line:" lib/addons/p5.sound.js:3024"},{message:"Missing item type",line:" lib/addons/p5.sound.js:3427"},{message:"Missing item type",line:" lib/addons/p5.sound.js:3448"},{message:"Missing item type",line:" lib/addons/p5.sound.js:3507"},{message:"Missing item type",line:" lib/addons/p5.sound.js:3960"},{message:"Missing item type",line:" lib/addons/p5.sound.js:4097"},{message:"Missing item type",line:" lib/addons/p5.sound.js:4130"},{message:"Missing item type",line:" lib/addons/p5.sound.js:4176"},{message:"Missing item type",line:" lib/addons/p5.sound.js:4197"},{message:"Missing item type",line:" lib/addons/p5.sound.js:4217"},{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:4330"},{message:"Missing item type",line:" lib/addons/p5.sound.js:4923"},{message:"Missing item type",line:" lib/addons/p5.sound.js:5109"},{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:6393"},{message:"Missing item type\nAdd input sources to the list of available sources.",line:" lib/addons/p5.sound.js:6634"},{message:"Missing item type",line:" lib/addons/p5.sound.js:6763"},{message:"Missing item type",line:" lib/addons/p5.sound.js:6779"},{message:"Missing item type",line:" lib/addons/p5.sound.js:6803"},{message:"Missing item type",line:" lib/addons/p5.sound.js:6829"},{message:"Missing item type",line:" lib/addons/p5.sound.js:6858"},{message:"Missing item type",line:" lib/addons/p5.sound.js:6888"},{message:"Missing item type",line:" lib/addons/p5.sound.js:6936"},{message:"Missing item type",line:" lib/addons/p5.sound.js:6959"},{message:"Missing item type",line:" lib/addons/p5.sound.js:6984"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7005"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7012"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7034"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7063"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7090"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7118"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7146"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7192"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7223"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7241"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7629"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7651"},{message:"Missing item type\nThe p5.Effect class is built\n using Tone.js CrossFade",line:" lib/addons/p5.sound.js:7721"},{message:"Missing item type\nIn classes that extend\np5.Effect, connect effect nodes\nto the wet parameter",line:" lib/addons/p5.sound.js:7727"},{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:8467"},{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:8631"},{message:"Missing item type",line:" lib/addons/p5.sound.js:8817"},{message:"Missing item type",line:" lib/addons/p5.sound.js:8842"},{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:9059"},{message:"Missing item type\nSet the tempo for all parts in the score",line:" lib/addons/p5.sound.js:9513"},{message:"Missing item type\nReturn the current reduction value",line:" lib/addons/p5.sound.js:9731"},{message:"Missing item type\ncallback invoked when the recording is over",line:" lib/addons/p5.sound.js:9828"},{message:"Missing item type\ninternal method called on audio process",line:" lib/addons/p5.sound.js:9914"}]}},{}],2:[function(a,b,c){!function(a){"use strict";function b(a){var b=a.charCodeAt(0);return b===f||b===k?62:b===g||b===l?63:b<h?-1:b<h+10?b-h+26+26:b<j+26?b-j:b<i+26?b-i+26:void 0}function c(a){function c(a){j[l++]=a}var d,f,g,h,i,j;if(a.length%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var k=a.length;i="="===a.charAt(k-2)?2:"="===a.charAt(k-1)?1:0,j=new e(3*a.length/4-i),g=i>0?a.length-4:a.length;var l=0;for(d=0,f=0;d<g;d+=4,f+=3)h=b(a.charAt(d))<<18|b(a.charAt(d+1))<<12|b(a.charAt(d+2))<<6|b(a.charAt(d+3)),c((16711680&h)>>16),c((65280&h)>>8),c(255&h);return 2===i?(h=b(a.charAt(d))<<2|b(a.charAt(d+1))>>4,c(255&h)):1===i&&(h=b(a.charAt(d))<<10|b(a.charAt(d+1))<<4|b(a.charAt(d+2))>>2,c(h>>8&255),c(255&h)),j}function d(a){function b(a){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(a)}function c(a){return b(a>>18&63)+b(a>>12&63)+b(a>>6&63)+b(63&a)}var d,e,f,g=a.length%3,h="";for(d=0,f=a.length-g;d<f;d+=3)e=(a[d]<<16)+(a[d+1]<<8)+a[d+2],h+=c(e);switch(g){case 1:e=a[a.length-1],h+=b(e>>2),h+=b(e<<4&63),h+="==";break;case 2:e=(a[a.length-2]<<8)+a[a.length-1],h+=b(e>>10),h+=b(e>>4&63),h+=b(e<<2&63),h+="="}return h}
var e="undefined"!=typeof Uint8Array?Uint8Array:Array,f="+".charCodeAt(0),g="/".charCodeAt(0),h="0".charCodeAt(0),i="a".charCodeAt(0),j="A".charCodeAt(0),k="-".charCodeAt(0),l="_".charCodeAt(0);a.toByteArray=c,a.fromByteArray=d}(void 0===c?this.base64js={}:c)},{}],3:[function(a,b,c){},{}],4:[function(a,b,c){(function(b){"use strict";function d(){function a(){}try{var b=new Uint8Array(1);return b.foo=function(){return 42},b.constructor=a,42===b.foo()&&b.constructor===a&&"function"==typeof b.subarray&&0===b.subarray(1,1).byteLength}catch(a){return!1}}function e(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(a){return this instanceof f?(f.TYPED_ARRAY_SUPPORT||(this.length=0,this.parent=void 0),"number"==typeof a?g(this,a):"string"==typeof a?h(this,a,arguments.length>1?arguments[1]:"utf8"):i(this,a)):arguments.length>1?new f(a,arguments[1]):new f(a)}function g(a,b){if(a=p(a,b<0?0:0|q(b)),!f.TYPED_ARRAY_SUPPORT)for(var c=0;c<b;c++)a[c]=0;return a}function h(a,b,c){return"string"==typeof c&&""!==c||(c="utf8"),a=p(a,0|s(b,c)),a.write(b,c),a}function i(a,b){if(f.isBuffer(b))return j(a,b);if(Y(b))return k(a,b);if(null==b)throw new TypeError("must start with number, buffer, array or string");if("undefined"!=typeof ArrayBuffer){if(b.buffer instanceof ArrayBuffer)return l(a,b);if(b instanceof ArrayBuffer)return m(a,b)}return b.length?n(a,b):o(a,b)}function j(a,b){var c=0|q(b.length);return a=p(a,c),b.copy(a,0,0,c),a}function k(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;d<c;d+=1)a[d]=255&b[d];return a}function l(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;d<c;d+=1)a[d]=255&b[d];return a}function m(a,b){return f.TYPED_ARRAY_SUPPORT?(b.byteLength,a=f._augment(new Uint8Array(b))):a=l(a,new Uint8Array(b)),a}function n(a,b){var c=0|q(b.length);a=p(a,c);for(var d=0;d<c;d+=1)a[d]=255&b[d];return a}function o(a,b){var c,d=0;"Buffer"===b.type&&Y(b.data)&&(c=b.data,d=0|q(c.length)),a=p(a,d);for(var e=0;e<d;e+=1)a[e]=255&c[e];return a}function p(a,b){return f.TYPED_ARRAY_SUPPORT?(a=f._augment(new Uint8Array(b)),a.__proto__=f.prototype):(a.length=b,a._isBuffer=!0),0!==b&&b<=f.poolSize>>>1&&(a.parent=Z),a}function q(a){if(a>=e())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+e().toString(16)+" bytes");return 0|a}function r(a,b){if(!(this instanceof r))return new r(a,b);var c=new f(a,b);return delete c.parent,c}function s(a,b){"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"binary":case"raw":case"raws":return c;case"utf8":case"utf-8":return R(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return U(a).length;default:if(d)return R(a).length;b=(""+b).toLowerCase(),d=!0}}function t(a,b,c){var d=!1;if(b|=0,c=void 0===c||c===1/0?this.length:0|c,a||(a="utf8"),b<0&&(b=0),c>this.length&&(c=this.length),c<=b)return"";for(;;)switch(a){case"hex":return F(this,b,c);case"utf8":case"utf-8":return B(this,b,c);case"ascii":return D(this,b,c);case"binary":return E(this,b,c);case"base64":return A(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return G(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function u(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d))>e&&(d=e):d=e;var f=b.length;if(f%2!=0)throw new Error("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;g<d;g++){var h=parseInt(b.substr(2*g,2),16);if(isNaN(h))throw new Error("Invalid hex string");a[c+g]=h}return g}function v(a,b,c,d){return V(R(b,a.length-c),a,c,d)}function w(a,b,c,d){return V(S(b),a,c,d)}function x(a,b,c,d){return w(a,b,c,d)}function y(a,b,c,d){return V(U(b),a,c,d)}function z(a,b,c,d){return V(T(b,a.length-c),a,c,d)}function A(a,b,c){return 0===b&&c===a.length?W.fromByteArray(a):W.fromByteArray(a.slice(b,c))}function B(a,b,c){c=Math.min(a.length,c);for(var d=[],e=b;e<c;){var f=a[e],g=null,h=f>239?4:f>223?3:f>191?2:1;if(e+h<=c){var i,j,k,l;switch(h){case 1:f<128&&(g=f);break;case 2:i=a[e+1],128==(192&i)&&(l=(31&f)<<6|63&i)>127&&(g=l);break;case 3:i=a[e+1],j=a[e+2],128==(192&i)&&128==(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j)>2047&&(l<55296||l>57343)&&(g=l);break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128==(192&i)&&128==(192&j)&&128==(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k)>65535&&l<1114112&&(g=l)}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return C(d)}function C(a){var b=a.length;if(b<=$)return String.fromCharCode.apply(String,a);for(var c="",d=0;d<b;)c+=String.fromCharCode.apply(String,a.slice(d,d+=$));return c}function D(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;e<c;e++)d+=String.fromCharCode(127&a[e]);return d}function E(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;e<c;e++)d+=String.fromCharCode(a[e]);return d}function F(a,b,c){var d=a.length;(!b||b<0)&&(b=0),(!c||c<0||c>d)&&(c=d);for(var e="",f=b;f<c;f++)e+=Q(a[f]);return e}function G(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function H(a,b,c){if(a%1!=0||a<0)throw new RangeError("offset is not uint");if(a+b>c)throw new RangeError("Trying to access beyond buffer length")}function I(a,b,c,d,e,g){if(!f.isBuffer(a))throw new TypeError("buffer must be a Buffer instance");if(b>e||b<g)throw new RangeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range")}function J(a,b,c,d){b<0&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);e<f;e++)a[c+e]=(b&255<<8*(d?e:1-e))>>>8*(d?e:1-e)}function K(a,b,c,d){b<0&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);e<f;e++)a[c+e]=b>>>8*(d?e:3-e)&255}function L(a,b,c,d,e,f){if(b>e||b<f)throw new RangeError("value is out of bounds");if(c+d>a.length)throw new RangeError("index out of range");if(c<0)throw new RangeError("index out of range")}function M(a,b,c,d,e){return e||L(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),X.write(a,b,c,d,23,4),c+4}function N(a,b,c,d,e){return e||L(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),X.write(a,b,c,d,52,8),c+8}function O(a){if(a=P(a).replace(aa,""),a.length<2)return"";for(;a.length%4!=0;)a+="=";return a}function P(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function Q(a){return a<16?"0"+a.toString(16):a.toString(16)}function R(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;g<d;g++){if((c=a.charCodeAt(g))>55295&&c<57344){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(c<56320){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=65536+(e-55296<<10|c-56320)}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,c<128){if((b-=1)<0)break;f.push(c)}else if(c<2048){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(c<65536){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(c<1114112))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function S(a){for(var b=[],c=0;c<a.length;c++)b.push(255&a.charCodeAt(c));return b}function T(a,b){for(var c,d,e,f=[],g=0;g<a.length&&!((b-=2)<0);g++)c=a.charCodeAt(g),d=c>>8,e=c%256,f.push(e),f.push(d);return f}function U(a){return W.toByteArray(O(a))}function V(a,b,c,d){for(var e=0;e<d&&!(e+c>=b.length||e>=a.length);e++)b[e+c]=a[e];return e}var W=a("base64-js"),X=a("ieee754"),Y=a("isarray");c.Buffer=f,c.SlowBuffer=r,c.INSPECT_MAX_BYTES=50,f.poolSize=8192;var Z={};f.TYPED_ARRAY_SUPPORT=void 0!==b.TYPED_ARRAY_SUPPORT?b.TYPED_ARRAY_SUPPORT:d(),f.TYPED_ARRAY_SUPPORT?(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array):(f.prototype.length=void 0,f.prototype.parent=void 0),f.isBuffer=function(a){return!(null==a||!a._isBuffer)},f.compare=function(a,b){if(!f.isBuffer(a)||!f.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,e=0,g=Math.min(c,d);e<g&&a[e]===b[e];)++e;return e!==g&&(c=a[e],d=b[e]),c<d?-1:d<c?1:0},f.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(a,b){if(!Y(a))throw new TypeError("list argument must be an Array of Buffers.");if(0===a.length)return new f(0);var c;if(void 0===b)for(b=0,c=0;c<a.length;c++)b+=a[c].length;var d=new f(b),e=0;for(c=0;c<a.length;c++){var g=a[c];g.copy(d,e),e+=g.length}return d},f.byteLength=s,f.prototype.toString=function(){var a=0|this.length;return 0===a?"":0===arguments.length?B(this,0,a):t.apply(this,arguments)},f.prototype.equals=function(a){if(!f.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a||0===f.compare(this,a)},f.prototype.inspect=function(){var a="",b=c.INSPECT_MAX_BYTES;return this.length>0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),"<Buffer "+a+">"},f.prototype.compare=function(a){if(!f.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?0:f.compare(this,a)},f.prototype.indexOf=function(a,b){function c(a,b,c){for(var d=-1,e=0;c+e<a.length;e++)if(a[c+e]===b[d===-1?0:e-d]){if(d===-1&&(d=e),e-d+1===b.length)return c+d}else d=-1;return-1}if(b>2147483647?b=2147483647:b<-2147483648&&(b=-2147483648),b>>=0,0===this.length)return-1;if(b>=this.length)return-1;if(b<0&&(b=Math.max(this.length+b,0)),"string"==typeof a)return 0===a.length?-1:String.prototype.indexOf.call(this,a,b);if(f.isBuffer(a))return c(this,a,b);if("number"==typeof a)return f.TYPED_ARRAY_SUPPORT&&"function"===Uint8Array.prototype.indexOf?Uint8Array.prototype.indexOf.call(this,a,b):c(this,[a],b);throw new TypeError("val must be string, number or Buffer")},f.prototype.get=function(a){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(a)},f.prototype.set=function(a,b){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(a,b)},f.prototype.write=function(a,b,c,d){if(void 0===b)d="utf8",c=this.length,b=0;else if(void 0===c&&"string"==typeof b)d=b,c=this.length,b=0;else if(isFinite(b))b|=0,isFinite(c)?(c|=0,void 0===d&&(d="utf8")):(d=c,c=void 0);else{var e=d;d=b,b=0|c,c=e}var f=this.length-b;if((void 0===c||c>f)&&(c=f),a.length>0&&(c<0||b<0)||b>this.length)throw new RangeError("attempt to write outside buffer bounds");d||(d="utf8");for(var g=!1;;)switch(d){case"hex":return u(this,a,b,c);case"utf8":case"utf-8":return v(this,a,b,c);case"ascii":return w(this,a,b,c);case"binary":return x(this,a,b,c);case"base64":return y(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return z(this,a,b,c);default:if(g)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),g=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var $=4096;f.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,a<0?(a+=c)<0&&(a=0):a>c&&(a=c),b<0?(b+=c)<0&&(b=0):b>c&&(b=c),b<a&&(b=a);var d;if(f.TYPED_ARRAY_SUPPORT)d=f._augment(this.subarray(a,b));else{var e=b-a;d=new f(e,void 0);for(var g=0;g<e;g++)d[g]=this[g+a]}return d.length&&(d.parent=this.parent||this),d},f.prototype.readUIntLE=function(a,b,c){a|=0,b|=0,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return d},f.prototype.readUIntBE=function(a,b,c){a|=0,b|=0,c||H(a,b,this.length);for(var d=this[a+--b],e=1;b>0&&(e*=256);)d+=this[a+--b]*e;return d},f.prototype.readUInt8=function(a,b){return b||H(a,1,this.length),this[a]},f.prototype.readUInt16LE=function(a,b){return b||H(a,2,this.length),this[a]|this[a+1]<<8},f.prototype.readUInt16BE=function(a,b){return b||H(a,2,this.length),this[a]<<8|this[a+1]},f.prototype.readUInt32LE=function(a,b){return b||H(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},f.prototype.readUInt32BE=function(a,b){return b||H(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},f.prototype.readIntLE=function(a,b,c){a|=0,b|=0,c||H(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return e*=128,d>=e&&(d-=Math.pow(2,8*b)),d},f.prototype.readIntBE=function(a,b,c){a|=0,b|=0,c||H(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},f.prototype.readInt8=function(a,b){return b||H(a,1,this.length),128&this[a]?(255-this[a]+1)*-1:this[a]},f.prototype.readInt16LE=function(a,b){b||H(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt16BE=function(a,b){b||H(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},f.prototype.readInt32LE=function(a,b){return b||H(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},f.prototype.readInt32BE=function(a,b){return b||H(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},f.prototype.readFloatLE=function(a,b){return b||H(a,4,this.length),X.read(this,a,!0,23,4)},f.prototype.readFloatBE=function(a,b){return b||H(a,4,this.length),X.read(this,a,!1,23,4)},f.prototype.readDoubleLE=function(a,b){return b||H(a,8,this.length),X.read(this,a,!0,52,8)},f.prototype.readDoubleBE=function(a,b){return b||H(a,8,this.length),X.read(this,a,!1,52,8)},f.prototype.writeUIntLE=function(a,b,c,d){a=+a,b|=0,c|=0,d||I(this,a,b,c,Math.pow(2,8*c),0);var e=1,f=0;for(this[b]=255&a;++f<c&&(e*=256);)this[b+f]=a/e&255;return b+c},f.prototype.writeUIntBE=function(a,b,c,d){a=+a,b|=0,c|=0,d||I(this,a,b,c,Math.pow(2,8*c),0);var e=c-1,f=1;for(this[b+e]=255&a;--e>=0&&(f*=256);)this[b+e]=a/f&255;return b+c},f.prototype.writeUInt8=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,1,255,0),f.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),this[b]=255&a,b+1},f.prototype.writeUInt16LE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):J(this,a,b,!0),b+2},f.prototype.writeUInt16BE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):J(this,a,b,!1),b+2},f.prototype.writeUInt32LE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=255&a):K(this,a,b,!0),b+4},f.prototype.writeUInt32BE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):K(this,a,b,!1),b+4},f.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b|=0,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=0,g=1,h=a<0?1:0;for(this[b]=255&a;++f<c&&(g*=256);)this[b+f]=(a/g>>0)-h&255;return b+c},f.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b|=0,!d){var e=Math.pow(2,8*c-1);I(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=a<0?1:0;for(this[b+f]=255&a;--f>=0&&(g*=256);)this[b+f]=(a/g>>0)-h&255;return b+c},f.prototype.writeInt8=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,1,127,-128),f.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),a<0&&(a=255+a+1),this[b]=255&a,b+1},f.prototype.writeInt16LE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):J(this,a,b,!0),b+2},f.prototype.writeInt16BE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):J(this,a,b,!1),b+2},f.prototype.writeInt32LE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):K(this,a,b,!0),b+4},f.prototype.writeInt32BE=function(a,b,c){return a=+a,b|=0,c||I(this,a,b,4,2147483647,-2147483648),a<0&&(a=4294967295+a+1),f.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):K(this,a,b,!1),b+4},f.prototype.writeFloatLE=function(a,b,c){return M(this,a,b,!0,c)},f.prototype.writeFloatBE=function(a,b,c){return M(this,a,b,!1,c)},f.prototype.writeDoubleLE=function(a,b,c){return N(this,a,b,!0,c)},f.prototype.writeDoubleBE=function(a,b,c){return N(this,a,b,!1,c)},f.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&d<c&&(d=c),d===c)return 0;if(0===a.length||0===this.length)return 0;if(b<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("sourceStart out of bounds");if(d<0)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var e,g=d-c;if(this===a&&c<b&&b<d)for(e=g-1;e>=0;e--)a[e+b]=this[e+c];else if(g<1e3||!f.TYPED_ARRAY_SUPPORT)for(e=0;e<g;e++)a[e+b]=this[e+c];else a._set(this.subarray(c,c+g),b);return g},f.prototype.fill=function(a,b,c){if(a||(a=0),b||(b=0),c||(c=this.length),c<b)throw new RangeError("end < start");if(c!==b&&0!==this.length){if(b<0||b>=this.length)throw new RangeError("start out of bounds");if(c<0||c>this.length)throw new RangeError("end out of bounds");var d;if("number"==typeof a)for(d=b;d<c;d++)this[d]=a;else{var e=R(a.toString()),f=e.length;for(d=b;d<c;d++)this[d]=e[d%f]}return this}},f.prototype.toArrayBuffer=function(){if("undefined"!=typeof Uint8Array){if(f.TYPED_ARRAY_SUPPORT)return new f(this).buffer;for(var a=new Uint8Array(this.length),b=0,c=a.length;b<c;b+=1)a[b]=this[b];return a.buffer}throw new TypeError("Buffer.toArrayBuffer not supported in this browser")};var _=f.prototype;f._augment=function(a){return a.constructor=f,a._isBuffer=!0,a._set=a.set,a.get=_.get,a.set=_.set,a.write=_.write,a.toString=_.toString,a.toLocaleString=_.toString,a.toJSON=_.toJSON,a.equals=_.equals,a.compare=_.compare,a.indexOf=_.indexOf,a.copy=_.copy,a.slice=_.slice,a.readUIntLE=_.readUIntLE,a.readUIntBE=_.readUIntBE,a.readUInt8=_.readUInt8,a.readUInt16LE=_.readUInt16LE,a.readUInt16BE=_.readUInt16BE,a.readUInt32LE=_.readUInt32LE,a.readUInt32BE=_.readUInt32BE,a.readIntLE=_.readIntLE,a.readIntBE=_.readIntBE,a.readInt8=_.readInt8,a.readInt16LE=_.readInt16LE,a.readInt16BE=_.readInt16BE,a.readInt32LE=_.readInt32LE,a.readInt32BE=_.readInt32BE,a.readFloatLE=_.readFloatLE,a.readFloatBE=_.readFloatBE,a.readDoubleLE=_.readDoubleLE,a.readDoubleBE=_.readDoubleBE,a.writeUInt8=_.writeUInt8,a.writeUIntLE=_.writeUIntLE,a.writeUIntBE=_.writeUIntBE,a.writeUInt16LE=_.writeUInt16LE,a.writeUInt16BE=_.writeUInt16BE,a.writeUInt32LE=_.writeUInt32LE,a.writeUInt32BE=_.writeUInt32BE,a.writeIntLE=_.writeIntLE,a.writeIntBE=_.writeIntBE,a.writeInt8=_.writeInt8,a.writeInt16LE=_.writeInt16LE,a.writeInt16BE=_.writeInt16BE,a.writeInt32LE=_.writeInt32LE,a.writeInt32BE=_.writeInt32BE,a.writeFloatLE=_.writeFloatLE,a.writeFloatBE=_.writeFloatBE,a.writeDoubleLE=_.writeDoubleLE,a.writeDoubleBE=_.writeDoubleBE,a.fill=_.fill,a.inspect=_.inspect,a.toArrayBuffer=_.toArrayBuffer,a};var aa=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":2,ieee754:7,isarray:8}],5:[function(b,c,d){(function(e,f){!function(b,e){"object"==typeof d&&void 0!==c?c.exports=e():"function"==typeof a&&a.amd?a(e):b.ES6Promise=e()}(this,function(){"use strict";function a(a){return"function"==typeof a||"object"==typeof a&&null!==a}function c(a){return"function"==typeof a}function d(a){X=a}function g(a){Y=a}function h(){return function(){return e.nextTick(m)}}function i(){return void 0!==W?function(){W(m)}:l()}function j(){var a=0,b=new _(m),c=document.createTextNode("");return b.observe(c,{characterData:!0}),function(){c.data=a=++a%2}}function k(){var a=new MessageChannel;return a.port1.onmessage=m,function(){return a.port2.postMessage(0)}}function l(){var a=setTimeout;return function(){return a(m,1)}}function m(){for(var a=0;a<V;a+=2){(0,ca[a])(ca[a+1]),ca[a]=void 0,ca[a+1]=void 0}V=0}function n(){try{var a=b,c=a("vertx");return W=c.runOnLoop||c.runOnContext,i()}catch(a){return l()}}function o(a,b){var c=arguments,d=this,e=new this.constructor(q);void 0===e[ea]&&J(e);var f=d._state;return f?function(){var a=c[f-1];Y(function(){return G(f,e,a,d._result)})}():C(d,e,a,b),e}function p(a){var b=this;if(a&&"object"==typeof a&&a.constructor===b)return a;var c=new b(q);return y(c,a),c}function q(){}function r(){return new TypeError("You cannot resolve a promise with itself")}function s(){return new TypeError("A promises callback cannot return that same promise.")}function t(a){try{return a.then}catch(a){return ia.error=a,ia}}function u(a,b,c,d){try{a.call(b,c,d)}catch(a){return a}}function v(a,b,c){Y(function(a){var d=!1,e=u(c,b,function(c){d||(d=!0,b!==c?y(a,c):A(a,c))},function(b){d||(d=!0,B(a,b))},"Settle: "+(a._label||" unknown promise"));!d&&e&&(d=!0,B(a,e))},a)}function w(a,b){b._state===ga?A(a,b._result):b._state===ha?B(a,b._result):C(b,void 0,function(b){return y(a,b)},function(b){return B(a,b)})}function x(a,b,d){b.constructor===a.constructor&&d===o&&b.constructor.resolve===p?w(a,b):d===ia?B(a,ia.error):void 0===d?A(a,b):c(d)?v(a,b,d):A(a,b)}function y(b,c){b===c?B(b,r()):a(c)?x(b,c,t(c)):A(b,c)}function z(a){a._onerror&&a._onerror(a._result),D(a)}function A(a,b){a._state===fa&&(a._result=b,a._state=ga,0!==a._subscribers.length&&Y(D,a))}function B(a,b){a._state===fa&&(a._state=ha,a._result=b,Y(z,a))}function C(a,b,c,d){var e=a._subscribers,f=e.length;a._onerror=null,e[f]=b,e[f+ga]=c,e[f+ha]=d,0===f&&a._state&&Y(D,a)}function D(a){var b=a._subscribers,c=a._state;if(0!==b.length){for(var d=void 0,e=void 0,f=a._result,g=0;g<b.length;g+=3)d=b[g],e=b[g+c],d?G(c,d,e,f):e(f);a._subscribers.length=0}}function E(){this.error=null}function F(a,b){try{return a(b)}catch(a){return ja.error=a,ja}}function G(a,b,d,e){var f=c(d),g=void 0,h=void 0,i=void 0,j=void 0;if(f){if(g=F(d,e),g===ja?(j=!0,h=g.error,g=null):i=!0,b===g)return void B(b,s())}else g=e,i=!0;b._state!==fa||(f&&i?y(b,g):j?B(b,h):a===ga?A(b,g):a===ha&&B(b,g))}function H(a,b){try{b(function(b){y(a,b)},function(b){B(a,b)})}catch(b){B(a,b)}}function I(){return ka++}function J(a){a[ea]=ka++,a._state=void 0,a._result=void 0,a._subscribers=[]}function K(a,b){this._instanceConstructor=a,this.promise=new a(q),this.promise[ea]||J(this.promise),U(b)?(this._input=b,this.length=b.length,this._remaining=b.length,this._result=new Array(this.length),0===this.length?A(this.promise,this._result):(this.length=this.length||0,this._enumerate(),0===this._remaining&&A(this.promise,this._result))):B(this.promise,L())}function L(){return new Error("Array Methods must be provided an Array")}function M(a){return new K(this,a).promise}function N(a){var b=this;return new b(U(a)?function(c,d){for(var e=a.length,f=0;f<e;f++)b.resolve(a[f]).then(c,d)}:function(a,b){return b(new TypeError("You must pass an array to race."))})}function O(a){var b=this,c=new b(q);return B(c,a),c}function P(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}function Q(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}function R(a){this[ea]=I(),this._result=this._state=void 0,this._subscribers=[],q!==a&&("function"!=typeof a&&P(),this instanceof R?H(this,a):Q())}function S(){var a=void 0;if(void 0!==f)a=f;else if("undefined"!=typeof self)a=self;else try{a=Function("return this")()}catch(a){throw new Error("polyfill failed because global object is unavailable in this environment")}var b=a.Promise;if(b){var c=null;try{c=Object.prototype.toString.call(b.resolve())}catch(a){}if("[object Promise]"===c&&!b.cast)return}a.Promise=R}var T=void 0;T=Array.isArray?Array.isArray:function(a){return"[object Array]"===Object.prototype.toString.call(a)};var U=T,V=0,W=void 0,X=void 0,Y=function(a,b){ca[V]=a,ca[V+1]=b,2===(V+=2)&&(X?X(m):da())},Z="undefined"!=typeof window?window:void 0,$=Z||{},_=$.MutationObserver||$.WebKitMutationObserver,aa="undefined"==typeof self&&void 0!==e&&"[object process]"==={}.toString.call(e),ba="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel,ca=new Array(1e3),da=void 0;da=aa?h():_?j():ba?k():void 0===Z&&"function"==typeof b?n():l();var ea=Math.random().toString(36).substring(16),fa=void 0,ga=1,ha=2,ia=new E,ja=new E,ka=0;return K.prototype._enumerate=function(){for(var a=this.length,b=this._input,c=0;this._state===fa&&c<a;c++)this._eachEntry(b[c],c)},K.prototype._eachEntry=function(a,b){var c=this._instanceConstructor,d=c.resolve;if(d===p){var e=t(a);if(e===o&&a._state!==fa)this._settledAt(a._state,b,a._result);else if("function"!=typeof e)this._remaining--,this._result[b]=a;else if(c===R){var f=new c(q);x(f,a,e),this._willSettleAt(f,b)}else this._willSettleAt(new c(function(b){return b(a)}),b)}else this._willSettleAt(d(a),b)},K.prototype._settledAt=function(a,b,c){var d=this.promise;d._state===fa&&(this._remaining--,a===ha?B(d,c):this._result[b]=c),0===this._remaining&&A(d,this._result)},K.prototype._willSettleAt=function(a,b){var c=this;C(a,void 0,function(a){return c._settledAt(ga,b,a)},function(a){return c._settledAt(ha,b,a)})},R.all=M,R.race=N,R.resolve=p,R.reject=O,R._setScheduler=d,R._setAsap=g,R._asap=Y,R.prototype={constructor:R,then:o,catch:function(a){return this.then(null,a)}},R.polyfill=S,R.Promise=R,R})}).call(this,b("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:43}],6:[function(b,c,d){!function(b,e){if("function"==typeof a&&a.amd)a(["exports","module"],e);else if(void 0!==d&&void 0!==c)e(d,c);else{var f={exports:{}};e(f.exports,f),b.fetchJsonp=f.exports}}(this,function(a,b){"use strict";function c(){return"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random())}function d(a){try{delete window[a]}catch(b){window[a]=void 0}}function e(a){var b=document.getElementById(a);document.getElementsByTagName("head")[0].removeChild(b)}function f(a){var b=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],f=a,h=b.timeout||g.timeout,i=b.jsonpCallback||g.jsonpCallback,j=void 0;return new Promise(function(g,k){var l=b.jsonpCallbackFunction||c(),m=i+"_"+l;window[l]=function(a){g({ok:!0,json:function(){return Promise.resolve(a)}}),j&&clearTimeout(j),e(m),d(l)},f+=f.indexOf("?")===-1?"?":"&";var n=document.createElement("script");n.setAttribute("src",""+f+i+"="+l),n.id=m,document.getElementsByTagName("head")[0].appendChild(n),j=setTimeout(function(){k(new Error("JSONP request to "+a+" timed out")),d(l),e(m)},h)})}var g={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};b.exports=f})},{}],7:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:1/0*(n?-1:1);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=b<0||0===b&&1/b<0?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],8:[function(a,b,c){var d={}.toString;b.exports=Array.isArray||function(a){return"[object Array]"==d.call(a)}},{}],9:[function(a,b,c){"use strict";function d(a,b,c,d,e){return Math.pow(1-e,3)*a+3*Math.pow(1-e,2)*e*b+3*(1-e)*Math.pow(e,2)*c+Math.pow(e,3)*d}function e(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}e.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},e.prototype.addPoint=function(a,b){"number"==typeof a&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=a,this.x2=a),a<this.x1&&(this.x1=a),a>this.x2&&(this.x2=a)),"number"==typeof b&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=b,this.y2=b),b<this.y1&&(this.y1=b),b>this.y2&&(this.y2=b))},e.prototype.addX=function(a){this.addPoint(a,null)},e.prototype.addY=function(a){this.addPoint(null,a)},e.prototype.addBezier=function(a,b,c,e,f,g,h,i){var j=[a,b],k=[c,e],l=[f,g],m=[h,i];this.addPoint(a,b),this.addPoint(h,i);for(var n=0;n<=1;n++){var o=6*j[n]-12*k[n]+6*l[n],p=-3*j[n]+9*k[n]-9*l[n]+3*m[n],q=3*k[n]-3*j[n];if(0!==p){var r=Math.pow(o,2)-4*q*p;if(!(r<0)){var s=(-o+Math.sqrt(r))/(2*p);0<s&&s<1&&(0===n&&this.addX(d(j[n],k[n],l[n],m[n],s)),1===n&&this.addY(d(j[n],k[n],l[n],m[n],s)));var t=(-o-Math.sqrt(r))/(2*p);0<t&&t<1&&(0===n&&this.addX(d(j[n],k[n],l[n],m[n],t)),1===n&&this.addY(d(j[n],k[n],l[n],m[n],t)))}}else{if(0===o)continue;var u=-q/o;0<u&&u<1&&(0===n&&this.addX(d(j[n],k[n],l[n],m[n],u)),1===n&&this.addY(d(j[n],k[n],l[n],m[n],u)))}}},e.prototype.addQuad=function(a,b,c,d,e,f){var g=a+2/3*(c-a),h=b+2/3*(d-b),i=g+1/3*(e-a),j=h+1/3*(f-b);this.addBezier(a,b,g,h,i,j,e,f)},c.BoundingBox=e},{}],10:[function(a,b,c){"use strict";c.fail=function(a){throw new Error(a)},c.argument=function(a,b){a||c.fail(b)},c.assert=c.argument},{}],11:[function(a,b,c){"use strict";function d(a,b,c,d,e){a.beginPath(),a.moveTo(b,c),a.lineTo(d,e),a.stroke()}c.line=d},{}],12:[function(a,b,c){"use strict";function d(a){this.font=a}function e(a){this.cmap=a}function f(a,b){this.encoding=a,this.charset=b}function g(a){var b;switch(a.version){case 1:this.names=c.standardNames.slice();break;case 2:for(this.names=new Array(a.numberOfGlyphs),b=0;b<a.numberOfGlyphs;b++)a.glyphNameIndex[b]<c.standardNames.length?this.names[b]=c.standardNames[a.glyphNameIndex[b]]:this.names[b]=a.names[a.glyphNameIndex[b]-c.standardNames.length];break;case 2.5:for(this.names=new Array(a.numberOfGlyphs),b=0;b<a.numberOfGlyphs;b++)this.names[b]=c.standardNames[b+a.glyphNameIndex[b]];break;case 3:this.names=[]}}function h(a){for(var b,c=a.tables.cmap.glyphIndexMap,d=Object.keys(c),e=0;e<d.length;e+=1){var f=d[e],g=c[f];b=a.glyphs.get(g),b.addUnicode(parseInt(f))}for(e=0;e<a.glyphs.length;e+=1)b=a.glyphs.get(e),a.cffEncoding?a.isCIDFont?b.name="gid"+e:b.name=a.cffEncoding.charset[e]:a.glyphNames.names&&(b.name=a.glyphNames.glyphIndexToName(e))}
var i=[".notdef","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","endash","dagger","daggerdbl","periodcentered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],j=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quoteright","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","quoteleft","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdown","cent","sterling","fraction","yen","florin","section","currency","quotesingle","quotedblleft","guillemotleft","guilsinglleft","guilsinglright","fi","fl","","endash","dagger","daggerdbl","periodcentered","","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","","questiondown","","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","","ring","cedilla","","hungarumlaut","ogonek","caron","emdash","","","","","","","","","","","","","","","","","AE","","ordfeminine","","","","","Lslash","Oslash","OE","ordmasculine","","","","","","ae","","","","dotlessi","","","lslash","oslash","oe","germandbls"],k=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],l=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslash","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];d.prototype.charToGlyphIndex=function(a){var b=a.charCodeAt(0),c=this.font.glyphs;if(!c)return null;for(var d=0;d<c.length;d+=1)for(var e=c.get(d),f=0;f<e.unicodes.length;f+=1)if(e.unicodes[f]===b)return d},e.prototype.charToGlyphIndex=function(a){return this.cmap.glyphIndexMap[a.charCodeAt(0)]||0},f.prototype.charToGlyphIndex=function(a){var b=a.charCodeAt(0),c=this.encoding[b];return this.charset.indexOf(c)},g.prototype.nameToGlyphIndex=function(a){return this.names.indexOf(a)},g.prototype.glyphIndexToName=function(a){return this.names[a]},c.cffStandardStrings=i,c.cffStandardEncoding=j,c.cffExpertEncoding=k,c.standardNames=l,c.DefaultEncoding=d,c.CmapEncoding=e,c.CffEncoding=f,c.GlyphNames=g,c.addGlyphNames=h},{}],13:[function(a,b,c){"use strict";function d(a){a=a||{},a.empty||(j.checkArgument(a.familyName,"When creating a new Font object, familyName is required."),j.checkArgument(a.styleName,"When creating a new Font object, styleName is required."),j.checkArgument(a.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),j.checkArgument(a.ascender,"When creating a new Font object, ascender is required."),j.checkArgument(a.descender,"When creating a new Font object, descender is required."),j.checkArgument(a.descender<0,"Descender should be negative (e.g. -512)."),this.names={fontFamily:{en:a.familyName||" "},fontSubfamily:{en:a.styleName||" "},fullName:{en:a.fullName||a.familyName+" "+a.styleName},postScriptName:{en:a.postScriptName||a.familyName+a.styleName},designer:{en:a.designer||" "},designerURL:{en:a.designerURL||" "},manufacturer:{en:a.manufacturer||" "},manufacturerURL:{en:a.manufacturerURL||" "},license:{en:a.license||" "},licenseURL:{en:a.licenseURL||" "},version:{en:a.version||"Version 0.1"},description:{en:a.description||" "},copyright:{en:a.copyright||" "},trademark:{en:a.trademark||" "}},this.unitsPerEm=a.unitsPerEm||1e3,this.ascender=a.ascender,this.descender=a.descender,this.createdTimestamp=a.createdTimestamp,this.tables={os2:{usWeightClass:a.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:a.widthClass||this.usWidthClasses.MEDIUM,fsSelection:a.fsSelection||this.fsSelectionValues.REGULAR}}),this.supported=!0,this.glyphs=new h.GlyphSet(this,a.glyphs||[]),this.encoding=new g.DefaultEncoding(this),this.substitution=new i(this),this.tables=this.tables||{},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:"truetype"===this.outlinesFormat?this._hinting=new k(this):void 0}})}var e=a("./path"),f=a("./tables/sfnt"),g=a("./encoding"),h=a("./glyphset"),i=a("./substitution"),j=a("./util"),k=a("./hintingtt");d.prototype.hasChar=function(a){return null!==this.encoding.charToGlyphIndex(a)},d.prototype.charToGlyphIndex=function(a){return this.encoding.charToGlyphIndex(a)},d.prototype.charToGlyph=function(a){var b=this.charToGlyphIndex(a),c=this.glyphs.get(b);return c||(c=this.glyphs.get(0)),c},d.prototype.stringToGlyphs=function(a,b){b=b||this.defaultRenderOptions;var c,d=[];for(c=0;c<a.length;c+=1){var e=a[c];d.push(this.charToGlyphIndex(e))}var f=d.length;if(b.features){var g=b.script||this.substitution.getDefaultScriptName(),h=[];for(b.features.liga&&(h=h.concat(this.substitution.getFeature("liga",g,b.language))),b.features.rlig&&(h=h.concat(this.substitution.getFeature("rlig",g,b.language))),c=0;c<f;c+=1)for(var i=0;i<h.length;i++){for(var j=h[i],k=j.sub,l=k.length,m=0;m<l&&k[m]===d[c+m];)m++;m===l&&(d.splice(c,l,j.by),f=f-l+1)}}var n=new Array(f),o=this.glyphs.get(0);for(c=0;c<f;c+=1)n[c]=this.glyphs.get(d[c])||o;return n},d.prototype.nameToGlyphIndex=function(a){return this.glyphNames.nameToGlyphIndex(a)},d.prototype.nameToGlyph=function(a){var b=this.nameToGlyphIndex(a),c=this.glyphs.get(b);return c||(c=this.glyphs.get(0)),c},d.prototype.glyphIndexToName=function(a){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(a):""},d.prototype.getKerningValue=function(a,b){a=a.index||a,b=b.index||b;var c=this.getGposKerningValue;return c?c(a,b):this.kerningPairs[a+","+b]||0},d.prototype.defaultRenderOptions={kerning:!0,features:{liga:!0,rlig:!0}},d.prototype.forEachGlyph=function(a,b,c,d,e,f){b=void 0!==b?b:0,c=void 0!==c?c:0,d=void 0!==d?d:72,e=e||this.defaultRenderOptions;for(var g=1/this.unitsPerEm*d,h=this.stringToGlyphs(a,e),i=0;i<h.length;i+=1){var j=h[i];if(f.call(this,j,b,c,d,e),j.advanceWidth&&(b+=j.advanceWidth*g),e.kerning&&i<h.length-1){b+=this.getKerningValue(j,h[i+1])*g}e.letterSpacing?b+=e.letterSpacing*d:e.tracking&&(b+=e.tracking/1e3*d)}return b},d.prototype.getPath=function(a,b,c,d,f){var g=new e.Path;return this.forEachGlyph(a,b,c,d,f,function(a,b,c,d){var e=a.getPath(b,c,d,f,this);g.extend(e)}),g},d.prototype.getPaths=function(a,b,c,d,e){var f=[];return this.forEachGlyph(a,b,c,d,e,function(a,b,c,d){var e=a.getPath(b,c,d);f.push(e)}),f},d.prototype.getAdvanceWidth=function(a,b,c){return this.forEachGlyph(a,0,0,b,c,function(){})},d.prototype.draw=function(a,b,c,d,e,f){this.getPath(b,c,d,e,f).draw(a)},d.prototype.drawPoints=function(a,b,c,d,e,f){this.forEachGlyph(b,c,d,e,f,function(b,c,d,e){b.drawPoints(a,c,d,e)})},d.prototype.drawMetrics=function(a,b,c,d,e,f){this.forEachGlyph(b,c,d,e,f,function(b,c,d,e){b.drawMetrics(a,c,d,e)})},d.prototype.getEnglishName=function(a){var b=this.names[a];if(b)return b.en},d.prototype.validate=function(){function a(a,b){a||c.push(b)}function b(b){var c=d.getEnglishName(b);a(c&&c.trim().length>0,"No English "+b+" specified.")}var c=[],d=this;b("fontFamily"),b("weightName"),b("manufacturer"),b("copyright"),b("version"),a(this.unitsPerEm>0,"No unitsPerEm specified.")},d.prototype.toTables=function(){return f.fontToTable(this)},d.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},d.prototype.toArrayBuffer=function(){for(var a=this.toTables(),b=a.encode(),c=new ArrayBuffer(b.length),d=new Uint8Array(c),e=0;e<b.length;e++)d[e]=b[e];return c},d.prototype.download=function(b){var c=this.getEnglishName("fontFamily"),d=this.getEnglishName("fontSubfamily");b=b||c.replace(/\s/g,"")+"-"+d+".otf";var e=this.toArrayBuffer();if(j.isBrowser())window.requestFileSystem=window.requestFileSystem||window.webkitRequestFileSystem,window.requestFileSystem(window.TEMPORARY,e.byteLength,function(a){a.root.getFile(b,{create:!0},function(a){a.createWriter(function(b){var c=new DataView(e),d=new Blob([c],{type:"font/opentype"});b.write(d),b.addEventListener("writeend",function(){location.href=a.toURL()},!1)})})},function(a){throw new Error(a.name+": "+a.message)});else{var f=a("fs"),g=j.arrayBufferToNodeBuffer(e);f.writeFileSync(b,g)}},d.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},d.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},d.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900},c.Font=d},{"./encoding":12,"./glyphset":15,"./hintingtt":16,"./path":20,"./substitution":21,"./tables/sfnt":40,"./util":42,fs:3}],14:[function(a,b,c){"use strict";function d(a,b){var c=b||{commands:[]};return{configurable:!0,get:function(){return"function"==typeof c&&(c=c()),c},set:function(a){c=a}}}function e(a){this.bindConstructorValues(a)}var f=a("./check"),g=a("./draw"),h=a("./path"),i=a("./tables/glyf");e.prototype.bindConstructorValues=function(a){this.index=a.index||0,this.name=a.name||null,this.unicode=a.unicode||void 0,this.unicodes=a.unicodes||void 0!==a.unicode?[a.unicode]:[],a.xMin&&(this.xMin=a.xMin),a.yMin&&(this.yMin=a.yMin),a.xMax&&(this.xMax=a.xMax),a.yMax&&(this.yMax=a.yMax),a.advanceWidth&&(this.advanceWidth=a.advanceWidth),Object.defineProperty(this,"path",d(this,a.path))},e.prototype.addUnicode=function(a){0===this.unicodes.length&&(this.unicode=a),this.unicodes.push(a)},e.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},e.prototype.getPath=function(a,b,c,d,e){a=void 0!==a?a:0,b=void 0!==b?b:0,c=void 0!==c?c:72;var f,g;d||(d={});var j=d.xScale,k=d.yScale;if(d.hinting&&e&&e.hinting&&(g=this.path&&e.hinting.exec(this,c)),g)f=i.getPath(g).commands,a=Math.round(a),b=Math.round(b),j=k=1;else{f=this.path.commands;var l=1/this.path.unitsPerEm*c;void 0===j&&(j=l),void 0===k&&(k=l)}for(var m=new h.Path,n=0;n<f.length;n+=1){var o=f[n];"M"===o.type?m.moveTo(a+o.x*j,b+-o.y*k):"L"===o.type?m.lineTo(a+o.x*j,b+-o.y*k):"Q"===o.type?m.quadraticCurveTo(a+o.x1*j,b+-o.y1*k,a+o.x*j,b+-o.y*k):"C"===o.type?m.curveTo(a+o.x1*j,b+-o.y1*k,a+o.x2*j,b+-o.y2*k,a+o.x*j,b+-o.y*k):"Z"===o.type&&m.closePath()}return m},e.prototype.getContours=function(){if(void 0===this.points)return[];for(var a=[],b=[],c=0;c<this.points.length;c+=1){var d=this.points[c];b.push(d),d.lastPointOfContour&&(a.push(b),b=[])}return f.argument(0===b.length,"There are still points left in the current contour."),a},e.prototype.getMetrics=function(){for(var a=this.path.commands,b=[],c=[],d=0;d<a.length;d+=1){var e=a[d];"Z"!==e.type&&(b.push(e.x),c.push(e.y)),"Q"!==e.type&&"C"!==e.type||(b.push(e.x1),c.push(e.y1)),"C"===e.type&&(b.push(e.x2),c.push(e.y2))}var f={xMin:Math.min.apply(null,b),yMin:Math.min.apply(null,c),xMax:Math.max.apply(null,b),yMax:Math.max.apply(null,c),leftSideBearing:this.leftSideBearing};return isFinite(f.xMin)||(f.xMin=0),isFinite(f.xMax)||(f.xMax=this.advanceWidth),isFinite(f.yMin)||(f.yMin=0),isFinite(f.yMax)||(f.yMax=0),f.rightSideBearing=this.advanceWidth-f.leftSideBearing-(f.xMax-f.xMin),f},e.prototype.draw=function(a,b,c,d,e){this.getPath(b,c,d,e).draw(a)},e.prototype.drawPoints=function(a,b,c,d){function e(b,c,d,e){var f=2*Math.PI;a.beginPath();for(var g=0;g<b.length;g+=1)a.moveTo(c+b[g].x*e,d+b[g].y*e),a.arc(c+b[g].x*e,d+b[g].y*e,2,0,f,!1);a.closePath(),a.fill()}b=void 0!==b?b:0,c=void 0!==c?c:0,d=void 0!==d?d:24;for(var f=1/this.path.unitsPerEm*d,g=[],h=[],i=this.path,j=0;j<i.commands.length;j+=1){var k=i.commands[j];void 0!==k.x&&g.push({x:k.x,y:-k.y}),void 0!==k.x1&&h.push({x:k.x1,y:-k.y1}),void 0!==k.x2&&h.push({x:k.x2,y:-k.y2})}a.fillStyle="blue",e(g,b,c,f),a.fillStyle="red",e(h,b,c,f)},e.prototype.drawMetrics=function(a,b,c,d){var e;b=void 0!==b?b:0,c=void 0!==c?c:0,d=void 0!==d?d:24,e=1/this.path.unitsPerEm*d,a.lineWidth=1,a.strokeStyle="black",g.line(a,b,-1e4,b,1e4),g.line(a,-1e4,c,1e4,c);var f=this.xMin||0,h=this.yMin||0,i=this.xMax||0,j=this.yMax||0,k=this.advanceWidth||0;a.strokeStyle="blue",g.line(a,b+f*e,-1e4,b+f*e,1e4),g.line(a,b+i*e,-1e4,b+i*e,1e4),g.line(a,-1e4,c+-h*e,1e4,c+-h*e),g.line(a,-1e4,c+-j*e,1e4,c+-j*e),a.strokeStyle="green",g.line(a,b+k*e,-1e4,b+k*e,1e4)},c.Glyph=e},{"./check":10,"./draw":11,"./path":20,"./tables/glyf":26}],15:[function(a,b,c){"use strict";function d(a,b,c){Object.defineProperty(a,b,{get:function(){return a.path,a[c]},set:function(b){a[c]=b},enumerable:!0,configurable:!0})}function e(a,b){if(this.font=a,this.glyphs={},Array.isArray(b))for(var c=0;c<b.length;c++)this.glyphs[c]=b[c];this.length=b&&b.length||0}function f(a,b){return new i.Glyph({index:b,font:a})}function g(a,b,c,e,f,g){return function(){var h=new i.Glyph({index:b,font:a});return h.path=function(){c(h,e,f);var b=g(a.glyphs,h);return b.unitsPerEm=a.unitsPerEm,b},d(h,"xMin","_xMin"),d(h,"xMax","_xMax"),d(h,"yMin","_yMin"),d(h,"yMax","_yMax"),h}}function h(a,b,c,d){return function(){var e=new i.Glyph({index:b,font:a});return e.path=function(){var b=c(a,e,d);return b.unitsPerEm=a.unitsPerEm,b},e}}var i=a("./glyph");e.prototype.get=function(a){return"function"==typeof this.glyphs[a]&&(this.glyphs[a]=this.glyphs[a]()),this.glyphs[a]},e.prototype.push=function(a,b){this.glyphs[a]=b,this.length++},c.GlyphSet=e,c.glyphLoader=f,c.ttfGlyphLoader=g,c.cffGlyphLoader=h},{"./glyph":14}],16:[function(a,b,c){"use strict";function d(a){this.font=a,this._fpgmState=this._prepState=void 0,this._errorState=0}function e(a){return a}function f(a){return Math.sign(a)*Math.round(Math.abs(a))}function g(a){return Math.sign(a)*Math.round(Math.abs(2*a))/2}function h(a){return Math.sign(a)*(Math.round(Math.abs(a)+.5)-.5)}function i(a){return Math.sign(a)*Math.ceil(Math.abs(a))}function j(a){return Math.sign(a)*Math.floor(Math.abs(a))}function k(a,b){this.x=a,this.y=b,this.axis=void 0,this.slope=b/a,this.normalSlope=-a/b,Object.freeze(this)}function l(a,b){var c=Math.sqrt(a*a+b*b);return a/=c,b/=c,1===a&&0===b?nb:0===a&&1===b?ob:new k(a,b)}function m(a,b,c,d){this.x=this.xo=Math.round(64*a)/64,this.y=this.yo=Math.round(64*b)/64,this.lastPointOfContour=c,this.onCurve=d,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}function n(a,b){switch(this.env=a,this.stack=[],this.prog=b,a){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=nb,this.round=f}}function o(a,b){var c,d,e,f=b.ppem/b.font.unitsPerEm,g=f,h=a.components;if(n.prototype=b,h){var i=b.font;d=[],c=[];for(var j=0;j<h.length;j++){var k=h[j],l=i.glyphs.get(k.glyphIndex);e=new n("glyf",l.instructions),lb&&(console.log("---EXEC COMP "+j+"---"),e.step=-1),p(l,e,f,g);for(var o=Math.round(k.dx*f),r=Math.round(k.dy*g),s=e.gZone,t=e.contours,u=0;u<s.length;u++){var v=s[u];v.xTouched=v.yTouched=!1,v.xo=v.x=v.x+o,v.yo=v.y=v.y+r}var w=d.length;d.push.apply(d,s);for(var x=0;x<t.length;x++)c.push(t[x]+w)}a.instructions&&!e.inhibitGridFit&&(e=new n("glyf",a.instructions),e.gZone=e.z0=e.z1=e.z2=d,e.contours=c,d.push(new m(0,0),new m(Math.round(a.advanceWidth*f),0)),lb&&(console.log("---EXEC COMPOSITE---"),e.step=-1),q(e),d.length-=2)}else e=new n("glyf",a.instructions),lb&&(console.log("---EXEC GLYPH---"),e.step=-1),p(a,e,f,g),d=e.gZone;return d}function p(a,b,c,d){var e,f,g=a.points||[],h=g.length,i=b.gZone=b.z0=b.z1=b.z2=[],j=b.contours=[];for(e=0;e<h;e++)f=g[e],i[e]=new m(f.x*c,f.y*d,f.lastPointOfContour,f.onCurve);var k,l;for(e=0;e<h;e++)f=i[e],k||(k=f,j.push(e)),f.lastPointOfContour?(f.nextPointOnContour=k,k.prevPointOnContour=f,k=void 0):(l=i[e+1],f.nextPointOnContour=l,l.prevPointOnContour=f);if(!b.inhibitGridFit&&(i.push(new m(0,0),new m(Math.round(a.advanceWidth*c),0)),q(b),i.length-=2,lb))for(console.log("FINISHED GLYPH",b.stack),e=0;e<h;e++)console.log(e,i[e].x,i[e].y)}function q(a){var b=a.prog;if(b){var c,d=b.length;for(a.ip=0;a.ip<d;a.ip++){if(lb&&a.step++,!(c=kb[b[a.ip]]))throw new Error("unknown instruction: 0x"+Number(b[a.ip]).toString(16));c(a)}}}function r(a){for(var b=a.tZone=new Array(a.gZone.length),c=0;c<b.length;c++)b[c]=new m(0,0)}function s(a,b){var c,d=a.prog,e=a.ip,f=1;do{if(88===(c=d[++e]))f++;else if(89===c)f--;else if(64===c)e+=d[e+1]+1;else if(65===c)e+=2*d[e+1]+1;else if(c>=176&&c<=183)e+=c-176+1;else if(c>=184&&c<=191)e+=2*(c-184+1);else if(b&&1===f&&27===c)break}while(f>0);a.ip=e}function t(a,b){lb&&console.log(b.step,"SVTCA["+a.axis+"]"),b.fv=b.pv=b.dpv=a}function u(a,b){lb&&console.log(b.step,"SPVTCA["+a.axis+"]"),b.pv=b.dpv=a}function v(a,b){lb&&console.log(b.step,"SFVTCA["+a.axis+"]"),b.fv=a}function w(a,b){var c=b.stack,d=c.pop(),e=c.pop(),f=b.z2[d],g=b.z1[e];lb&&console.log("SPVTL["+a+"]",d,e);var h,i;a?(h=f.y-g.y,i=g.x-f.x):(h=g.x-f.x,i=g.y-f.y),b.pv=b.dpv=l(h,i)}function x(a,b){var c=b.stack,d=c.pop(),e=c.pop(),f=b.z2[d],g=b.z1[e];lb&&console.log("SFVTL["+a+"]",d,e);var h,i;a?(h=f.y-g.y,i=g.x-f.x):(h=g.x-f.x,i=g.y-f.y),b.fv=l(h,i)}function y(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"SPVFS[]",c,d),a.pv=a.dpv=l(d,c)}function z(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"SPVFS[]",c,d),a.fv=l(d,c)}function A(a){var b=a.stack,c=a.pv;lb&&console.log(a.step,"GPV[]"),b.push(16384*c.x),b.push(16384*c.y)}function B(a){var b=a.stack,c=a.fv;lb&&console.log(a.step,"GFV[]"),b.push(16384*c.x),b.push(16384*c.y)}function C(a){a.fv=a.pv,lb&&console.log(a.step,"SFVTPV[]")}function D(a){var b=a.stack,c=b.pop(),d=b.pop(),e=b.pop(),f=b.pop(),g=b.pop(),h=a.z0,i=a.z1,j=h[c],k=h[d],l=i[e],m=i[f],n=a.z2[g];lb&&console.log("ISECT[], ",c,d,e,f,g);var o=j.x,p=j.y,q=k.x,r=k.y,s=l.x,t=l.y,u=m.x,v=m.y,w=(o-q)*(t-v)-(p-r)*(s-u),x=o*r-p*q,y=s*v-t*u;n.x=(x*(s-u)-y*(o-q))/w,n.y=(x*(t-v)-y*(p-r))/w}function E(a){a.rp0=a.stack.pop(),lb&&console.log(a.step,"SRP0[]",a.rp0)}function F(a){a.rp1=a.stack.pop(),lb&&console.log(a.step,"SRP1[]",a.rp1)}function G(a){a.rp2=a.stack.pop(),lb&&console.log(a.step,"SRP2[]",a.rp2)}function H(a){var b=a.stack.pop();switch(lb&&console.log(a.step,"SZP0[]",b),a.zp0=b,b){case 0:a.tZone||r(a),a.z0=a.tZone;break;case 1:a.z0=a.gZone;break;default:throw new Error("Invalid zone pointer")}}function I(a){var b=a.stack.pop();switch(lb&&console.log(a.step,"SZP1[]",b),a.zp1=b,b){case 0:a.tZone||r(a),a.z1=a.tZone;break;case 1:a.z1=a.gZone;break;default:throw new Error("Invalid zone pointer")}}function J(a){var b=a.stack.pop();switch(lb&&console.log(a.step,"SZP2[]",b),a.zp2=b,b){case 0:a.tZone||r(a),a.z2=a.tZone;break;case 1:a.z2=a.gZone;break;default:throw new Error("Invalid zone pointer")}}function K(a){var b=a.stack.pop();switch(lb&&console.log(a.step,"SZPS[]",b),a.zp0=a.zp1=a.zp2=b,b){case 0:a.tZone||r(a),a.z0=a.z1=a.z2=a.tZone;break;case 1:a.z0=a.z1=a.z2=a.gZone;break;default:throw new Error("Invalid zone pointer")}}function L(a){a.loop=a.stack.pop(),lb&&console.log(a.step,"SLOOP[]",a.loop)}function M(a){lb&&console.log(a.step,"RTG[]"),a.round=f}function N(a){lb&&console.log(a.step,"RTHG[]"),a.round=h}function O(a){var b=a.stack.pop();lb&&console.log(a.step,"SMD[]",b),a.minDis=b/64}function P(a){lb&&console.log(a.step,"ELSE[]"),s(a,!1)}function Q(a){var b=a.stack.pop();lb&&console.log(a.step,"JMPR[]",b),a.ip+=b-1}function R(a){var b=a.stack.pop();lb&&console.log(a.step,"SCVTCI[]",b),a.cvCutIn=b/64}function S(a){var b=a.stack;lb&&console.log(a.step,"DUP[]"),b.push(b[b.length-1])}function T(a){lb&&console.log(a.step,"POP[]"),a.stack.pop()}function U(a){lb&&console.log(a.step,"CLEAR[]"),a.stack.length=0}function V(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"SWAP[]"),b.push(c),b.push(d)}function W(a){var b=a.stack;lb&&console.log(a.step,"DEPTH[]"),b.push(b.length)}function X(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"LOOPCALL[]",c,d);var e=a.ip,f=a.prog;a.prog=a.funcs[c];for(var g=0;g<d;g++)q(a),lb&&console.log(++a.step,g+1<d?"next loopcall":"done loopcall",g);a.ip=e,a.prog=f}function Y(a){var b=a.stack.pop();lb&&console.log(a.step,"CALL[]",b);var c=a.ip,d=a.prog;a.prog=a.funcs[b],q(a),a.ip=c,a.prog=d,lb&&console.log(++a.step,"returning from",b)}function Z(a){var b=a.stack,c=b.pop();lb&&console.log(a.step,"CINDEX[]",c),b.push(b[b.length-c])}function $(a){var b=a.stack,c=b.pop();lb&&console.log(a.step,"MINDEX[]",c),b.push(b.splice(b.length-c,1)[0])}function _(a){if("fpgm"!==a.env)throw new Error("FDEF not allowed here");var b=a.stack,c=a.prog,d=a.ip,e=b.pop(),f=d;for(lb&&console.log(a.step,"FDEF[]",e);45!==c[++d];);a.ip=d,a.funcs[e]=c.slice(f+1,d)}function aa(a,b){var c=b.stack.pop(),d=b.z0[c],e=b.fv,f=b.pv;lb&&console.log(b.step,"MDAP["+a+"]",c);var g=f.distance(d,pb);a&&(g=b.round(g)),e.setRelative(d,pb,g,f),e.touch(d),b.rp0=b.rp1=c}function ba(a,b){var c,d,e,f=b.z2,g=f.length-2;lb&&console.log(b.step,"IUP["+a.axis+"]");for(var h=0;h<g;h++)c=f[h],a.touched(c)||(d=c.prevTouched(a))!==c&&(e=c.nextTouched(a),d===e&&a.setRelative(c,c,a.distance(d,d,!1,!0),a,!0),a.interpolate(c,d,e,a))}function ca(a,b){for(var c=b.stack,d=a?b.rp1:b.rp2,e=(a?b.z0:b.z1)[d],f=b.fv,g=b.pv,h=b.loop,i=b.z2;h--;){var j=c.pop(),k=i[j],l=g.distance(e,e,!1,!0);f.setRelative(k,k,l,g),f.touch(k),lb&&console.log(b.step,(b.loop>1?"loop "+(b.loop-h)+": ":"")+"SHP["+(a?"rp1":"rp2")+"]",j)}b.loop=1}function da(a,b){var c=b.stack,d=a?b.rp1:b.rp2,e=(a?b.z0:b.z1)[d],f=b.fv,g=b.pv,h=c.pop(),i=b.z2[b.contours[h]],j=i;lb&&console.log(b.step,"SHC["+a+"]",h);var k=g.distance(e,e,!1,!0);do{j!==e&&f.setRelative(j,j,k,g),j=j.nextPointOnContour}while(j!==i)}function ea(a,b){var c=b.stack,d=a?b.rp1:b.rp2,e=(a?b.z0:b.z1)[d],f=b.fv,g=b.pv,h=c.pop();lb&&console.log(b.step,"SHZ["+a+"]",h);var i;switch(h){case 0:i=b.tZone;break;case 1:i=b.gZone;break;default:throw new Error("Invalid zone")}for(var j,k=g.distance(e,e,!1,!0),l=i.length-2,m=0;m<l;m++)(j=i[m])!==e&&f.setRelative(j,j,k,g)}function fa(a){for(var b=a.stack,c=a.loop,d=a.fv,e=b.pop()/64,f=a.z2;c--;){var g=b.pop(),h=f[g];lb&&console.log(a.step,(a.loop>1?"loop "+(a.loop-c)+": ":"")+"SHPIX[]",g,e),d.setRelative(h,h,e),d.touch(h)}a.loop=1}function ga(a){for(var b=a.stack,c=a.rp1,d=a.rp2,e=a.loop,f=a.z0[c],g=a.z1[d],h=a.fv,i=a.dpv,j=a.z2;e--;){var k=b.pop(),l=j[k];lb&&console.log(a.step,(a.loop>1?"loop "+(a.loop-e)+": ":"")+"IP[]",k,c,"<->",d),h.interpolate(l,f,g,i),h.touch(l)}a.loop=1}function ha(a,b){var c=b.stack,d=c.pop()/64,e=c.pop(),f=b.z1[e],g=b.z0[b.rp0],h=b.fv,i=b.pv;h.setRelative(f,g,d,i),h.touch(f),lb&&console.log(b.step,"MSIRP["+a+"]",d,e),b.rp1=b.rp0,b.rp2=e,a&&(b.rp0=e)}function ia(a){for(var b=a.stack,c=a.rp0,d=a.z0[c],e=a.loop,f=a.fv,g=a.pv,h=a.z1;e--;){var i=b.pop(),j=h[i];lb&&console.log(a.step,(a.loop>1?"loop "+(a.loop-e)+": ":"")+"ALIGNRP[]",i),f.setRelative(j,d,0,g),f.touch(j)}a.loop=1}function ja(a){lb&&console.log(a.step,"RTDG[]"),a.round=g}function ka(a,b){var c=b.stack,d=c.pop(),e=c.pop(),f=b.z0[e],g=b.fv,h=b.pv,i=b.cvt[d];a&&(i=b.round(i)),
lb&&console.log(b.step,"MIAP["+a+"]",d,"(",i,")",e),g.setRelative(f,pb,i,h),0===b.zp0&&(f.xo=f.x,f.yo=f.y),g.touch(f),b.rp0=b.rp1=e}function la(a){var b=a.prog,c=a.ip,d=a.stack,e=b[++c];lb&&console.log(a.step,"NPUSHB[]",e);for(var f=0;f<e;f++)d.push(b[++c]);a.ip=c}function ma(a){var b=a.ip,c=a.prog,d=a.stack,e=c[++b];lb&&console.log(a.step,"NPUSHW[]",e);for(var f=0;f<e;f++){var g=c[++b]<<8|c[++b];32768&g&&(g=-(1+(65535^g))),d.push(g)}a.ip=b}function na(a){var b=a.stack,c=a.store;c||(c=a.store=[]);var d=b.pop(),e=b.pop();lb&&console.log(a.step,"WS",d,e),c[e]=d}function oa(a){var b=a.stack,c=a.store,d=b.pop();lb&&console.log(a.step,"RS",d);var e=c&&c[d]||0;b.push(e)}function pa(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"WCVTP",c,d),a.cvt[d]=c/64}function qa(a){var b=a.stack,c=b.pop();lb&&console.log(a.step,"RCVT",c),b.push(64*a.cvt[c])}function ra(a,b){var c=b.stack,d=c.pop(),e=b.z2[d];lb&&console.log(b.step,"GC["+a+"]",d),c.push(64*b.dpv.distance(e,pb,a,!1))}function sa(a,b){var c=b.stack,d=c.pop(),e=c.pop(),f=b.z1[d],g=b.z0[e],h=b.dpv.distance(g,f,a,a);lb&&console.log(b.step,"MD["+a+"]",d,e,"->",h),b.stack.push(Math.round(64*h))}function ta(a){lb&&console.log(a.step,"MPPEM[]"),a.stack.push(a.ppem)}function ua(a){lb&&console.log(a.step,"FLIPON[]"),a.autoFlip=!0}function va(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"LT[]",c,d),b.push(d<c?1:0)}function wa(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"LTEQ[]",c,d),b.push(d<=c?1:0)}function xa(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"GT[]",c,d),b.push(d>c?1:0)}function ya(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"GTEQ[]",c,d),b.push(d>=c?1:0)}function za(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"EQ[]",c,d),b.push(c===d?1:0)}function Aa(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"NEQ[]",c,d),b.push(c!==d?1:0)}function Ba(a){var b=a.stack,c=b.pop();lb&&console.log(a.step,"ODD[]",c),b.push(Math.trunc(c)%2?1:0)}function Ca(a){var b=a.stack,c=b.pop();lb&&console.log(a.step,"EVEN[]",c),b.push(Math.trunc(c)%2?0:1)}function Da(a){var b,c=a.stack.pop();lb&&console.log(a.step,"IF[]",c),c||(s(a,!0),lb&&console.log(a.step,27===b?"ELSE[]":"EIF[]"))}function Ea(a){lb&&console.log(a.step,"EIF[]")}function Fa(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"AND[]",c,d),b.push(c&&d?1:0)}function Ga(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"OR[]",c,d),b.push(c||d?1:0)}function Ha(a){var b=a.stack,c=b.pop();lb&&console.log(a.step,"NOT[]",c),b.push(c?0:1)}function Ia(a,b){var c=b.stack,d=c.pop(),e=b.fv,f=b.pv,g=b.ppem,h=b.deltaBase+16*(a-1),i=b.deltaShift,j=b.z0;lb&&console.log(b.step,"DELTAP["+a+"]",d,c);for(var k=0;k<d;k++){var l=c.pop(),m=c.pop();if(h+((240&m)>>4)===g){var n=(15&m)-8;n>=0&&n++,lb&&console.log(b.step,"DELTAPFIX",l,"by",n*i);var o=j[l];e.setRelative(o,o,n*i,f)}}}function Ja(a){var b=a.stack,c=b.pop();lb&&console.log(a.step,"SDB[]",c),a.deltaBase=c}function Ka(a){var b=a.stack,c=b.pop();lb&&console.log(a.step,"SDS[]",c),a.deltaShift=Math.pow(.5,c)}function La(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"ADD[]",c,d),b.push(d+c)}function Ma(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"SUB[]",c,d),b.push(d-c)}function Na(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"DIV[]",c,d),b.push(64*d/c)}function Oa(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"MUL[]",c,d),b.push(d*c/64)}function Pa(a){var b=a.stack,c=b.pop();lb&&console.log(a.step,"ABS[]",c),b.push(Math.abs(c))}function Qa(a){var b=a.stack,c=b.pop();lb&&console.log(a.step,"NEG[]",c),b.push(-c)}function Ra(a){var b=a.stack,c=b.pop();lb&&console.log(a.step,"FLOOR[]",c),b.push(64*Math.floor(c/64))}function Sa(a){var b=a.stack,c=b.pop();lb&&console.log(a.step,"CEILING[]",c),b.push(64*Math.ceil(c/64))}function Ta(a,b){var c=b.stack,d=c.pop();lb&&console.log(b.step,"ROUND[]"),c.push(64*b.round(d/64))}function Ua(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"WCVTF[]",c,d),a.cvt[d]=c*a.ppem/a.font.unitsPerEm}function Va(a,b){var c=b.stack,d=c.pop(),e=b.ppem,f=b.deltaBase+16*(a-1),g=b.deltaShift;lb&&console.log(b.step,"DELTAC["+a+"]",d,c);for(var h=0;h<d;h++){var i=c.pop(),j=c.pop();if(f+((240&j)>>4)===e){var k=(15&j)-8;k>=0&&k++;var l=k*g;lb&&console.log(b.step,"DELTACFIX",i,"by",l),b.cvt[i]+=l}}}function Wa(a){var b=a.stack.pop();lb&&console.log(a.step,"SROUND[]",b),a.round=mb;var c;switch(192&b){case 0:c=.5;break;case 64:c=1;break;case 128:c=2;break;default:throw new Error("invalid SROUND value")}switch(a.srPeriod=c,48&b){case 0:a.srPhase=0;break;case 16:a.srPhase=.25*c;break;case 32:a.srPhase=.5*c;break;case 48:a.srPhase=.75*c;break;default:throw new Error("invalid SROUND value")}b&=15,a.srThreshold=0===b?0:(b/8-.5)*c}function Xa(a){var b=a.stack.pop();lb&&console.log(a.step,"S45ROUND[]",b),a.round=mb;var c;switch(192&b){case 0:c=Math.sqrt(2)/2;break;case 64:c=Math.sqrt(2);break;case 128:c=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(a.srPeriod=c,48&b){case 0:a.srPhase=0;break;case 16:a.srPhase=.25*c;break;case 32:a.srPhase=.5*c;break;case 48:a.srPhase=.75*c;break;default:throw new Error("invalid S45ROUND value")}b&=15,a.srThreshold=0===b?0:(b/8-.5)*c}function Ya(a){lb&&console.log(a.step,"ROFF[]"),a.round=e}function Za(a){lb&&console.log(a.step,"RUTG[]"),a.round=i}function $a(a){lb&&console.log(a.step,"RDTG[]"),a.round=j}function _a(a){var b=a.stack.pop();lb&&console.log(a.step,"SCANCTRL[]",b)}function ab(a,b){var c=b.stack,d=c.pop(),e=c.pop(),f=b.z2[d],g=b.z1[e];lb&&console.log("SDPVTL["+a+"]",d,e);var h,i;a?(h=f.y-g.y,i=g.x-f.x):(h=g.x-f.x,i=g.y-f.y),b.dpv=l(h,i)}function bb(a){var b=a.stack,c=b.pop(),d=0;lb&&console.log(a.step,"GETINFO[]",c),1&c&&(d=35),32&c&&(d|=4096),b.push(d)}function cb(a){var b=a.stack,c=b.pop(),d=b.pop(),e=b.pop();lb&&console.log(a.step,"ROLL[]"),b.push(d),b.push(c),b.push(e)}function db(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"MAX[]",c,d),b.push(Math.max(d,c))}function eb(a){var b=a.stack,c=b.pop(),d=b.pop();lb&&console.log(a.step,"MIN[]",c,d),b.push(Math.min(d,c))}function fb(a){var b=a.stack.pop();lb&&console.log(a.step,"SCANTYPE[]",b)}function gb(a){var b=a.stack.pop(),c=a.stack.pop();switch(lb&&console.log(a.step,"INSTCTRL[]",b,c),b){case 1:return void(a.inhibitGridFit=!!c);case 2:return void(a.ignoreCvt=!!c);default:throw new Error("invalid INSTCTRL[] selector")}}function hb(a,b){var c=b.stack,d=b.prog,e=b.ip;lb&&console.log(b.step,"PUSHB["+a+"]");for(var f=0;f<a;f++)c.push(d[++e]);b.ip=e}function ib(a,b){var c=b.ip,d=b.prog,e=b.stack;lb&&console.log(b.ip,"PUSHW["+a+"]");for(var f=0;f<a;f++){var g=d[++c]<<8|d[++c];32768&g&&(g=-(1+(65535^g))),e.push(g)}b.ip=c}function jb(a,b,c,d,e,f){var g,h,i,j,k=f.stack,l=a&&k.pop(),m=k.pop(),n=f.rp0,o=f.z0[n],p=f.z1[m],q=f.minDis,r=f.fv,s=f.dpv;h=g=s.distance(p,o,!0,!0),i=h>=0?1:-1,h=Math.abs(h),a&&(j=f.cvt[l],d&&Math.abs(h-j)<f.cvCutIn&&(h=j)),c&&h<q&&(h=q),d&&(h=f.round(h)),r.setRelative(p,o,i*h,s),r.touch(p),lb&&console.log(f.step,(a?"MIRP[":"MDRP[")+(b?"M":"m")+(c?">":"_")+(d?"R":"_")+(0===e?"Gr":1===e?"Bl":2===e?"Wh":"")+"]",a?l+"("+f.cvt[l]+","+j+")":"",m,"(d =",g,"->",i*h,")"),f.rp1=f.rp0,f.rp2=m,b&&(f.rp0=m)}var kb,q,p,o,lb=!1,mb=function(a){var b=this.srPeriod,c=this.srPhase,d=this.srThreshold,e=1;return a<0&&(a=-a,e=-1),a+=d-c,a=Math.trunc(a/b)*b,a+=c,e>0&&a<0?c:e<0&&a>0?-c:a*e},nb={x:1,y:0,axis:"x",distance:function(a,b,c,d){return(c?a.xo:a.x)-(d?b.xo:b.x)},interpolate:function(a,b,c,d){var e,f,g,h,i,j,k;return d&&d!==this?(e=d.distance(a,b,!0,!0),f=d.distance(a,c,!0,!0),i=d.distance(b,b,!1,!0),j=d.distance(c,c,!1,!0),g=Math.abs(e),h=Math.abs(f),0===(k=g+h)?void nb.setRelative(a,a,(i+j)/2,d,!0):void nb.setRelative(a,a,(i*h+j*g)/k,d,!0)):(e=a.xo-b.xo,f=a.xo-c.xo,i=b.x-b.xo,j=c.x-c.xo,g=Math.abs(e),h=Math.abs(f),0===(k=g+h)?void(a.x=a.xo+(i+j)/2):void(a.x=a.xo+(i*h+j*g)/k))},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(a,b,c,d,e){if(!d||d===this)return void(a.x=(e?b.xo:b.x)+c);var f=e?b.xo:b.x,g=e?b.yo:b.y,h=f+c*d.x,i=g+c*d.y;a.x=h+(a.y-i)/d.normalSlope},slope:0,touch:function(a){a.xTouched=!0},touched:function(a){return a.xTouched},untouch:function(a){a.xTouched=!1}},ob={x:0,y:1,axis:"y",distance:function(a,b,c,d){return(c?a.yo:a.y)-(d?b.yo:b.y)},interpolate:function(a,b,c,d){var e,f,g,h,i,j,k;return d&&d!==this?(e=d.distance(a,b,!0,!0),f=d.distance(a,c,!0,!0),i=d.distance(b,b,!1,!0),j=d.distance(c,c,!1,!0),g=Math.abs(e),h=Math.abs(f),0===(k=g+h)?void ob.setRelative(a,a,(i+j)/2,d,!0):void ob.setRelative(a,a,(i*h+j*g)/k,d,!0)):(e=a.yo-b.yo,f=a.yo-c.yo,i=b.y-b.yo,j=c.y-c.yo,g=Math.abs(e),h=Math.abs(f),0===(k=g+h)?void(a.y=a.yo+(i+j)/2):void(a.y=a.yo+(i*h+j*g)/k))},normalSlope:0,setRelative:function(a,b,c,d,e){if(!d||d===this)return void(a.y=(e?b.yo:b.y)+c);var f=e?b.xo:b.x,g=e?b.yo:b.y,h=f+c*d.x,i=g+c*d.y;a.y=i+d.normalSlope*(a.x-h)},slope:Number.POSITIVE_INFINITY,touch:function(a){a.yTouched=!0},touched:function(a){return a.yTouched},untouch:function(a){a.yTouched=!1}};Object.freeze(nb),Object.freeze(ob),k.prototype.distance=function(a,b,c,d){return this.x*nb.distance(a,b,c,d)+this.y*ob.distance(a,b,c,d)},k.prototype.interpolate=function(a,b,c,d){var e,f,g,h,i,j,k;if(g=d.distance(a,b,!0,!0),h=d.distance(a,c,!0,!0),e=d.distance(b,b,!1,!0),f=d.distance(c,c,!1,!0),i=Math.abs(g),j=Math.abs(h),0===(k=i+j))return void this.setRelative(a,a,(e+f)/2,d,!0);this.setRelative(a,a,(e*j+f*i)/k,d,!0)},k.prototype.setRelative=function(a,b,c,d,e){d=d||this;var f=e?b.xo:b.x,g=e?b.yo:b.y,h=f+c*d.x,i=g+c*d.y,j=d.normalSlope,k=this.slope,l=a.x,m=a.y;a.x=(k*l-j*h+i-m)/(k-j),a.y=k*(a.x-l)+m},k.prototype.touch=function(a){a.xTouched=!0,a.yTouched=!0},m.prototype.nextTouched=function(a){for(var b=this.nextPointOnContour;!a.touched(b)&&b!==this;)b=b.nextPointOnContour;return b},m.prototype.prevTouched=function(a){for(var b=this.prevPointOnContour;!a.touched(b)&&b!==this;)b=b.prevPointOnContour;return b};var pb=Object.freeze(new m(0,0)),qb={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};d.prototype.exec=function(a,b){if("number"!=typeof b)throw new Error("Point size is not a number!");if(!(this._errorState>2)){var c=this.font,d=this._prepState;if(!d||d.ppem!==b){var e=this._fpgmState;if(!e){n.prototype=qb,e=this._fpgmState=new n("fpgm",c.tables.fpgm),e.funcs=[],e.font=c,lb&&(console.log("---EXEC FPGM---"),e.step=-1);try{q(e)}catch(a){return console.log("Hinting error in FPGM:"+a),void(this._errorState=3)}}n.prototype=e,d=this._prepState=new n("prep",c.tables.prep),d.ppem=b;var f=c.tables.cvt;if(f)for(var g=d.cvt=new Array(f.length),h=b/c.unitsPerEm,i=0;i<f.length;i++)g[i]=f[i]*h;else d.cvt=[];lb&&(console.log("---EXEC PREP---"),d.step=-1);try{q(d)}catch(a){this._errorState<2&&console.log("Hinting error in PREP:"+a),this._errorState=2}}if(!(this._errorState>1))try{return o(a,d)}catch(a){return this._errorState<1&&(console.log("Hinting error:"+a),console.log("Note: further hinting errors are silenced")),void(this._errorState=1)}}},kb=[t.bind(void 0,ob),t.bind(void 0,nb),u.bind(void 0,ob),u.bind(void 0,nb),v.bind(void 0,ob),v.bind(void 0,nb),w.bind(void 0,0),w.bind(void 0,1),x.bind(void 0,0),x.bind(void 0,1),y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,void 0,void 0,S,T,U,V,W,Z,$,void 0,void 0,void 0,X,Y,_,void 0,aa.bind(void 0,0),aa.bind(void 0,1),ba.bind(void 0,ob),ba.bind(void 0,nb),ca.bind(void 0,0),ca.bind(void 0,1),da.bind(void 0,0),da.bind(void 0,1),ea.bind(void 0,0),ea.bind(void 0,1),fa,ga,ha.bind(void 0,0),ha.bind(void 0,1),ia,ja,ka.bind(void 0,0),ka.bind(void 0,1),la,ma,na,oa,pa,qa,ra.bind(void 0,0),ra.bind(void 0,1),void 0,sa.bind(void 0,0),sa.bind(void 0,1),ta,void 0,ua,void 0,void 0,va,wa,xa,ya,za,Aa,Ba,Ca,Da,Ea,Fa,Ga,Ha,Ia.bind(void 0,1),Ja,Ka,La,Ma,Na,Oa,Pa,Qa,Ra,Sa,Ta.bind(void 0,0),Ta.bind(void 0,1),Ta.bind(void 0,2),Ta.bind(void 0,3),void 0,void 0,void 0,void 0,Ua,Ia.bind(void 0,2),Ia.bind(void 0,3),Va.bind(void 0,1),Va.bind(void 0,2),Va.bind(void 0,3),Wa,Xa,void 0,void 0,Ya,void 0,Za,$a,T,T,void 0,void 0,void 0,void 0,void 0,_a,ab.bind(void 0,0),ab.bind(void 0,1),bb,void 0,cb,db,eb,fb,gb,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,hb.bind(void 0,1),hb.bind(void 0,2),hb.bind(void 0,3),hb.bind(void 0,4),hb.bind(void 0,5),hb.bind(void 0,6),hb.bind(void 0,7),hb.bind(void 0,8),ib.bind(void 0,1),ib.bind(void 0,2),ib.bind(void 0,3),ib.bind(void 0,4),ib.bind(void 0,5),ib.bind(void 0,6),ib.bind(void 0,7),ib.bind(void 0,8),jb.bind(void 0,0,0,0,0,0),jb.bind(void 0,0,0,0,0,1),jb.bind(void 0,0,0,0,0,2),jb.bind(void 0,0,0,0,0,3),jb.bind(void 0,0,0,0,1,0),jb.bind(void 0,0,0,0,1,1),jb.bind(void 0,0,0,0,1,2),jb.bind(void 0,0,0,0,1,3),jb.bind(void 0,0,0,1,0,0),jb.bind(void 0,0,0,1,0,1),jb.bind(void 0,0,0,1,0,2),jb.bind(void 0,0,0,1,0,3),jb.bind(void 0,0,0,1,1,0),jb.bind(void 0,0,0,1,1,1),jb.bind(void 0,0,0,1,1,2),jb.bind(void 0,0,0,1,1,3),jb.bind(void 0,0,1,0,0,0),jb.bind(void 0,0,1,0,0,1),jb.bind(void 0,0,1,0,0,2),jb.bind(void 0,0,1,0,0,3),jb.bind(void 0,0,1,0,1,0),jb.bind(void 0,0,1,0,1,1),jb.bind(void 0,0,1,0,1,2),jb.bind(void 0,0,1,0,1,3),jb.bind(void 0,0,1,1,0,0),jb.bind(void 0,0,1,1,0,1),jb.bind(void 0,0,1,1,0,2),jb.bind(void 0,0,1,1,0,3),jb.bind(void 0,0,1,1,1,0),jb.bind(void 0,0,1,1,1,1),jb.bind(void 0,0,1,1,1,2),jb.bind(void 0,0,1,1,1,3),jb.bind(void 0,1,0,0,0,0),jb.bind(void 0,1,0,0,0,1),jb.bind(void 0,1,0,0,0,2),jb.bind(void 0,1,0,0,0,3),jb.bind(void 0,1,0,0,1,0),jb.bind(void 0,1,0,0,1,1),jb.bind(void 0,1,0,0,1,2),jb.bind(void 0,1,0,0,1,3),jb.bind(void 0,1,0,1,0,0),jb.bind(void 0,1,0,1,0,1),jb.bind(void 0,1,0,1,0,2),jb.bind(void 0,1,0,1,0,3),jb.bind(void 0,1,0,1,1,0),jb.bind(void 0,1,0,1,1,1),jb.bind(void 0,1,0,1,1,2),jb.bind(void 0,1,0,1,1,3),jb.bind(void 0,1,1,0,0,0),jb.bind(void 0,1,1,0,0,1),jb.bind(void 0,1,1,0,0,2),jb.bind(void 0,1,1,0,0,3),jb.bind(void 0,1,1,0,1,0),jb.bind(void 0,1,1,0,1,1),jb.bind(void 0,1,1,0,1,2),jb.bind(void 0,1,1,0,1,3),jb.bind(void 0,1,1,1,0,0),jb.bind(void 0,1,1,1,0,1),jb.bind(void 0,1,1,1,0,2),jb.bind(void 0,1,1,1,0,3),jb.bind(void 0,1,1,1,1,0),jb.bind(void 0,1,1,1,1,1),jb.bind(void 0,1,1,1,1,2),jb.bind(void 0,1,1,1,1,3)],b.exports=d},{}],17:[function(a,b,c){"use strict";function d(a,b){for(var c=0,d=a.length-1;c<=d;){var e=c+d>>>1,f=a[e].tag;if(f===b)return e;f<b?c=e+1:d=e-1}return-c-1}function e(a,b){for(var c=0,d=a.length-1;c<=d;){var e=c+d>>>1,f=a[e];if(f===b)return e;f<b?c=e+1:d=e-1}return-c-1}function f(a,b){this.font=a,this.tableName=b}var g=a("./check");f.prototype={searchTag:d,binSearch:e,getTable:function(a){var b=this.font.tables[this.tableName];return!b&&a&&(b=this.font.tables[this.tableName]=this.createDefaultTable()),b},getScriptNames:function(){var a=this.getTable();return a?a.scripts.map(function(a){return a.tag}):[]},getDefaultScriptName:function(){var a=this.getTable();if(a){for(var b=!1,c=0;c<a.scripts.length;c++){var d=a.scripts[c].tag;if("DFLT"===d)return d;"latn"===d&&(b=!0)}return b?"latn":void 0}},getScriptTable:function(a,b){var c=this.getTable(b);if(c){a=a||"DFLT";var e=c.scripts,f=d(c.scripts,a);if(f>=0)return e[f].script;if(b){var g={tag:a,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return e.splice(-1-f,0,g),g.script}}},getLangSysTable:function(a,b,c){var e=this.getScriptTable(a,c);if(e){if(!b||"dflt"===b||"DFLT"===b)return e.defaultLangSys;var f=d(e.langSysRecords,b);if(f>=0)return e.langSysRecords[f].langSys;if(c){var g={tag:b,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return e.langSysRecords.splice(-1-f,0,g),g.langSys}}},getFeatureTable:function(a,b,c,d){var e=this.getLangSysTable(a,b,d);if(e){for(var f,h=e.featureIndexes,i=this.font.tables[this.tableName].features,j=0;j<h.length;j++)if(f=i[h[j]],f.tag===c)return f.feature;if(d){var k=i.length;return g.assert(0===k||c>=i[k-1].tag,"Features must be added in alphabetical order."),f={tag:c,feature:{params:0,lookupListIndexes:[]}},i.push(f),h.push(k),f.feature}}},getLookupTables:function(a,b,c,d,e){var f=this.getFeatureTable(a,b,c,e),g=[];if(f){for(var h,i=f.lookupListIndexes,j=this.font.tables[this.tableName].lookups,k=0;k<i.length;k++)h=j[i[k]],h.lookupType===d&&g.push(h);if(0===g.length&&e){h={lookupType:d,lookupFlag:0,subtables:[],markFilteringSet:void 0};var l=j.length;return j.push(h),i.push(l),[h]}}return g},expandCoverage:function(a){if(1===a.format)return a.glyphs;for(var b=[],c=a.ranges,d=0;d<c.length;d++)for(var e=c[d],f=e.start,g=e.end,h=f;h<=g;h++)b.push(h);return b}},b.exports=f},{"./check":10}],18:[function(a,b,c){"use strict";function d(b,c){a("fs").readFile(b,function(a,b){if(a)return c(a.message);c(null,s.nodeBufferToArrayBuffer(b))})}function e(a,b){var c=new XMLHttpRequest;c.open("get",a,!0),c.responseType="arraybuffer",c.onload=function(){return 200!==c.status?b("Font could not be loaded: "+c.statusText):b(null,c.response)},c.onerror=function(){b("Font could not be loaded")},c.send()}function f(a,b){for(var c=[],d=12,e=0;e<b;e+=1){var f=p.getTag(a,d),g=p.getULong(a,d+4),h=p.getULong(a,d+8),i=p.getULong(a,d+12);c.push({tag:f,checksum:g,offset:h,length:i,compression:!1}),d+=16}return c}function g(a,b){for(var c=[],d=44,e=0;e<b;e+=1){var f,g=p.getTag(a,d),h=p.getULong(a,d+4),i=p.getULong(a,d+8),j=p.getULong(a,d+12);f=i<j&&"WOFF",c.push({tag:g,offset:h,compression:f,compressedLength:i,originalLength:j}),d+=20}return c}function h(a,b){if("WOFF"===b.compression){var c=new Uint8Array(a.buffer,b.offset+2,b.compressedLength-2),d=new Uint8Array(b.originalLength);if(l(c,d),d.byteLength!==b.originalLength)throw new Error("Decompression error: "+b.tag+" decompressed length doesn't match recorded length");return{data:new DataView(d.buffer,0),offset:0}}return{data:a,offset:b.offset}}function i(a){var b,c,d,e=new n.Font({empty:!0}),i=new DataView(a,0),j=[],k=p.getTag(i,0);if(k===String.fromCharCode(0,1,0,0)||"true"===k||"typ1"===k)e.outlinesFormat="truetype",d=p.getUShort(i,4),j=f(i,d);else if("OTTO"===k)e.outlinesFormat="cff",d=p.getUShort(i,4),j=f(i,d);else{if("wOFF"!==k)throw new Error("Unsupported OpenType signature "+k);var l=p.getTag(i,4);if(l===String.fromCharCode(0,1,0,0))e.outlinesFormat="truetype";else{if("OTTO"!==l)throw new Error("Unsupported OpenType flavor "+k);e.outlinesFormat="cff"}d=p.getUShort(i,12),j=g(i,d)}for(var o,q,r,s,K,L,M,N,O,P,Q,R=0;R<d;R+=1){var S,T=j[R];switch(T.tag){case"cmap":S=h(i,T),e.tables.cmap=t.parse(S.data,S.offset),e.encoding=new m.CmapEncoding(e.tables.cmap);break;case"cvt ":S=h(i,T),Q=new p.Parser(S.data,S.offset),e.tables.cvt=Q.parseShortList(T.length/2);break;case"fvar":q=T;break;case"fpgm":S=h(i,T),Q=new p.Parser(S.data,S.offset),e.tables.fpgm=Q.parseByteList(T.length);break;case"head":S=h(i,T),e.tables.head=z.parse(S.data,S.offset),e.unitsPerEm=e.tables.head.unitsPerEm,b=e.tables.head.indexToLocFormat;break;case"hhea":S=h(i,T),e.tables.hhea=A.parse(S.data,S.offset),e.ascender=e.tables.hhea.ascender,e.descender=e.tables.hhea.descender,e.numberOfHMetrics=e.tables.hhea.numberOfHMetrics;break;case"hmtx":L=T;break;case"ltag":S=h(i,T),c=D.parse(S.data,S.offset);break;case"maxp":S=h(i,T),e.tables.maxp=F.parse(S.data,S.offset),e.numGlyphs=e.tables.maxp.numGlyphs;break;case"name":O=T;break;case"OS/2":S=h(i,T),e.tables.os2=H.parse(S.data,S.offset);break;case"post":S=h(i,T),e.tables.post=I.parse(S.data,S.offset),e.glyphNames=new m.GlyphNames(e.tables.post);break;case"prep":S=h(i,T),Q=new p.Parser(S.data,S.offset),e.tables.prep=Q.parseByteList(T.length);break;case"glyf":r=T;break;case"loca":N=T;break;case"CFF ":o=T;break;case"kern":M=T;break;case"GPOS":s=T;break;case"GSUB":K=T;break;case"meta":P=T}}var U=h(i,O);if(e.tables.name=G.parse(U.data,U.offset,c),e.names=e.tables.name,r&&N){var V=0===b,W=h(i,N),X=E.parse(W.data,W.offset,e.numGlyphs,V),Y=h(i,r);e.glyphs=w.parse(Y.data,Y.offset,X,e)}else{if(!o)throw new Error("Font doesn't contain TrueType or CFF outlines.");var Z=h(i,o);u.parse(Z.data,Z.offset,e)}var $=h(i,L);if(B.parse($.data,$.offset,e.numberOfHMetrics,e.numGlyphs,e.glyphs),m.addGlyphNames(e),M){var _=h(i,M);e.kerningPairs=C.parse(_.data,_.offset)}else e.kerningPairs={};if(s){var aa=h(i,s);x.parse(aa.data,aa.offset,e)}if(K){var ba=h(i,K);e.tables.gsub=y.parse(ba.data,ba.offset)}if(q){var ca=h(i,q);e.tables.fvar=v.parse(ca.data,ca.offset,e.names)}if(P){var da=h(i,P);e.tables.meta=J.parse(da.data,da.offset),e.metas=e.tables.meta}return e}function j(a,b){("undefined"==typeof window?d:e)(a,function(a,c){if(a)return b(a);var d;try{d=i(c)}catch(a){return b(a,null)}return b(null,d)})}function k(b){var c=a("fs"),d=c.readFileSync(b);return i(s.nodeBufferToArrayBuffer(d))}var l=a("tiny-inflate"),m=a("./encoding"),n=a("./font"),o=a("./glyph"),p=a("./parse"),q=a("./bbox"),r=a("./path"),s=a("./util"),t=a("./tables/cmap"),u=a("./tables/cff"),v=a("./tables/fvar"),w=a("./tables/glyf"),x=a("./tables/gpos"),y=a("./tables/gsub"),z=a("./tables/head"),A=a("./tables/hhea"),B=a("./tables/hmtx"),C=a("./tables/kern"),D=a("./tables/ltag"),E=a("./tables/loca"),F=a("./tables/maxp"),G=a("./tables/name"),H=a("./tables/os2"),I=a("./tables/post"),J=a("./tables/meta");c._parse=p,c.Font=n.Font,c.Glyph=o.Glyph,c.Path=r.Path,c.BoundingBox=q.BoundingBox,c.parse=i,c.load=j,c.loadSync=k},{"./bbox":9,"./encoding":12,"./font":13,"./glyph":14,"./parse":19,"./path":20,"./tables/cff":23,"./tables/cmap":24,"./tables/fvar":25,"./tables/glyf":26,"./tables/gpos":27,"./tables/gsub":28,"./tables/head":29,"./tables/hhea":30,"./tables/hmtx":31,"./tables/kern":32,"./tables/loca":33,"./tables/ltag":34,"./tables/maxp":35,"./tables/meta":36,"./tables/name":37,"./tables/os2":38,"./tables/post":39,"./util":42,fs:3,"tiny-inflate":44}],19:[function(a,b,c){"use strict";function d(a,b){return a.getUint16(b,!1)}function e(a,b){this.data=a,this.offset=b,this.relativeOffset=0}var f=a("./check");c.getByte=function(a,b){return a.getUint8(b)},c.getCard8=c.getByte,c.getUShort=c.getCard16=d,c.getShort=function(a,b){return a.getInt16(b,!1)},c.getULong=function(a,b){return a.getUint32(b,!1)},c.getFixed=function(a,b){return a.getInt16(b,!1)+a.getUint16(b+2,!1)/65535},c.getTag=function(a,b){for(var c="",d=b;d<b+4;d+=1)c+=String.fromCharCode(a.getInt8(d));return c},c.getOffset=function(a,b,c){for(var d=0,e=0;e<c;e+=1)d<<=8,d+=a.getUint8(b+e);return d},c.getBytes=function(a,b,c){for(var d=[],e=b;e<c;e+=1)d.push(a.getUint8(e));return d},c.bytesToString=function(a){for(var b="",c=0;c<a.length;c+=1)b+=String.fromCharCode(a[c]);return b};var g={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};e.prototype.parseByte=function(){var a=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,a},e.prototype.parseChar=function(){var a=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,a},e.prototype.parseCard8=e.prototype.parseByte,e.prototype.parseUShort=function(){var a=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,a},e.prototype.parseCard16=e.prototype.parseUShort,e.prototype.parseSID=e.prototype.parseUShort,e.prototype.parseOffset16=e.prototype.parseUShort,e.prototype.parseShort=function(){var a=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,a},e.prototype.parseF2Dot14=function(){var a=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,a},e.prototype.parseULong=function(){var a=c.getULong(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,a},e.prototype.parseFixed=function(){var a=c.getFixed(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,a},e.prototype.parseString=function(a){var b=this.data,c=this.offset+this.relativeOffset,d="";this.relativeOffset+=a;for(var e=0;e<a;e++)d+=String.fromCharCode(b.getUint8(c+e));return d},e.prototype.parseTag=function(){return this.parseString(4)},e.prototype.parseLongDateTime=function(){var a=c.getULong(this.data,this.offset+this.relativeOffset+4);return a-=2082844800,this.relativeOffset+=8,a},e.prototype.parseVersion=function(){var a=d(this.data,this.offset+this.relativeOffset),b=d(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,a+b/4096/10},e.prototype.skip=function(a,b){void 0===b&&(b=1),this.relativeOffset+=g[a]*b},e.prototype.parseOffset16List=e.prototype.parseUShortList=function(a){void 0===a&&(a=this.parseUShort());for(var b=new Array(a),c=this.data,d=this.offset+this.relativeOffset,e=0;e<a;e++)b[e]=c.getUint16(d),d+=2;return this.relativeOffset+=2*a,b},e.prototype.parseShortList=function(a){for(var b=new Array(a),c=this.data,d=this.offset+this.relativeOffset,e=0;e<a;e++)b[e]=c.getInt16(d),d+=2;return this.relativeOffset+=2*a,b},e.prototype.parseByteList=function(a){for(var b=new Array(a),c=this.data,d=this.offset+this.relativeOffset,e=0;e<a;e++)b[e]=c.getUint8(d++);return this.relativeOffset+=a,b},e.prototype.parseList=function(a,b){b||(b=a,a=this.parseUShort());for(var c=new Array(a),d=0;d<a;d++)c[d]=b.call(this);return c},e.prototype.parseRecordList=function(a,b){b||(b=a,a=this.parseUShort());for(var c=new Array(a),d=Object.keys(b),e=0;e<a;e++){for(var f={},g=0;g<d.length;g++){var h=d[g],i=b[h];f[h]=i.call(this)}c[e]=f}return c},e.prototype.parseStruct=function(a){if("function"==typeof a)return a.call(this);for(var b=Object.keys(a),c={},d=0;d<b.length;d++){var e=b[d],f=a[e];c[e]=f.call(this)}return c},e.prototype.parsePointer=function(a){var b=this.parseOffset16();if(b>0)return new e(this.data,this.offset+b).parseStruct(a)},e.prototype.parseListOfLists=function(a){for(var b=this.parseOffset16List(),c=b.length,d=this.relativeOffset,e=new Array(c),f=0;f<c;f++){var g=b[f];if(0!==g)if(this.relativeOffset=g,a){for(var h=this.parseOffset16List(),i=new Array(h.length),j=0;j<h.length;j++)this.relativeOffset=g+h[j],i[j]=a.call(this);e[f]=i}else e[f]=this.parseUShortList();else e[f]=void 0}return this.relativeOffset=d,e},e.prototype.parseCoverage=function(){var a=this.offset+this.relativeOffset,b=this.parseUShort(),c=this.parseUShort();if(1===b)return{format:1,glyphs:this.parseUShortList(c)};if(2===b){for(var d=new Array(c),e=0;e<c;e++)d[e]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:d}}f.assert(!1,"0x"+a.toString(16)+": Coverage format must be 1 or 2.")},e.prototype.parseClassDef=function(){var a=this.offset+this.relativeOffset,b=this.parseUShort();return 1===b?{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()}:2===b?{format:2,ranges:this.parseRecordList({start:e.uShort,end:e.uShort,classId:e.uShort})}:void f.assert(!1,"0x"+a.toString(16)+": ClassDef format must be 1 or 2.")},e.list=function(a,b){return function(){return this.parseList(a,b)}},e.recordList=function(a,b){return function(){return this.parseRecordList(a,b)}},e.pointer=function(a){return function(){return this.parsePointer(a)}},e.tag=e.prototype.parseTag,e.byte=e.prototype.parseByte,e.uShort=e.offset16=e.prototype.parseUShort,e.uShortList=e.prototype.parseUShortList,e.struct=e.prototype.parseStruct,e.coverage=e.prototype.parseCoverage,e.classDef=e.prototype.parseClassDef;var h={reserved:e.uShort,reqFeatureIndex:e.uShort,featureIndexes:e.uShortList};e.prototype.parseScriptList=function(){return this.parsePointer(e.recordList({tag:e.tag,script:e.pointer({defaultLangSys:e.pointer(h),langSysRecords:e.recordList({tag:e.tag,langSys:e.pointer(h)})})}))},e.prototype.parseFeatureList=function(){return this.parsePointer(e.recordList({tag:e.tag,feature:e.pointer({featureParams:e.offset16,lookupListIndexes:e.uShortList})}))},e.prototype.parseLookupList=function(a){return this.parsePointer(e.list(e.pointer(function(){var b=this.parseUShort();f.argument(1<=b&&b<=8,"GSUB lookup type "+b+" unknown.");var c=this.parseUShort(),d=16&c;return{lookupType:b,lookupFlag:c,subtables:this.parseList(e.pointer(a[b])),markFilteringSet:d?this.parseUShort():void 0}})))},c.Parser=e},{"./check":10}],20:[function(a,b,c){"use strict";function d(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}var e=a("./bbox");d.prototype.moveTo=function(a,b){this.commands.push({type:"M",x:a,y:b})},d.prototype.lineTo=function(a,b){this.commands.push({type:"L",x:a,y:b})},d.prototype.curveTo=d.prototype.bezierCurveTo=function(a,b,c,d,e,f){this.commands.push({type:"C",x1:a,y1:b,x2:c,y2:d,x:e,y:f})},d.prototype.quadTo=d.prototype.quadraticCurveTo=function(a,b,c,d){this.commands.push({type:"Q",x1:a,y1:b,x:c,y:d})},d.prototype.close=d.prototype.closePath=function(){this.commands.push({type:"Z"})},d.prototype.extend=function(a){if(a.commands)a=a.commands;else if(a instanceof e.BoundingBox){var b=a;return this.moveTo(b.x1,b.y1),this.lineTo(b.x2,b.y1),this.lineTo(b.x2,b.y2),this.lineTo(b.x1,b.y2),void this.close()}Array.prototype.push.apply(this.commands,a)},d.prototype.getBoundingBox=function(){for(var a=new e.BoundingBox,b=0,c=0,d=0,f=0,g=0;g<this.commands.length;g++){var h=this.commands[g];switch(h.type){case"M":a.addPoint(h.x,h.y),b=d=h.x,c=f=h.y;break;case"L":a.addPoint(h.x,h.y),d=h.x,f=h.y;break;case"Q":a.addQuad(d,f,h.x1,h.y1,h.x,h.y),d=h.x,f=h.y;break;case"C":a.addBezier(d,f,h.x1,h.y1,h.x2,h.y2,h.x,h.y),d=h.x,f=h.y;break;case"Z":d=b,f=c;break;default:throw new Error("Unexpected path commmand "+h.type)}}return a.isEmpty()&&a.addPoint(0,0),a},d.prototype.draw=function(a){a.beginPath();for(var b=0;b<this.commands.length;b+=1){var c=this.commands[b];"M"===c.type?a.moveTo(c.x,c.y):"L"===c.type?a.lineTo(c.x,c.y):"C"===c.type?a.bezierCurveTo(c.x1,c.y1,c.x2,c.y2,c.x,c.y):"Q"===c.type?a.quadraticCurveTo(c.x1,c.y1,c.x,c.y):"Z"===c.type&&a.closePath()}this.fill&&(a.fillStyle=this.fill,a.fill()),this.stroke&&(a.strokeStyle=this.stroke,a.lineWidth=this.strokeWidth,a.stroke())},d.prototype.toPathData=function(a){function b(b){return Math.round(b)===b?""+Math.round(b):b.toFixed(a)}function c(){for(var a="",c=0;c<arguments.length;c+=1){var d=arguments[c];d>=0&&c>0&&(a+=" "),a+=b(d)}return a}a=void 0!==a?a:2;for(var d="",e=0;e<this.commands.length;e+=1){var f=this.commands[e];"M"===f.type?d+="M"+c(f.x,f.y):"L"===f.type?d+="L"+c(f.x,f.y):"C"===f.type?d+="C"+c(f.x1,f.y1,f.x2,f.y2,f.x,f.y):"Q"===f.type?d+="Q"+c(f.x1,f.y1,f.x,f.y):"Z"===f.type&&(d+="Z")}return d},d.prototype.toSVG=function(a){var b='<path d="';return b+=this.toPathData(a),b+='"',this.fill&&"black"!==this.fill&&(b+=null===this.fill?' fill="none"':' fill="'+this.fill+'"'),this.stroke&&(b+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),b+="/>"},d.prototype.toDOMElement=function(a){var b=this.toPathData(a),c=document.createElementNS("http://www.w3.org/2000/svg","path");return c.setAttribute("d",b),c},c.Path=d},{"./bbox":9}],21:[function(a,b,c){"use strict";function d(a,b){var c=a.length;if(c!==b.length)return!1;for(var d=0;d<c;d++)if(a[d]!==b[d])return!1;return!0}function e(a,b,c){for(var d=a.subtables,e=0;e<d.length;e++){var f=d[e];if(f.substFormat===b)return f}if(c)return d.push(c),c}var f=a("./check"),g=a("./layout"),h=function(a){g.call(this,a,"gsub")};h.prototype=g.prototype,h.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},h.prototype.getSingle=function(a,b,c){for(var d=[],e=this.getLookupTables(b,c,a,1),f=0;f<e.length;f++)for(var g=e[f].subtables,h=0;h<g.length;h++){var i,j=g[h],k=this.expandCoverage(j.coverage);if(1===j.substFormat){var l=j.deltaGlyphId;for(i=0;i<k.length;i++){var m=k[i];d.push({sub:m,by:m+l})}}else{var n=j.substitute;for(i=0;i<k.length;i++)d.push({sub:k[i],by:n[i]})}}return d},h.prototype.getAlternates=function(a,b,c){
for(var d=[],e=this.getLookupTables(b,c,a,3),f=0;f<e.length;f++)for(var g=e[f].subtables,h=0;h<g.length;h++)for(var i=g[h],j=this.expandCoverage(i.coverage),k=i.alternateSets,l=0;l<j.length;l++)d.push({sub:j[l],by:k[l]});return d},h.prototype.getLigatures=function(a,b,c){for(var d=[],e=this.getLookupTables(b,c,a,4),f=0;f<e.length;f++)for(var g=e[f].subtables,h=0;h<g.length;h++)for(var i=g[h],j=this.expandCoverage(i.coverage),k=i.ligatureSets,l=0;l<j.length;l++)for(var m=j[l],n=k[l],o=0;o<n.length;o++){var p=n[o];d.push({sub:[m].concat(p.components),by:p.ligGlyph})}return d},h.prototype.addSingle=function(a,b,c,d){var g=this.getLookupTables(c,d,a,1,!0)[0],h=e(g,2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});f.assert(1===h.coverage.format,"Ligature: unable to modify coverage table format "+h.coverage.format);var i=b.sub,j=this.binSearch(h.coverage.glyphs,i);j<0&&(j=-1-j,h.coverage.glyphs.splice(j,0,i),h.substitute.splice(j,0,0)),h.substitute[j]=b.by},h.prototype.addAlternate=function(a,b,c,d){var g=this.getLookupTables(c,d,a,3,!0)[0],h=e(g,1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});f.assert(1===h.coverage.format,"Ligature: unable to modify coverage table format "+h.coverage.format);var i=b.sub,j=this.binSearch(h.coverage.glyphs,i);j<0&&(j=-1-j,h.coverage.glyphs.splice(j,0,i),h.alternateSets.splice(j,0,0)),h.alternateSets[j]=b.by},h.prototype.addLigature=function(a,b,c,e){var g=this.getLookupTables(c,e,a,4,!0)[0],h=g.subtables[0];h||(h={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},g.subtables[0]=h),f.assert(1===h.coverage.format,"Ligature: unable to modify coverage table format "+h.coverage.format);var i=b.sub[0],j=b.sub.slice(1),k={ligGlyph:b.by,components:j},l=this.binSearch(h.coverage.glyphs,i);if(l>=0){for(var m=h.ligatureSets[l],n=0;n<m.length;n++)if(d(m[n].components,j))return;m.push(k)}else l=-1-l,h.coverage.glyphs.splice(l,0,i),h.ligatureSets.splice(l,0,[k])},h.prototype.getFeature=function(a,b,c){if(/ss\d\d/.test(a))return this.getSingle(a,b,c);switch(a){case"aalt":case"salt":return this.getSingle(a,b,c).concat(this.getAlternates(a,b,c));case"dlig":case"liga":case"rlig":return this.getLigatures(a,b,c)}},h.prototype.add=function(a,b,c,d){if(/ss\d\d/.test(a))return this.addSingle(a,b,c,d);switch(a){case"aalt":case"salt":return"number"==typeof b.by?this.addSingle(a,b,c,d):this.addAlternate(a,b,c,d);case"dlig":case"liga":case"rlig":return this.addLigature(a,b,c,d)}},b.exports=h},{"./check":10,"./layout":17}],22:[function(a,b,c){"use strict";function d(a,b,c){var d;for(d=0;d<b.length;d+=1){var e=b[d];this[e.name]=e.value}if(this.tableName=a,this.fields=b,c){var f=Object.keys(c);for(d=0;d<f.length;d+=1){var g=f[d],h=c[g];void 0!==this[g]&&(this[g]=h)}}}function e(a,b,c){void 0===c&&(c=b.length);var d=new Array(b.length+1);d[0]={name:a+"Count",type:"USHORT",value:c};for(var e=0;e<b.length;e++)d[e+1]={name:a+e,type:"USHORT",value:b[e]};return d}function f(a,b,c){var d=b.length,e=new Array(d+1);e[0]={name:a+"Count",type:"USHORT",value:d};for(var f=0;f<d;f++)e[f+1]={name:a+f,type:"TABLE",value:c(b[f],f)};return e}function g(a,b,c){var d=b.length,e=[];e[0]={name:a+"Count",type:"USHORT",value:d};for(var f=0;f<d;f++)e=e.concat(c(b[f],f));return e}function h(a){1===a.format?d.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(e("glyph",a.glyphs))):l.assert(!1,"Can't create coverage table format 2 yet.")}function i(a){d.call(this,"scriptListTable",g("scriptRecord",a,function(a,b){var c=a.script,f=c.defaultLangSys;return l.assert(!!f,"Unable to write GSUB: script "+a.tag+" has no default language system."),[{name:"scriptTag"+b,type:"TAG",value:a.tag},{name:"script"+b,type:"TABLE",value:new d("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new d("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:f.reqFeatureIndex}].concat(e("featureIndex",f.featureIndexes)))}].concat(g("langSys",c.langSysRecords,function(a,b){var c=a.langSys;return[{name:"langSysTag"+b,type:"TAG",value:a.tag},{name:"langSys"+b,type:"TABLE",value:new d("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:c.reqFeatureIndex}].concat(e("featureIndex",c.featureIndexes)))}]})))}]}))}function j(a){d.call(this,"featureListTable",g("featureRecord",a,function(a,b){var c=a.feature;return[{name:"featureTag"+b,type:"TAG",value:a.tag},{name:"feature"+b,type:"TABLE",value:new d("featureTable",[{name:"featureParams",type:"USHORT",value:c.featureParams}].concat(e("lookupListIndex",c.lookupListIndexes)))}]}))}function k(a,b){d.call(this,"lookupListTable",f("lookup",a,function(a){var c=b[a.lookupType];return l.assert(!!c,"Unable to write GSUB lookup type "+a.lookupType+" tables."),new d("lookupTable",[{name:"lookupType",type:"USHORT",value:a.lookupType},{name:"lookupFlag",type:"USHORT",value:a.lookupFlag}].concat(f("subtable",a.subtables,c)))}))}var l=a("./check"),m=a("./types").encode,n=a("./types").sizeOf;d.prototype.encode=function(){return m.TABLE(this)},d.prototype.sizeOf=function(){return n.TABLE(this)},h.prototype=Object.create(d.prototype),h.prototype.constructor=h,i.prototype=Object.create(d.prototype),i.prototype.constructor=i,j.prototype=Object.create(d.prototype),j.prototype.constructor=j,k.prototype=Object.create(d.prototype),k.prototype.constructor=k,c.Record=c.Table=d,c.Coverage=h,c.ScriptList=i,c.FeatureList=j,c.LookupList=k,c.ushortList=e,c.tableList=f,c.recordList=g},{"./check":10,"./types":41}],23:[function(a,b,c){"use strict";function d(a,b){if(a===b)return!0;if(Array.isArray(a)&&Array.isArray(b)){if(a.length!==b.length)return!1;for(var c=0;c<a.length;c+=1)if(!d(a[c],b[c]))return!1;return!0}return!1}function e(a){return a.length<1240?107:a.length<33900?1131:32768}function f(a,b,c){var d,e,f,g=[],h=[],i=K.getCard16(a,b);if(0!==i){var j=K.getByte(a,b+2);e=b+(i+1)*j+2;var k=b+3;for(d=0;d<i+1;d+=1)g.push(K.getOffset(a,k,j)),k+=j;f=e+g[i]}else f=b+2;for(d=0;d<g.length-1;d+=1){var l=K.getBytes(a,e+g[d],e+g[d+1]);c&&(l=c(l)),h.push(l)}return{objects:h,startOffset:b,endOffset:f}}function g(a){for(var b="",c=15,d=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];;){var e=a.parseByte(),f=e>>4,g=15&e;if(f===c)break;if(b+=d[f],g===c)break;b+=d[g]}return parseFloat(b)}function h(a,b){var c,d,e,f;if(28===b)return c=a.parseByte(),d=a.parseByte(),c<<8|d;if(29===b)return c=a.parseByte(),d=a.parseByte(),e=a.parseByte(),f=a.parseByte(),c<<24|d<<16|e<<8|f;if(30===b)return g(a);if(b>=32&&b<=246)return b-139;if(b>=247&&b<=250)return c=a.parseByte(),256*(b-247)+c+108;if(b>=251&&b<=254)return c=a.parseByte(),256*-(b-251)-c-108;throw new Error("Invalid b0 "+b)}function i(a){for(var b={},c=0;c<a.length;c+=1){var d,e=a[c][0],f=a[c][1];if(d=1===f.length?f[0]:f,b.hasOwnProperty(e))throw new Error("Object "+b+" already has key "+e);b[e]=d}return b}function j(a,b,c){b=void 0!==b?b:0;var d=new K.Parser(a,b),e=[],f=[];for(c=void 0!==c?c:a.length;d.relativeOffset<c;){var g=d.parseByte();g<=21?(12===g&&(g=1200+d.parseByte()),e.push([g,f]),f=[]):f.push(h(d,g))}return i(e)}function k(a,b){return b=b<=390?I.cffStandardStrings[b]:a[b-391]}function l(a,b,c){for(var d,e={},f=0;f<b.length;f+=1){var g=b[f];if(Array.isArray(g.type)){var h=[];h.length=g.type.length;for(var i=0;i<g.type.length;i++)d=void 0!==a[g.op]?a[g.op][i]:void 0,void 0===d&&(d=void 0!==g.value&&void 0!==g.value[i]?g.value[i]:null),"SID"===g.type[i]&&(d=k(c,d)),h[i]=d;e[g.name]=h}else d=a[g.op],void 0===d&&(d=void 0!==g.value?g.value:null),"SID"===g.type&&(d=k(c,d)),e[g.name]=d}return e}function m(a,b){var c={};return c.formatMajor=K.getCard8(a,b),c.formatMinor=K.getCard8(a,b+1),c.size=K.getCard8(a,b+2),c.offsetSize=K.getCard8(a,b+3),c.startOffset=b,c.endOffset=b+4,c}function n(a,b){return l(j(a,0,a.byteLength),N,b)}function o(a,b,c,d){return l(j(a,b,c),O,d)}function p(a,b,c,d){for(var g=[],h=0;h<c.length;h+=1){var i=new DataView(new Uint8Array(c[h]).buffer),j=n(i,d);j._subrs=[],j._subrsBias=0;var k=j.private[0],l=j.private[1];if(0!==k&&0!==l){var m=o(a,l+b,k,d);if(j._defaultWidthX=m.defaultWidthX,j._nominalWidthX=m.nominalWidthX,0!==m.subrs){var p=l+m.subrs,q=f(a,p+b);j._subrs=q.objects,j._subrsBias=e(j._subrs)}j._privateDict=m}g.push(j)}return g}function q(a,b,c,d){var e,f,g,h=new K.Parser(a,b);c-=1;var i=[".notdef"],j=h.parseCard8();if(0===j)for(e=0;e<c;e+=1)f=h.parseSID(),i.push(k(d,f));else if(1===j)for(;i.length<=c;)for(f=h.parseSID(),g=h.parseCard8(),e=0;e<=g;e+=1)i.push(k(d,f)),f+=1;else{if(2!==j)throw new Error("Unknown charset format "+j);for(;i.length<=c;)for(f=h.parseSID(),g=h.parseCard16(),e=0;e<=g;e+=1)i.push(k(d,f)),f+=1}return i}function r(a,b,c){var d,e,f={},g=new K.Parser(a,b),h=g.parseCard8();if(0===h){var i=g.parseCard8();for(d=0;d<i;d+=1)e=g.parseCard8(),f[e]=d}else{if(1!==h)throw new Error("Unknown encoding format "+h);var j=g.parseCard8();for(e=1,d=0;d<j;d+=1)for(var k=g.parseCard8(),l=g.parseCard8(),m=k;m<=k+l;m+=1)f[m]=e,e+=1}return new I.CffEncoding(f,c)}function s(a,b,c){function d(a,b){s&&o.closePath(),o.moveTo(a,b),s=!0}function e(){var a;a=p.length%2!=0,a&&!r&&(x=p.shift()+n),q+=p.length>>1,p.length=0,r=!0}function f(c){for(var m,v,w,y,z,A,B,C,D,E,F,G,H=0;H<c.length;){var I=c[H];switch(H+=1,I){case 1:e();break;case 3:e();break;case 4:p.length>1&&!r&&(x=p.shift()+n,r=!0),u+=p.pop(),d(t,u);break;case 5:for(;p.length>0;)t+=p.shift(),u+=p.shift(),o.lineTo(t,u);break;case 6:for(;p.length>0&&(t+=p.shift(),o.lineTo(t,u),0!==p.length);)u+=p.shift(),o.lineTo(t,u);break;case 7:for(;p.length>0&&(u+=p.shift(),o.lineTo(t,u),0!==p.length);)t+=p.shift(),o.lineTo(t,u);break;case 8:for(;p.length>0;)g=t+p.shift(),h=u+p.shift(),i=g+p.shift(),j=h+p.shift(),t=i+p.shift(),u=j+p.shift(),o.curveTo(g,h,i,j,t,u);break;case 10:z=p.pop()+l,A=k[z],A&&f(A);break;case 11:return;case 12:switch(I=c[H],H+=1,I){case 35:g=t+p.shift(),h=u+p.shift(),i=g+p.shift(),j=h+p.shift(),B=i+p.shift(),C=j+p.shift(),D=B+p.shift(),E=C+p.shift(),F=D+p.shift(),G=E+p.shift(),t=F+p.shift(),u=G+p.shift(),p.shift(),o.curveTo(g,h,i,j,B,C),o.curveTo(D,E,F,G,t,u);break;case 34:g=t+p.shift(),h=u,i=g+p.shift(),j=h+p.shift(),B=i+p.shift(),C=j,D=B+p.shift(),E=j,F=D+p.shift(),G=u,t=F+p.shift(),o.curveTo(g,h,i,j,B,C),o.curveTo(D,E,F,G,t,u);break;case 36:g=t+p.shift(),h=u+p.shift(),i=g+p.shift(),j=h+p.shift(),B=i+p.shift(),C=j,D=B+p.shift(),E=j,F=D+p.shift(),G=E+p.shift(),t=F+p.shift(),o.curveTo(g,h,i,j,B,C),o.curveTo(D,E,F,G,t,u);break;case 37:g=t+p.shift(),h=u+p.shift(),i=g+p.shift(),j=h+p.shift(),B=i+p.shift(),C=j+p.shift(),D=B+p.shift(),E=C+p.shift(),F=D+p.shift(),G=E+p.shift(),Math.abs(F-t)>Math.abs(G-u)?t=F+p.shift():u=G+p.shift(),o.curveTo(g,h,i,j,B,C),o.curveTo(D,E,F,G,t,u);break;default:console.log("Glyph "+b.index+": unknown operator 1200"+I),p.length=0}break;case 14:p.length>0&&!r&&(x=p.shift()+n,r=!0),s&&(o.closePath(),s=!1);break;case 18:e();break;case 19:case 20:e(),H+=q+7>>3;break;case 21:p.length>2&&!r&&(x=p.shift()+n,r=!0),u+=p.pop(),t+=p.pop(),d(t,u);break;case 22:p.length>1&&!r&&(x=p.shift()+n,r=!0),t+=p.pop(),d(t,u);break;case 23:e();break;case 24:for(;p.length>2;)g=t+p.shift(),h=u+p.shift(),i=g+p.shift(),j=h+p.shift(),t=i+p.shift(),u=j+p.shift(),o.curveTo(g,h,i,j,t,u);t+=p.shift(),u+=p.shift(),o.lineTo(t,u);break;case 25:for(;p.length>6;)t+=p.shift(),u+=p.shift(),o.lineTo(t,u);g=t+p.shift(),h=u+p.shift(),i=g+p.shift(),j=h+p.shift(),t=i+p.shift(),u=j+p.shift(),o.curveTo(g,h,i,j,t,u);break;case 26:for(p.length%2&&(t+=p.shift());p.length>0;)g=t,h=u+p.shift(),i=g+p.shift(),j=h+p.shift(),t=i,u=j+p.shift(),o.curveTo(g,h,i,j,t,u);break;case 27:for(p.length%2&&(u+=p.shift());p.length>0;)g=t+p.shift(),h=u,i=g+p.shift(),j=h+p.shift(),t=i+p.shift(),u=j,o.curveTo(g,h,i,j,t,u);break;case 28:m=c[H],v=c[H+1],p.push((m<<24|v<<16)>>16),H+=2;break;case 29:z=p.pop()+a.gsubrsBias,A=a.gsubrs[z],A&&f(A);break;case 30:for(;p.length>0&&(g=t,h=u+p.shift(),i=g+p.shift(),j=h+p.shift(),t=i+p.shift(),u=j+(1===p.length?p.shift():0),o.curveTo(g,h,i,j,t,u),0!==p.length);)g=t+p.shift(),h=u,i=g+p.shift(),j=h+p.shift(),u=j+p.shift(),t=i+(1===p.length?p.shift():0),o.curveTo(g,h,i,j,t,u);break;case 31:for(;p.length>0&&(g=t+p.shift(),h=u,i=g+p.shift(),j=h+p.shift(),u=j+p.shift(),t=i+(1===p.length?p.shift():0),o.curveTo(g,h,i,j,t,u),0!==p.length);)g=t,h=u+p.shift(),i=g+p.shift(),j=h+p.shift(),t=i+p.shift(),u=j+(1===p.length?p.shift():0),o.curveTo(g,h,i,j,t,u);break;default:I<32?console.log("Glyph "+b.index+": unknown operator "+I):I<247?p.push(I-139):I<251?(m=c[H],H+=1,p.push(256*(I-247)+m+108)):I<255?(m=c[H],H+=1,p.push(256*-(I-251)-m-108)):(m=c[H],v=c[H+1],w=c[H+2],y=c[H+3],H+=4,p.push((m<<24|v<<16|w<<8|y)/65536))}}}var g,h,i,j,k,l,m,n,o=new L.Path,p=[],q=0,r=!1,s=!1,t=0,u=0;if(a.isCIDFont){var v=a.tables.cff.topDict._fdSelect[b.index],w=a.tables.cff.topDict._fdArray[v];k=w._subrs,l=w._subrsBias,m=w._defaultWidthX,n=w._nominalWidthX}else k=a.tables.cff.topDict._subrs,l=a.tables.cff.topDict._subrsBias,m=a.tables.cff.topDict._defaultWidthX,n=a.tables.cff.topDict._nominalWidthX;var x=m;return f(c),b.advanceWidth=x,o}function t(a,b,c,d){var e,f=[],g=new K.Parser(a,b),h=g.parseCard8();if(0===h)for(var i=0;i<c;i++){if((e=g.parseCard8())>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+e+" (FD count "+d+")");f.push(e)}else{if(3!==h)throw new Error("CFF Table CID Font FDSelect table has unsupported format "+h);var j=g.parseCard16(),k=g.parseCard16();if(0!==k)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+k);for(var l,m=0;m<j;m++){if(e=g.parseCard8(),l=g.parseCard16(),e>=d)throw new Error("CFF table CID Font FDSelect has bad FD index value "+e+" (FD count "+d+")");if(l>c)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+l);for(;k<l;k++)f.push(e);k=l}if(l!==c)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final GID "+l)}return f}function u(a,b,c){c.tables.cff={};var d=m(a,b),g=f(a,d.endOffset,K.bytesToString),h=f(a,g.endOffset),i=f(a,h.endOffset,K.bytesToString),j=f(a,i.endOffset);c.gsubrs=j.objects,c.gsubrsBias=e(c.gsubrs);var k=p(a,b,h.objects,i.objects);if(1!==k.length)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+k.length);var l=k[0];if(c.tables.cff.topDict=l,l._privateDict&&(c.defaultWidthX=l._privateDict.defaultWidthX,c.nominalWidthX=l._privateDict.nominalWidthX),void 0!==l.ros[0]&&void 0!==l.ros[1]&&(c.isCIDFont=!0),c.isCIDFont){var n=l.fdArray,u=l.fdSelect;if(0===n||0===u)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");n+=b;var v=f(a,n),w=p(a,b,v.objects,i.objects);l._fdArray=w,u+=b,l._fdSelect=t(a,u,c.numGlyphs,w.length)}var x=b+l.private[1],y=o(a,x,l.private[0],i.objects);if(c.defaultWidthX=y.defaultWidthX,c.nominalWidthX=y.nominalWidthX,0!==y.subrs){var z=x+y.subrs,A=f(a,z);c.subrs=A.objects,c.subrsBias=e(c.subrs)}else c.subrs=[],c.subrsBias=0;var B=f(a,b+l.charStrings);c.nGlyphs=B.objects.length;var C=q(a,b+l.charset,c.nGlyphs,i.objects);0===l.encoding?c.cffEncoding=new I.CffEncoding(I.cffStandardEncoding,C):1===l.encoding?c.cffEncoding=new I.CffEncoding(I.cffExpertEncoding,C):c.cffEncoding=r(a,b+l.encoding,C),c.encoding=c.encoding||c.cffEncoding,c.glyphs=new J.GlyphSet(c);for(var D=0;D<c.nGlyphs;D+=1){var E=B.objects[D];c.glyphs.push(D,J.cffGlyphLoader(c,D,s,E))}}function v(a,b){var c,d=I.cffStandardStrings.indexOf(a);return d>=0&&(c=d),d=b.indexOf(a),d>=0?c=d+I.cffStandardStrings.length:(c=I.cffStandardStrings.length+b.length,b.push(a)),c}function w(){return new M.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}])}function x(a){var b=new M.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);b.names=[];for(var c=0;c<a.length;c+=1)b.names.push({name:"name_"+c,type:"NAME",value:a[c]});return b}function y(a,b,c){for(var e={},f=0;f<a.length;f+=1){var g=a[f],h=b[g.name];void 0===h||d(h,g.value)||("SID"===g.type&&(h=v(h,c)),e[g.op]={name:g.name,type:g.type,value:h})}return e}function z(a,b){var c=new M.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return c.dict=y(N,a,b),c}function A(a){var b=new M.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return b.topDicts=[{name:"topDict_0",type:"TABLE",value:a}],b}function B(a){var b=new M.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);b.strings=[];for(var c=0;c<a.length;c+=1)b.strings.push({name:"string_"+c,type:"STRING",value:a[c]});return b}function C(){return new M.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}])}function D(a,b){for(var c=new M.Record("Charsets",[{name:"format",type:"Card8",value:0}]),d=0;d<a.length;d+=1){var e=a[d],f=v(e,b);c.fields.push({name:"glyph_"+d,type:"SID",value:f})}return c}function E(a){var b=[],c=a.path;b.push({name:"width",type:"NUMBER",value:a.advanceWidth});for(var d=0,e=0,f=0;f<c.commands.length;f+=1){var g,h,i=c.commands[f];if("Q"===i.type){var j=1/3,k=2/3;i={type:"C",x:i.x,y:i.y,x1:j*d+k*i.x1,y1:j*e+k*i.y1,x2:j*i.x+k*i.x1,y2:j*i.y+k*i.y1}}if("M"===i.type)g=Math.round(i.x-d),h=Math.round(i.y-e),b.push({name:"dx",type:"NUMBER",value:g}),b.push({name:"dy",type:"NUMBER",value:h}),b.push({name:"rmoveto",type:"OP",value:21}),d=Math.round(i.x),e=Math.round(i.y);else if("L"===i.type)g=Math.round(i.x-d),h=Math.round(i.y-e),b.push({name:"dx",type:"NUMBER",value:g}),b.push({name:"dy",type:"NUMBER",value:h}),b.push({name:"rlineto",type:"OP",value:5}),d=Math.round(i.x),e=Math.round(i.y);else if("C"===i.type){var l=Math.round(i.x1-d),m=Math.round(i.y1-e),n=Math.round(i.x2-i.x1),o=Math.round(i.y2-i.y1);g=Math.round(i.x-i.x2),h=Math.round(i.y-i.y2),b.push({name:"dx1",type:"NUMBER",value:l}),b.push({name:"dy1",type:"NUMBER",value:m}),b.push({name:"dx2",type:"NUMBER",value:n}),b.push({name:"dy2",type:"NUMBER",value:o}),b.push({name:"dx",type:"NUMBER",value:g}),b.push({name:"dy",type:"NUMBER",value:h}),b.push({name:"rrcurveto",type:"OP",value:8}),d=Math.round(i.x),e=Math.round(i.y)}}return b.push({name:"endchar",type:"OP",value:14}),b}function F(a){for(var b=new M.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]),c=0;c<a.length;c+=1){var d=a.get(c),e=E(d);b.charStrings.push({name:d.name,type:"CHARSTRING",value:e})}return b}function G(a,b){var c=new M.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return c.dict=y(O,a,b),c}function H(a,b){for(var c,d=new M.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),e=1/b.unitsPerEm,f={version:b.version,fullName:b.fullName,familyName:b.familyName,weight:b.weightName,fontBBox:b.fontBBox||[0,0,0,0],fontMatrix:[e,0,0,e,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},g={},h=[],i=1;i<a.length;i+=1)c=a.get(i),h.push(c.name);var j=[];d.header=w(),d.nameIndex=x([b.postScriptName]);var k=z(f,j);d.topDictIndex=A(k),d.globalSubrIndex=C(),d.charsets=D(h,j),d.charStringsIndex=F(a),d.privateDict=G(g,j),d.stringIndex=B(j);var l=d.header.sizeOf()+d.nameIndex.sizeOf()+d.topDictIndex.sizeOf()+d.stringIndex.sizeOf()+d.globalSubrIndex.sizeOf();return f.charset=l,f.encoding=0,f.charStrings=f.charset+d.charsets.sizeOf(),f.private[1]=f.charStrings+d.charStringsIndex.sizeOf(),k=z(f,j),d.topDictIndex=A(k),d}var I=a("../encoding"),J=a("../glyphset"),K=a("../parse"),L=a("../path"),M=a("../table"),N=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2},{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],O=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}];c.parse=u,c.make=H},{"../encoding":12,"../glyphset":15,"../parse":19,"../path":20,"../table":22}],24:[function(a,b,c){"use strict";function d(a,b){var c;b.parseUShort(),a.length=b.parseULong(),a.language=b.parseULong();var d;for(a.groupCount=d=b.parseULong(),a.glyphIndexMap={},c=0;c<d;c+=1)for(var e=b.parseULong(),f=b.parseULong(),g=b.parseULong(),h=e;h<=f;h+=1)a.glyphIndexMap[h]=g,g++}function e(a,b,c,d,e){var f;a.length=b.parseUShort(),a.language=b.parseUShort();var g;a.segCount=g=b.parseUShort()>>1,b.skip("uShort",3),a.glyphIndexMap={};var h=new k.Parser(c,d+e+14),i=new k.Parser(c,d+e+16+2*g),j=new k.Parser(c,d+e+16+4*g),l=new k.Parser(c,d+e+16+6*g),m=d+e+16+8*g;for(f=0;f<g-1;f+=1)for(var n,o=h.parseUShort(),p=i.parseUShort(),q=j.parseShort(),r=l.parseUShort(),s=p;s<=o;s+=1)0!==r?(m=l.offset+l.relativeOffset-2,m+=r,m+=2*(s-p),0!==(n=k.getUShort(c,m))&&(n=n+q&65535)):n=s+q&65535,a.glyphIndexMap[s]=n}function f(a,b){var c,f={};f.version=k.getUShort(a,b),j.argument(0===f.version,"cmap table version should be 0."),f.numTables=k.getUShort(a,b+2);var g=-1;for(c=f.numTables-1;c>=0;c-=1){var h=k.getUShort(a,b+4+8*c),i=k.getUShort(a,b+4+8*c+2);if(3===h&&(0===i||1===i||10===i)){g=k.getULong(a,b+4+8*c+4);break}}if(g===-1)throw new Error("No valid cmap sub-tables found.");var l=new k.Parser(a,b+g);if(f.format=l.parseUShort(),12===f.format)d(f,l);else{if(4!==f.format)throw new Error("Only format 4 and 12 cmap tables are supported (found format "+f.format+").");e(f,l,a,b,g)}return f}function g(a,b,c){a.segments.push({end:b,start:b,delta:-(b-c),offset:0})}function h(a){a.segments.push({end:65535,start:65535,delta:1,offset:0})}function i(a){var b,c=new l.Table("cmap",[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:1},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:12},{name:"format",type:"USHORT",value:4},{name:"length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);for(c.segments=[],b=0;b<a.length;b+=1){for(var d=a.get(b),e=0;e<d.unicodes.length;e+=1)g(c,d.unicodes[e],b);c.segments=c.segments.sort(function(a,b){return a.start-b.start})}h(c);var f;f=c.segments.length,c.segCountX2=2*f,c.searchRange=2*Math.pow(2,Math.floor(Math.log(f)/Math.log(2))),c.entrySelector=Math.log(c.searchRange/2)/Math.log(2),c.rangeShift=c.segCountX2-c.searchRange;var i=[],j=[],k=[],m=[],n=[];for(b=0;b<f;b+=1){var o=c.segments[b];i=i.concat({name:"end_"+b,type:"USHORT",value:o.end}),j=j.concat({name:"start_"+b,type:"USHORT",value:o.start}),k=k.concat({name:"idDelta_"+b,type:"SHORT",value:o.delta}),m=m.concat({name:"idRangeOffset_"+b,type:"USHORT",value:o.offset}),void 0!==o.glyphId&&(n=n.concat({name:"glyph_"+b,type:"USHORT",value:o.glyphId}))}return c.fields=c.fields.concat(i),c.fields.push({name:"reservedPad",type:"USHORT",value:0}),c.fields=c.fields.concat(j),c.fields=c.fields.concat(k),c.fields=c.fields.concat(m),c.fields=c.fields.concat(n),c.length=14+2*i.length+2+2*j.length+2*k.length+2*m.length+2*n.length,c}var j=a("../check"),k=a("../parse"),l=a("../table");c.parse=f,c.make=i},{"../check":10,"../parse":19,"../table":22}],25:[function(a,b,c){"use strict";function d(a,b){var c=JSON.stringify(a),d=256;for(var e in b){var f=parseInt(e);if(f&&!(f<256)){if(JSON.stringify(b[e])===c)return f;d<=f&&(d=f+1)}}return b[d]=a,d}function e(a,b,c){var e=d(b.name,c);return[{name:"tag_"+a,type:"TAG",value:b.tag},{name:"minValue_"+a,type:"FIXED",value:b.minValue<<16},{name:"defaultValue_"+a,type:"FIXED",value:b.defaultValue<<16},{name:"maxValue_"+a,type:"FIXED",value:b.maxValue<<16},{name:"flags_"+a,type:"USHORT",value:0},{name:"nameID_"+a,type:"USHORT",value:e}]}function f(a,b,c){var d={},e=new l.Parser(a,b);return d.tag=e.parseTag(),d.minValue=e.parseFixed(),d.defaultValue=e.parseFixed(),d.maxValue=e.parseFixed(),e.skip("uShort",1),d.name=c[e.parseUShort()]||{},d}function g(a,b,c,e){for(var f=d(b.name,e),g=[{name:"nameID_"+a,type:"USHORT",value:f},{name:"flags_"+a,type:"USHORT",value:0}],h=0;h<c.length;++h){var i=c[h].tag;g.push({name:"axis_"+a+" "+i,type:"FIXED",value:b.coordinates[i]<<16})}return g}function h(a,b,c,d){var e={},f=new l.Parser(a,b);e.name=d[f.parseUShort()]||{},f.skip("uShort",1),e.coordinates={};for(var g=0;g<c.length;++g)e.coordinates[c[g].tag]=f.parseFixed();return e}function i(a,b){var c=new m.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:a.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:a.instances.length},{name:"instanceSize",type:"USHORT",value:4+4*a.axes.length}]);c.offsetToData=c.sizeOf();for(var d=0;d<a.axes.length;d++)c.fields=c.fields.concat(e(d,a.axes[d],b));for(var f=0;f<a.instances.length;f++)c.fields=c.fields.concat(g(f,a.instances[f],a.axes,b));return c}function j(a,b,c){var d=new l.Parser(a,b),e=d.parseULong();k.argument(65536===e,"Unsupported fvar table version.");var g=d.parseOffset16();d.skip("uShort",1);for(var i=d.parseUShort(),j=d.parseUShort(),m=d.parseUShort(),n=d.parseUShort(),o=[],p=0;p<i;p++)o.push(f(a,b+g+p*j,c));for(var q=[],r=b+g+i*j,s=0;s<m;s++)q.push(h(a,r+s*n,o,c));return{axes:o,instances:q}}var k=a("../check"),l=a("../parse"),m=a("../table");c.make=i,c.parse=j},{"../check":10,"../parse":19,"../table":22}],26:[function(a,b,c){"use strict";function d(a,b,c,d,e){var f;return(b&d)>0?(f=a.parseByte(),0==(b&e)&&(f=-f),f=c+f):f=(b&e)>0?c:c+a.parseShort(),f}function e(a,b,c){var e=new m.Parser(b,c);a.numberOfContours=e.parseShort(),a._xMin=e.parseShort(),a._yMin=e.parseShort(),a._xMax=e.parseShort(),a._yMax=e.parseShort();var f,g,h;if(a.numberOfContours>0){var i=a.endPointIndices=[];for(h=0;h<a.numberOfContours;h+=1)i.push(e.parseUShort());for(a.instructionLength=e.parseUShort(),a.instructions=[],h=0;h<a.instructionLength;h+=1)a.instructions.push(e.parseByte());var j=i[i.length-1]+1;for(f=[],h=0;h<j;h+=1)if(g=e.parseByte(),f.push(g),(8&g)>0)for(var l=e.parseByte(),n=0;n<l;n+=1)f.push(g),h+=1;if(k.argument(f.length===j,"Bad flags."),i.length>0){var o,p=[];if(j>0){for(h=0;h<j;h+=1)g=f[h],o={},o.onCurve=!!(1&g),o.lastPointOfContour=i.indexOf(h)>=0,p.push(o);var q=0;for(h=0;h<j;h+=1)g=f[h],o=p[h],o.x=d(e,g,q,2,16),q=o.x;var r=0;for(h=0;h<j;h+=1)g=f[h],o=p[h],o.y=d(e,g,r,4,32),r=o.y}a.points=p}else a.points=[]}else if(0===a.numberOfContours)a.points=[];else{a.isComposite=!0,a.points=[],a.components=[];for(var s=!0;s;){f=e.parseUShort();var t={glyphIndex:e.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(1&f)>0?(2&f)>0?(t.dx=e.parseShort(),t.dy=e.parseShort()):t.matchedPoints=[e.parseUShort(),e.parseUShort()]:(2&f)>0?(t.dx=e.parseChar(),t.dy=e.parseChar()):t.matchedPoints=[e.parseByte(),e.parseByte()],(8&f)>0?t.xScale=t.yScale=e.parseF2Dot14():(64&f)>0?(t.xScale=e.parseF2Dot14(),t.yScale=e.parseF2Dot14()):(128&f)>0&&(t.xScale=e.parseF2Dot14(),t.scale01=e.parseF2Dot14(),t.scale10=e.parseF2Dot14(),t.yScale=e.parseF2Dot14()),a.components.push(t),s=!!(32&f)}if(256&f)for(a.instructionLength=e.parseUShort(),a.instructions=[],h=0;h<a.instructionLength;h+=1)a.instructions.push(e.parseByte())}}function f(a,b){for(var c=[],d=0;d<a.length;d+=1){var e=a[d],f={x:b.xScale*e.x+b.scale01*e.y+b.dx,y:b.scale10*e.x+b.yScale*e.y+b.dy,onCurve:e.onCurve,lastPointOfContour:e.lastPointOfContour};c.push(f)}return c}function g(a){for(var b=[],c=[],d=0;d<a.length;d+=1){var e=a[d];c.push(e),e.lastPointOfContour&&(b.push(c),c=[])}return k.argument(0===c.length,"There are still points left in the current contour."),b}function h(a){var b=new n.Path;if(!a)return b;for(var c=g(a),d=0;d<c.length;++d){var e=c[d],f=null,h=e[e.length-1],i=e[0];if(h.onCurve)b.moveTo(h.x,h.y);else if(i.onCurve)b.moveTo(i.x,i.y);else{var j={x:.5*(h.x+i.x),y:.5*(h.y+i.y)};b.moveTo(j.x,j.y)}for(var k=0;k<e.length;++k)if(f=h,h=i,i=e[(k+1)%e.length],h.onCurve)b.lineTo(h.x,h.y);else{var l=f,m=i;f.onCurve||(l={x:.5*(h.x+f.x),y:.5*(h.y+f.y)},b.lineTo(l.x,l.y)),i.onCurve||(m={x:.5*(h.x+i.x),y:.5*(h.y+i.y)}),b.lineTo(l.x,l.y),b.quadraticCurveTo(h.x,h.y,m.x,m.y)}}return b.closePath(),b}function i(a,b){if(b.isComposite)for(var c=0;c<b.components.length;c+=1){var d=b.components[c],e=a.get(d.glyphIndex);if(e.getPath(),e.points){var g;if(void 0===d.matchedPoints)g=f(e.points,d);else{if(d.matchedPoints[0]>b.points.length-1||d.matchedPoints[1]>e.points.length-1)throw Error("Matched points out of range in "+b.name);var i=b.points[d.matchedPoints[0]],j=e.points[d.matchedPoints[1]],k={xScale:d.xScale,scale01:d.scale01,scale10:d.scale10,yScale:d.yScale,dx:0,dy:0};j=f([j],k)[0],k.dx=i.x-j.x,k.dy=i.y-j.y,g=f(e.points,k)}b.points=b.points.concat(g)}}return h(b.points)}function j(a,b,c,d){var f,g=new l.GlyphSet(d);for(f=0;f<c.length-1;f+=1){var h=c[f];h!==c[f+1]?g.push(f,l.ttfGlyphLoader(d,f,e,a,b+h,i)):g.push(f,l.glyphLoader(d,f))}return g}var k=a("../check"),l=a("../glyphset"),m=a("../parse"),n=a("../path");c.getPath=h,c.parse=j},{"../check":10,"../glyphset":15,"../parse":19,"../path":20}],27:[function(a,b,c){"use strict";function d(a,b){for(var c=new k.Parser(a,b),d=c.parseUShort(),e=[],f=0;f<d;f++)e[c.parseTag()]={offset:c.parseUShort()};return e}function e(a,b){var c=new k.Parser(a,b),d=c.parseUShort(),e=c.parseUShort();if(1===d)return c.parseUShortList(e);if(2===d){for(var f=[];e--;)for(var g=c.parseUShort(),h=c.parseUShort(),i=c.parseUShort(),j=g;j<=h;j++)f[i++]=j;return f}}function f(a,b){var c=new k.Parser(a,b),d=c.parseUShort();if(1===d){var e=c.parseUShort(),f=c.parseUShort(),g=c.parseUShortList(f);return function(a){return g[a-e]||0}}if(2===d){for(var h=c.parseUShort(),i=[],j=[],l=[],m=0;m<h;m++)i[m]=c.parseUShort(),j[m]=c.parseUShort(),l[m]=c.parseUShort();return function(a){for(var b=0,c=i.length-1;b<c;){var d=b+c+1>>1;a<i[d]?c=d-1:b=d}return i[b]<=a&&a<=j[b]?l[b]||0:0}}}function g(a,b){var c,d=new k.Parser(a,b),g=d.parseUShort(),h=d.parseUShort(),i=e(a,b+h),j=d.parseUShort(),l=d.parseUShort();if(4===j&&0===l){var m={};if(1===g){for(var n=d.parseUShort(),o=[],p=d.parseOffset16List(n),q=0;q<n;q++){var r=p[q],s=m[r];if(!s){s={},d.relativeOffset=r;for(var t=d.parseUShort();t--;){var u=d.parseUShort();j&&(c=d.parseShort()),l&&d.parseShort(),s[u]=c}}o[i[q]]=s}return function(a,b){var c=o[a];if(c)return c[b]}}if(2===g){for(var v=d.parseUShort(),w=d.parseUShort(),x=d.parseUShort(),y=d.parseUShort(),z=f(a,b+v),A=f(a,b+w),B=[],C=0;C<x;C++)for(var D=B[C]=[],E=0;E<y;E++)j&&(c=d.parseShort()),l&&d.parseShort(),D[E]=c;var F={}
;for(C=0;C<i.length;C++)F[i[C]]=1;return function(a,b){if(F[a]){var c=z(a),d=A(b),e=B[c];return e?e[d]:void 0}}}}}function h(a,b){var c=new k.Parser(a,b),d=c.parseUShort(),e=c.parseUShort(),f=16&e,h=c.parseUShort(),i=c.parseOffset16List(h),j={lookupType:d,lookupFlag:e,markFilteringSet:f?c.parseUShort():-1};if(2===d){for(var l=[],m=0;m<h;m++){var n=g(a,b+i[m]);n&&l.push(n)}j.getKerningValue=function(a,b){for(var c=l.length;c--;){var d=l[c](a,b);if(void 0!==d)return d}return 0}}return j}function i(a,b,c){var e=new k.Parser(a,b),f=e.parseFixed();j.argument(1===f,"Unsupported GPOS table version."),d(a,b+e.parseUShort()),d(a,b+e.parseUShort());var g=e.parseUShort();e.relativeOffset=g;for(var i=e.parseUShort(),l=e.parseOffset16List(i),m=b+g,n=0;n<i;n++){var o=h(a,m+l[n]);2!==o.lookupType||c.getGposKerningValue||(c.getGposKerningValue=o.getKerningValue)}}var j=a("../check"),k=a("../parse");c.parse=i},{"../check":10,"../parse":19}],28:[function(a,b,c){"use strict";function d(a,b){b=b||0;var c=new g(a,b),d=c.parseVersion();return f.argument(1===d,"Unsupported GSUB table version."),{version:d,scripts:c.parseScriptList(),features:c.parseFeatureList(),lookups:c.parseLookupList(h)}}function e(a){return new i.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new i.ScriptList(a.scripts)},{name:"features",type:"TABLE",value:new i.FeatureList(a.features)},{name:"lookups",type:"TABLE",value:new i.LookupList(a.lookups,k)}])}var f=a("../check"),g=a("../parse").Parser,h=new Array(9),i=a("../table");h[1]=function(){var a=this.offset+this.relativeOffset,b=this.parseUShort();return 1===b?{substFormat:1,coverage:this.parsePointer(g.coverage),deltaGlyphId:this.parseUShort()}:2===b?{substFormat:2,coverage:this.parsePointer(g.coverage),substitute:this.parseOffset16List()}:void f.assert(!1,"0x"+a.toString(16)+": lookup type 1 format must be 1 or 2.")},h[2]=function(){var a=this.parseUShort();return f.argument(1===a,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:a,coverage:this.parsePointer(g.coverage),sequences:this.parseListOfLists()}},h[3]=function(){var a=this.parseUShort();return f.argument(1===a,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:a,coverage:this.parsePointer(g.coverage),alternateSets:this.parseListOfLists()}},h[4]=function(){var a=this.parseUShort();return f.argument(1===a,"GSUB ligature table identifier-format must be 1"),{substFormat:a,coverage:this.parsePointer(g.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var j={sequenceIndex:g.uShort,lookupListIndex:g.uShort};h[5]=function(){var a=this.offset+this.relativeOffset,b=this.parseUShort();if(1===b)return{substFormat:b,coverage:this.parsePointer(g.coverage),ruleSets:this.parseListOfLists(function(){var a=this.parseUShort(),b=this.parseUShort();return{input:this.parseUShortList(a-1),lookupRecords:this.parseRecordList(b,j)}})};if(2===b)return{substFormat:b,coverage:this.parsePointer(g.coverage),classDef:this.parsePointer(g.classDef),classSets:this.parseListOfLists(function(){var a=this.parseUShort(),b=this.parseUShort();return{classes:this.parseUShortList(a-1),lookupRecords:this.parseRecordList(b,j)}})};if(3===b){var c=this.parseUShort(),d=this.parseUShort();return{substFormat:b,coverages:this.parseList(c,g.pointer(g.coverage)),lookupRecords:this.parseRecordList(d,j)}}f.assert(!1,"0x"+a.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},h[6]=function(){var a=this.offset+this.relativeOffset,b=this.parseUShort();return 1===b?{substFormat:1,coverage:this.parsePointer(g.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(j)}})}:2===b?{substFormat:2,coverage:this.parsePointer(g.coverage),backtrackClassDef:this.parsePointer(g.classDef),inputClassDef:this.parsePointer(g.classDef),lookaheadClassDef:this.parsePointer(g.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(j)}})}:3===b?{substFormat:3,backtrackCoverage:this.parseList(g.pointer(g.coverage)),inputCoverage:this.parseList(g.pointer(g.coverage)),lookaheadCoverage:this.parseList(g.pointer(g.coverage)),lookupRecords:this.parseRecordList(j)}:void f.assert(!1,"0x"+a.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},h[7]=function(){var a=this.parseUShort();f.argument(1===a,"GSUB Extension Substitution subtable identifier-format must be 1");var b=this.parseUShort(),c=new g(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:b,extension:h[b].call(c)}},h[8]=function(){var a=this.parseUShort();return f.argument(1===a,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:a,coverage:this.parsePointer(g.coverage),backtrackCoverage:this.parseList(g.pointer(g.coverage)),lookaheadCoverage:this.parseList(g.pointer(g.coverage)),substitutes:this.parseUShortList()}};var k=new Array(9);k[1]=function(a){return 1===a.substFormat?new i.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new i.Coverage(a.coverage)},{name:"deltaGlyphID",type:"USHORT",value:a.deltaGlyphId}]):new i.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new i.Coverage(a.coverage)}].concat(i.ushortList("substitute",a.substitute)))},k[3]=function(a){return f.assert(1===a.substFormat,"Lookup type 3 substFormat must be 1."),new i.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new i.Coverage(a.coverage)}].concat(i.tableList("altSet",a.alternateSets,function(a){return new i.Table("alternateSetTable",i.ushortList("alternate",a))})))},k[4]=function(a){return f.assert(1===a.substFormat,"Lookup type 4 substFormat must be 1."),new i.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new i.Coverage(a.coverage)}].concat(i.tableList("ligSet",a.ligatureSets,function(a){return new i.Table("ligatureSetTable",i.tableList("ligature",a,function(a){return new i.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:a.ligGlyph}].concat(i.ushortList("component",a.components,a.components.length+1)))}))})))},c.parse=d,c.make=e},{"../check":10,"../parse":19,"../table":22}],29:[function(a,b,c){"use strict";function d(a,b){var c={},d=new g.Parser(a,b);return c.version=d.parseVersion(),c.fontRevision=Math.round(1e3*d.parseFixed())/1e3,c.checkSumAdjustment=d.parseULong(),c.magicNumber=d.parseULong(),f.argument(1594834165===c.magicNumber,"Font header has wrong magic number."),c.flags=d.parseUShort(),c.unitsPerEm=d.parseUShort(),c.created=d.parseLongDateTime(),c.modified=d.parseLongDateTime(),c.xMin=d.parseShort(),c.yMin=d.parseShort(),c.xMax=d.parseShort(),c.yMax=d.parseShort(),c.macStyle=d.parseUShort(),c.lowestRecPPEM=d.parseUShort(),c.fontDirectionHint=d.parseShort(),c.indexToLocFormat=d.parseShort(),c.glyphDataFormat=d.parseShort(),c}function e(a){var b=Math.round((new Date).getTime()/1e3)+2082844800,c=b;return a.createdTimestamp&&(c=a.createdTimestamp+2082844800),new h.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:c},{name:"modified",type:"LONGDATETIME",value:b},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],a)}var f=a("../check"),g=a("../parse"),h=a("../table");c.parse=d,c.make=e},{"../check":10,"../parse":19,"../table":22}],30:[function(a,b,c){"use strict";function d(a,b){var c={},d=new f.Parser(a,b);return c.version=d.parseVersion(),c.ascender=d.parseShort(),c.descender=d.parseShort(),c.lineGap=d.parseShort(),c.advanceWidthMax=d.parseUShort(),c.minLeftSideBearing=d.parseShort(),c.minRightSideBearing=d.parseShort(),c.xMaxExtent=d.parseShort(),c.caretSlopeRise=d.parseShort(),c.caretSlopeRun=d.parseShort(),c.caretOffset=d.parseShort(),d.relativeOffset+=8,c.metricDataFormat=d.parseShort(),c.numberOfHMetrics=d.parseUShort(),c}function e(a){return new g.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],a)}var f=a("../parse"),g=a("../table");c.parse=d,c.make=e},{"../parse":19,"../table":22}],31:[function(a,b,c){"use strict";function d(a,b,c,d,e){for(var g,h,i=new f.Parser(a,b),j=0;j<d;j+=1){j<c&&(g=i.parseUShort(),h=i.parseShort());var k=e.get(j);k.advanceWidth=g,k.leftSideBearing=h}}function e(a){for(var b=new g.Table("hmtx",[]),c=0;c<a.length;c+=1){var d=a.get(c),e=d.advanceWidth||0,f=d.leftSideBearing||0;b.fields.push({name:"advanceWidth_"+c,type:"USHORT",value:e}),b.fields.push({name:"leftSideBearing_"+c,type:"SHORT",value:f})}return b}var f=a("../parse"),g=a("../table");c.parse=d,c.make=e},{"../parse":19,"../table":22}],32:[function(a,b,c){"use strict";function d(a){var b={};a.skip("uShort");var c=a.parseUShort();g.argument(0===c,"Unsupported kern sub-table version."),a.skip("uShort",2);var d=a.parseUShort();a.skip("uShort",3);for(var e=0;e<d;e+=1){var f=a.parseUShort(),h=a.parseUShort(),i=a.parseShort();b[f+","+h]=i}return b}function e(a){var b={};a.skip("uShort"),a.parseULong()>1&&console.warn("Only the first kern subtable is supported."),a.skip("uLong");var c=a.parseUShort(),d=255&c;if(a.skip("uShort"),0===d){var e=a.parseUShort();a.skip("uShort",3);for(var f=0;f<e;f+=1){var g=a.parseUShort(),h=a.parseUShort(),i=a.parseShort();b[g+","+h]=i}}return b}function f(a,b){var c=new h.Parser(a,b),f=c.parseUShort();if(0===f)return d(c);if(1===f)return e(c);throw new Error("Unsupported kern table version ("+f+").")}var g=a("../check"),h=a("../parse");c.parse=f},{"../check":10,"../parse":19}],33:[function(a,b,c){"use strict";function d(a,b,c,d){for(var f=new e.Parser(a,b),g=d?f.parseUShort:f.parseULong,h=[],i=0;i<c+1;i+=1){var j=g.call(f);d&&(j*=2),h.push(j)}return h}var e=a("../parse");c.parse=d},{"../parse":19}],34:[function(a,b,c){"use strict";function d(a){for(var b=new h.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:a.length}]),c="",d=12+4*a.length,e=0;e<a.length;++e){var f=c.indexOf(a[e]);f<0&&(f=c.length,c+=a[e]),b.fields.push({name:"offset "+e,type:"USHORT",value:d+f}),b.fields.push({name:"length "+e,type:"USHORT",value:a[e].length})}return b.fields.push({name:"stringPool",type:"CHARARRAY",value:c}),b}function e(a,b){var c=new g.Parser(a,b),d=c.parseULong();f.argument(1===d,"Unsupported ltag table version."),c.skip("uLong",1);for(var e=c.parseULong(),h=[],i=0;i<e;i++){for(var j="",k=b+c.parseUShort(),l=c.parseUShort(),m=k;m<k+l;++m)j+=String.fromCharCode(a.getInt8(m));h.push(j)}return h}var f=a("../check"),g=a("../parse"),h=a("../table");c.make=d,c.parse=e},{"../check":10,"../parse":19,"../table":22}],35:[function(a,b,c){"use strict";function d(a,b){var c={},d=new f.Parser(a,b);return c.version=d.parseVersion(),c.numGlyphs=d.parseUShort(),1===c.version&&(c.maxPoints=d.parseUShort(),c.maxContours=d.parseUShort(),c.maxCompositePoints=d.parseUShort(),c.maxCompositeContours=d.parseUShort(),c.maxZones=d.parseUShort(),c.maxTwilightPoints=d.parseUShort(),c.maxStorage=d.parseUShort(),c.maxFunctionDefs=d.parseUShort(),c.maxInstructionDefs=d.parseUShort(),c.maxStackElements=d.parseUShort(),c.maxSizeOfInstructions=d.parseUShort(),c.maxComponentElements=d.parseUShort(),c.maxComponentDepth=d.parseUShort()),c}function e(a){return new g.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:a}])}var f=a("../parse"),g=a("../table");c.parse=d,c.make=e},{"../parse":19,"../table":22}],36:[function(a,b,c){"use strict";function d(a,b){var c=new i.Parser(a,b),d=c.parseULong();h.argument(1===d,"Unsupported META table version."),c.parseULong(),c.parseULong();for(var e=c.parseULong(),f={},j=0;j<e;j++){var k=c.parseTag(),l=c.parseULong(),m=c.parseULong(),n=g.UTF8(a,b+l,m);f[k]=n}return f}function e(a){var b=Object.keys(a).length,c="",d=16+12*b,e=new j.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:d},{name:"numTags",type:"ULONG",value:b}]);for(var f in a){var g=c.length;c+=a[f],e.fields.push({name:"tag "+f,type:"TAG",value:f}),e.fields.push({name:"offset "+f,type:"ULONG",value:d+g}),e.fields.push({name:"length "+f,type:"ULONG",value:a[f].length})}return e.fields.push({name:"stringPool",type:"CHARARRAY",value:c}),e}var f=a("../types"),g=f.decode,h=a("../check"),i=a("../parse"),j=a("../table");c.parse=d,c.make=e},{"../check":10,"../parse":19,"../table":22,"../types":41}],37:[function(a,b,c){"use strict";function d(a,b,c){switch(a){case 0:if(65535===b)return"und";if(c)return c[b];break;case 1:return r[b];case 3:return t[b]}}function e(a,b,c){switch(a){case 0:return u;case 1:return w[c]||v[b];case 3:if(1===b||10===b)return u}}function f(a,b,c){for(var f={},g=new o.Parser(a,b),h=g.parseUShort(),i=g.parseUShort(),j=g.offset+g.parseUShort(),k=0;k<i;k++){var l=g.parseUShort(),n=g.parseUShort(),p=g.parseUShort(),r=g.parseUShort(),s=q[r]||r,t=g.parseUShort(),v=g.parseUShort(),w=d(l,p,c),x=e(l,n,p);if(void 0!==x&&void 0!==w){var y;if(y=x===u?m.UTF16(a,j+v,t):m.MACSTRING(a,j+v,t,x)){var z=f[s];void 0===z&&(z=f[s]={}),z[w]=y}}}return 1===h&&g.parseUShort(),f}function g(a){var b={};for(var c in a)b[a[c]]=parseInt(c);return b}function h(a,b,c,d,e,f){return new p.Record("NameRecord",[{name:"platformID",type:"USHORT",value:a},{name:"encodingID",type:"USHORT",value:b},{name:"languageID",type:"USHORT",value:c},{name:"nameID",type:"USHORT",value:d},{name:"length",type:"USHORT",value:e},{name:"offset",type:"USHORT",value:f}])}function i(a,b){var c=a.length,d=b.length-c+1;a:for(var e=0;e<d;e++)for(;e<d;e++){for(var f=0;f<c;f++)if(b[e+f]!==a[f])continue a;return e}return-1}function j(a,b){var c=i(a,b);if(c<0){c=b.length;for(var d=0,e=a.length;d<e;++d)b.push(a[d])}return c}function k(a,b){var c,d=[],f={},i=g(q);for(var k in a){var l=i[k];if(void 0===l&&(l=k),c=parseInt(l),isNaN(c))throw new Error('Name table entry "'+k+'" does not exist, see nameTableNames for complete list.');f[c]=a[k],d.push(c)}for(var m=g(r),o=g(t),u=[],v=[],w=0;w<d.length;w++){c=d[w];var x=f[c];for(var y in x){var z=x[y],A=1,B=m[y],C=s[B],D=e(A,C,B),E=n.MACSTRING(z,D);void 0===E&&(A=0,B=b.indexOf(y),B<0&&(B=b.length,b.push(y)),C=4,E=n.UTF16(z));var F=j(E,v);u.push(h(A,C,B,c,E.length,F));var G=o[y];if(void 0!==G){var H=n.UTF16(z),I=j(H,v);u.push(h(3,1,G,c,H.length,I))}}}u.sort(function(a,b){return a.platformID-b.platformID||a.encodingID-b.encodingID||a.languageID-b.languageID||a.nameID-b.nameID});for(var J=new p.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:u.length},{name:"stringOffset",type:"USHORT",value:6+12*u.length}]),K=0;K<u.length;K++)J.fields.push({name:"record_"+K,type:"RECORD",value:u[K]});return J.fields.push({name:"strings",type:"LITERAL",value:v}),J}var l=a("../types"),m=l.decode,n=l.encode,o=a("../parse"),p=a("../table"),q=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],r={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},s={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},t={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",1040:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"},u="utf-16",v={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},w={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};c.parse=f,c.make=k},{"../parse":19,"../table":22,"../types":41}],38:[function(a,b,c){"use strict";function d(a){for(var b=0;b<i.length;b+=1){var c=i[b];if(a>=c.begin&&a<c.end)return b}return-1}function e(a,b){var c={},d=new g.Parser(a,b);c.version=d.parseUShort(),c.xAvgCharWidth=d.parseShort(),c.usWeightClass=d.parseUShort(),c.usWidthClass=d.parseUShort(),c.fsType=d.parseUShort(),c.ySubscriptXSize=d.parseShort(),c.ySubscriptYSize=d.parseShort(),c.ySubscriptXOffset=d.parseShort(),c.ySubscriptYOffset=d.parseShort(),c.ySuperscriptXSize=d.parseShort(),c.ySuperscriptYSize=d.parseShort(),c.ySuperscriptXOffset=d.parseShort(),c.ySuperscriptYOffset=d.parseShort(),c.yStrikeoutSize=d.parseShort(),c.yStrikeoutPosition=d.parseShort(),c.sFamilyClass=d.parseShort(),c.panose=[];for(var e=0;e<10;e++)c.panose[e]=d.parseByte();return c.ulUnicodeRange1=d.parseULong(),c.ulUnicodeRange2=d.parseULong(),c.ulUnicodeRange3=d.parseULong(),c.ulUnicodeRange4=d.parseULong(),c.achVendID=String.fromCharCode(d.parseByte(),d.parseByte(),d.parseByte(),d.parseByte()),c.fsSelection=d.parseUShort(),c.usFirstCharIndex=d.parseUShort(),c.usLastCharIndex=d.parseUShort(),c.sTypoAscender=d.parseShort(),c.sTypoDescender=d.parseShort(),c.sTypoLineGap=d.parseShort(),c.usWinAscent=d.parseUShort(),c.usWinDescent=d.parseUShort(),c.version>=1&&(c.ulCodePageRange1=d.parseULong(),c.ulCodePageRange2=d.parseULong()),c.version>=2&&(c.sxHeight=d.parseShort(),c.sCapHeight=d.parseShort(),c.usDefaultChar=d.parseUShort(),c.usBreakChar=d.parseUShort(),c.usMaxContent=d.parseUShort()),c}function f(a){return new h.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],a)}var g=a("../parse"),h=a("../table"),i=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}];c.unicodeRanges=i,c.getUnicodeRange=d,c.parse=e,c.make=f},{"../parse":19,"../table":22}],39:[function(a,b,c){"use strict";function d(a,b){var c,d={},e=new g.Parser(a,b);switch(d.version=e.parseVersion(),d.italicAngle=e.parseFixed(),d.underlinePosition=e.parseShort(),d.underlineThickness=e.parseShort(),d.isFixedPitch=e.parseULong(),d.minMemType42=e.parseULong(),d.maxMemType42=e.parseULong(),d.minMemType1=e.parseULong(),d.maxMemType1=e.parseULong(),d.version){case 1:d.names=f.standardNames.slice();break;case 2:for(d.numberOfGlyphs=e.parseUShort(),d.glyphNameIndex=new Array(d.numberOfGlyphs),c=0;c<d.numberOfGlyphs;c++)d.glyphNameIndex[c]=e.parseUShort();for(d.names=[],c=0;c<d.numberOfGlyphs;c++)if(d.glyphNameIndex[c]>=f.standardNames.length){var h=e.parseChar();d.names.push(e.parseString(h))}break;case 2.5:for(d.numberOfGlyphs=e.parseUShort(),d.offset=new Array(d.numberOfGlyphs),c=0;c<d.numberOfGlyphs;c++)d.offset[c]=e.parseChar()}return d}function e(){return new h.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:0},{name:"underlinePosition",type:"FWORD",value:0},{name:"underlineThickness",type:"FWORD",value:0},{name:"isFixedPitch",type:"ULONG",value:0},{name:"minMemType42",type:"ULONG",value:0},{name:"maxMemType42",type:"ULONG",value:0},{name:"minMemType1",type:"ULONG",value:0},{name:"maxMemType1",type:"ULONG",value:0}])}var f=a("../encoding"),g=a("../parse"),h=a("../table");c.parse=d,c.make=e},{"../encoding":12,"../parse":19,"../table":22}],40:[function(a,b,c){"use strict";function d(a){return Math.log(a)/Math.log(2)|0}function e(a){for(;a.length%4!=0;)a.push(0);for(var b=0,c=0;c<a.length;c+=4)b+=(a[c]<<24)+(a[c+1]<<16)+(a[c+2]<<8)+a[c+3];return b%=Math.pow(2,32)}function f(a,b,c,d){return new l.Record("Table Record",[{name:"tag",type:"TAG",value:void 0!==a?a:""},{name:"checkSum",type:"ULONG",value:void 0!==b?b:0},{name:"offset",type:"ULONG",value:void 0!==c?c:0},{name:"length",type:"ULONG",value:void 0!==d?d:0}])}function g(a){var b=new l.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);b.tables=a,b.numTables=a.length;var c=Math.pow(2,d(b.numTables));b.searchRange=16*c,b.entrySelector=d(c),b.rangeShift=16*b.numTables-b.searchRange;for(var g=[],h=[],i=b.sizeOf()+f().sizeOf()*b.numTables;i%4!=0;)i+=1,h.push({name:"padding",type:"BYTE",value:0});for(var j=0;j<a.length;j+=1){var m=a[j];k.argument(4===m.tableName.length,"Table name"+m.tableName+" is invalid.");var n=m.sizeOf(),o=f(m.tableName,e(m.encode()),i,n);for(g.push({name:o.tag+" Table Record",type:"RECORD",value:o}),h.push({name:m.tableName+" table",type:"RECORD",value:m}),i+=n,k.argument(!isNaN(i),"Something went wrong calculating the offset.");i%4!=0;)i+=1,h.push({name:"padding",type:"BYTE",value:0})}return g.sort(function(a,b){return a.value.tag>b.value.tag?1:-1}),b.fields=b.fields.concat(g),b.fields=b.fields.concat(h),b}function h(a,b,c){for(var d=0;d<b.length;d+=1){var e=a.charToGlyphIndex(b[d]);if(e>0){return a.glyphs.get(e).getMetrics()}}return c}function i(a){for(var b=0,c=0;c<a.length;c+=1)b+=a[c];return b/a.length}function j(a){for(var b,c=[],d=[],f=[],j=[],k=[],l=[],y=[],z=0,A=0,B=0,C=0,D=0,E=0;E<a.glyphs.length;E+=1){var F=a.glyphs.get(E),G=0|F.unicode;if(isNaN(F.advanceWidth))throw new Error("Glyph "+F.name+" ("+E+"): advanceWidth is not a number.");(b>G||void 0===b)&&G>0&&(b=G),z<G&&(z=G);var H=u.getUnicodeRange(G);if(H<32)A|=1<<H;else if(H<64)B|=1<<H-32;else if(H<96)C|=1<<H-64;else{if(!(H<123))throw new Error("Unicode ranges bits > 123 are reserved for internal usage");D|=1<<H-96}if(".notdef"!==F.name){var I=F.getMetrics();c.push(I.xMin),d.push(I.yMin),f.push(I.xMax),j.push(I.yMax),l.push(I.leftSideBearing),y.push(I.rightSideBearing),k.push(F.advanceWidth)}
}var J={xMin:Math.min.apply(null,c),yMin:Math.min.apply(null,d),xMax:Math.max.apply(null,f),yMax:Math.max.apply(null,j),advanceWidthMax:Math.max.apply(null,k),advanceWidthAvg:i(k),minLeftSideBearing:Math.min.apply(null,l),maxLeftSideBearing:Math.max.apply(null,l),minRightSideBearing:Math.min.apply(null,y)};J.ascender=a.ascender,J.descender=a.descender;var K=o.make({flags:3,unitsPerEm:a.unitsPerEm,xMin:J.xMin,yMin:J.yMin,xMax:J.xMax,yMax:J.yMax,lowestRecPPEM:3,createdTimestamp:a.createdTimestamp}),L=p.make({ascender:J.ascender,descender:J.descender,advanceWidthMax:J.advanceWidthMax,minLeftSideBearing:J.minLeftSideBearing,minRightSideBearing:J.minRightSideBearing,xMaxExtent:J.maxLeftSideBearing+(J.xMax-J.xMin),numberOfHMetrics:a.glyphs.length}),M=s.make(a.glyphs.length),N=u.make({xAvgCharWidth:Math.round(J.advanceWidthAvg),usWeightClass:a.tables.os2.usWeightClass,usWidthClass:a.tables.os2.usWidthClass,usFirstCharIndex:b,usLastCharIndex:z,ulUnicodeRange1:A,ulUnicodeRange2:B,ulUnicodeRange3:C,ulUnicodeRange4:D,fsSelection:a.tables.os2.fsSelection,sTypoAscender:J.ascender,sTypoDescender:J.descender,sTypoLineGap:0,usWinAscent:J.yMax,usWinDescent:Math.abs(J.yMin),ulCodePageRange1:1,sxHeight:h(a,"xyvw",{yMax:Math.round(J.ascender/2)}).yMax,sCapHeight:h(a,"HIKLEFJMNTZBDPRAGOQSUVWXY",J).yMax,usDefaultChar:a.hasChar(" ")?32:0,usBreakChar:a.hasChar(" ")?32:0}),O=q.make(a.glyphs),P=m.make(a.glyphs),Q=a.getEnglishName("fontFamily"),R=a.getEnglishName("fontSubfamily"),S=Q+" "+R,T=a.getEnglishName("postScriptName");T||(T=Q.replace(/\s/g,"")+"-"+R);var U={};for(var V in a.names)U[V]=a.names[V];U.uniqueID||(U.uniqueID={en:a.getEnglishName("manufacturer")+":"+S}),U.postScriptName||(U.postScriptName={en:T}),U.preferredFamily||(U.preferredFamily=a.names.fontFamily),U.preferredSubfamily||(U.preferredSubfamily=a.names.fontSubfamily);var W=[],X=t.make(U,W),Y=W.length>0?r.make(W):void 0,Z=v.make(),$=n.make(a.glyphs,{version:a.getEnglishName("version"),fullName:S,familyName:Q,weightName:R,postScriptName:T,unitsPerEm:a.unitsPerEm,fontBBox:[0,J.yMin,J.ascender,J.advanceWidthMax]}),_=a.metas&&Object.keys(a.metas).length>0?x.make(a.metas):void 0,aa=[K,L,M,N,X,P,Z,$,O];Y&&aa.push(Y),a.tables.gsub&&aa.push(w.make(a.tables.gsub)),_&&aa.push(_);var ba=g(aa),ca=ba.encode(),da=e(ca),ea=ba.fields,fa=!1;for(E=0;E<ea.length;E+=1)if("head table"===ea[E].name){ea[E].value.checkSumAdjustment=2981146554-da,fa=!0;break}if(!fa)throw new Error("Could not find head table with checkSum to adjust.");return ba}var k=a("../check"),l=a("../table"),m=a("./cmap"),n=a("./cff"),o=a("./head"),p=a("./hhea"),q=a("./hmtx"),r=a("./ltag"),s=a("./maxp"),t=a("./name"),u=a("./os2"),v=a("./post"),w=a("./gsub"),x=a("./meta");c.computeCheckSum=e,c.make=g,c.fontToTable=j},{"../check":10,"../table":22,"./cff":23,"./cmap":24,"./gsub":28,"./head":29,"./hhea":30,"./hmtx":31,"./ltag":34,"./maxp":35,"./meta":36,"./name":37,"./os2":38,"./post":39}],41:[function(a,b,c){"use strict";function d(a){return function(){return a}}function e(a){return a>=-128&&a<=127}function f(a,b,c){for(var d=0,e=a.length;b<e&&d<64&&0===a[b];)++b,++d;return c.push(128|d-1),b}function g(a,b,c){for(var d=0,f=a.length,g=b;g<f&&d<64;){var h=a[g];if(!e(h))break;if(0===h&&g+1<f&&0===a[g+1])break;++g,++d}c.push(d-1);for(var i=b;i<g;++i)c.push(a[i]+256&255);return g}function h(a,b,c){for(var d=0,f=a.length,g=b;g<f&&d<64;){var h=a[g];if(0===h)break;if(e(h)&&g+1<f&&e(a[g+1]))break;++g,++d}c.push(64|d-1);for(var i=b;i<g;++i){var j=a[i];c.push(j+65536>>8&255,j+256&255)}return g}var i=a("./check"),j=32768,k=2147483648,l={},m={},n={};m.BYTE=function(a){return i.argument(a>=0&&a<=255,"Byte value should be between 0 and 255."),[a]},n.BYTE=d(1),m.CHAR=function(a){return[a.charCodeAt(0)]},n.CHAR=d(1),m.CHARARRAY=function(a){for(var b=[],c=0;c<a.length;c+=1)b[c]=a.charCodeAt(c);return b},n.CHARARRAY=function(a){return a.length},m.USHORT=function(a){return[a>>8&255,255&a]},n.USHORT=d(2),m.SHORT=function(a){return a>=j&&(a=-(2*j-a)),[a>>8&255,255&a]},n.SHORT=d(2),m.UINT24=function(a){return[a>>16&255,a>>8&255,255&a]},n.UINT24=d(3),m.ULONG=function(a){return[a>>24&255,a>>16&255,a>>8&255,255&a]},n.ULONG=d(4),m.LONG=function(a){return a>=k&&(a=-(2*k-a)),[a>>24&255,a>>16&255,a>>8&255,255&a]},n.LONG=d(4),m.FIXED=m.ULONG,n.FIXED=n.ULONG,m.FWORD=m.SHORT,n.FWORD=n.SHORT,m.UFWORD=m.USHORT,n.UFWORD=n.USHORT,m.LONGDATETIME=function(a){return[0,0,0,0,a>>24&255,a>>16&255,a>>8&255,255&a]},n.LONGDATETIME=d(8),m.TAG=function(a){return i.argument(4===a.length,"Tag should be exactly 4 ASCII characters."),[a.charCodeAt(0),a.charCodeAt(1),a.charCodeAt(2),a.charCodeAt(3)]},n.TAG=d(4),m.Card8=m.BYTE,n.Card8=n.BYTE,m.Card16=m.USHORT,n.Card16=n.USHORT,m.OffSize=m.BYTE,n.OffSize=n.BYTE,m.SID=m.USHORT,n.SID=n.USHORT,m.NUMBER=function(a){return a>=-107&&a<=107?[a+139]:a>=108&&a<=1131?(a-=108,[247+(a>>8),255&a]):a>=-1131&&a<=-108?(a=-a-108,[251+(a>>8),255&a]):a>=-32768&&a<=32767?m.NUMBER16(a):m.NUMBER32(a)},n.NUMBER=function(a){return m.NUMBER(a).length},m.NUMBER16=function(a){return[28,a>>8&255,255&a]},n.NUMBER16=d(3),m.NUMBER32=function(a){return[29,a>>24&255,a>>16&255,a>>8&255,255&a]},n.NUMBER32=d(5),m.REAL=function(a){var b=a.toString(),c=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(b);if(c){var d=parseFloat("1e"+((c[2]?+c[2]:0)+c[1].length));b=(Math.round(a*d)/d).toString()}var e,f,g="";for(e=0,f=b.length;e<f;e+=1){var h=b[e];g+="e"===h?"-"===b[++e]?"c":"b":"."===h?"a":"-"===h?"e":h}g+=1&g.length?"f":"ff";var i=[30];for(e=0,f=g.length;e<f;e+=2)i.push(parseInt(g.substr(e,2),16));return i},n.REAL=function(a){return m.REAL(a).length},m.NAME=m.CHARARRAY,n.NAME=n.CHARARRAY,m.STRING=m.CHARARRAY,n.STRING=n.CHARARRAY,l.UTF8=function(a,b,c){for(var d=[],e=c,f=0;f<e;f++,b+=1)d[f]=a.getUint8(b);return String.fromCharCode.apply(null,d)},l.UTF16=function(a,b,c){for(var d=[],e=c/2,f=0;f<e;f++,b+=2)d[f]=a.getUint16(b);return String.fromCharCode.apply(null,d)},m.UTF16=function(a){for(var b=[],c=0;c<a.length;c+=1){var d=a.charCodeAt(c);b[b.length]=d>>8&255,b[b.length]=255&d}return b},n.UTF16=function(a){return 2*a.length};var o={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈Ć«Č… ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüÝ°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};l.MACSTRING=function(a,b,c,d){var e=o[d];if(void 0!==e){for(var f="",g=0;g<c;g++){var h=a.getUint8(b+g);f+=h<=127?String.fromCharCode(h):e[127&h]}return f}};var p,q="function"==typeof WeakMap&&new WeakMap,r=function(a){if(!p){p={};for(var b in o)p[b]=new String(b)}var c=p[a];if(void 0!==c){if(q){var d=q.get(c);if(void 0!==d)return d}var e=o[a];if(void 0!==e){for(var f={},g=0;g<e.length;g++)f[e.charCodeAt(g)]=g+128;return q&&q.set(c,f),f}}};m.MACSTRING=function(a,b){var c=r(b);if(void 0!==c){for(var d=[],e=0;e<a.length;e++){var f=a.charCodeAt(e);if(f>=128&&void 0===(f=c[f]))return;d[e]=f}return d}},n.MACSTRING=function(a,b){var c=m.MACSTRING(a,b);return void 0!==c?c.length:0},m.VARDELTAS=function(a){for(var b=0,c=[];b<a.length;){var d=a[b];b=0===d?f(a,b,c):d>=-128&&d<=127?g(a,b,c):h(a,b,c)}return c},m.INDEX=function(a){var b,c=1,d=[c],e=[];for(b=0;b<a.length;b+=1){var f=m.OBJECT(a[b]);Array.prototype.push.apply(e,f),c+=f.length,d.push(c)}if(0===e.length)return[0,0];var g=[],h=1+Math.floor(Math.log(c)/Math.log(2))/8|0,i=[void 0,m.BYTE,m.USHORT,m.UINT24,m.ULONG][h];for(b=0;b<d.length;b+=1){var j=i(d[b]);Array.prototype.push.apply(g,j)}return Array.prototype.concat(m.Card16(a.length),m.OffSize(h),g,e)},n.INDEX=function(a){return m.INDEX(a).length},m.DICT=function(a){for(var b=[],c=Object.keys(a),d=c.length,e=0;e<d;e+=1){var f=parseInt(c[e],0),g=a[f];b=b.concat(m.OPERAND(g.value,g.type)),b=b.concat(m.OPERATOR(f))}return b},n.DICT=function(a){return m.DICT(a).length},m.OPERATOR=function(a){return a<1200?[a]:[12,a-1200]},m.OPERAND=function(a,b){var c=[];if(Array.isArray(b))for(var d=0;d<b.length;d+=1)i.argument(a.length===b.length,"Not enough arguments given for type"+b),c=c.concat(m.OPERAND(a[d],b[d]));else if("SID"===b)c=c.concat(m.NUMBER(a));else if("offset"===b)c=c.concat(m.NUMBER32(a));else if("number"===b)c=c.concat(m.NUMBER(a));else{if("real"!==b)throw new Error("Unknown operand type "+b);c=c.concat(m.REAL(a))}return c},m.OP=m.BYTE,n.OP=n.BYTE;var s="function"==typeof WeakMap&&new WeakMap;m.CHARSTRING=function(a){if(s){var b=s.get(a);if(void 0!==b)return b}for(var c=[],d=a.length,e=0;e<d;e+=1){var f=a[e];c=c.concat(m[f.type](f.value))}return s&&s.set(a,c),c},n.CHARSTRING=function(a){return m.CHARSTRING(a).length},m.OBJECT=function(a){var b=m[a.type];return i.argument(void 0!==b,"No encoding function for type "+a.type),b(a.value)},n.OBJECT=function(a){var b=n[a.type];return i.argument(void 0!==b,"No sizeOf function for type "+a.type),b(a.value)},m.TABLE=function(a){var b,c=[],d=a.fields.length,e=[],f=[];for(b=0;b<d;b+=1){var g=a.fields[b],h=m[g.type];i.argument(void 0!==h,"No encoding function for field type "+g.type+" ("+g.name+")");var j=a[g.name];void 0===j&&(j=g.value);var k=h(j);"TABLE"===g.type?(f.push(c.length),c=c.concat([0,0]),e.push(k)):c=c.concat(k)}for(b=0;b<e.length;b+=1){var l=f[b],n=c.length;i.argument(n<65536,"Table "+a.tableName+" too big."),c[l]=n>>8,c[l+1]=255&n,c=c.concat(e[b])}return c},n.TABLE=function(a){for(var b=0,c=a.fields.length,d=0;d<c;d+=1){var e=a.fields[d],f=n[e.type];i.argument(void 0!==f,"No sizeOf function for field type "+e.type+" ("+e.name+")");var g=a[e.name];void 0===g&&(g=e.value),b+=f(g),"TABLE"===e.type&&(b+=2)}return b},m.RECORD=m.TABLE,n.RECORD=n.TABLE,m.LITERAL=function(a){return a},n.LITERAL=function(a){return a.length},c.decode=l,c.encode=m,c.sizeOf=n},{"./check":10}],42:[function(a,b,c){(function(a){"use strict";c.isBrowser=function(){return"undefined"!=typeof window},c.isNode=function(){return"undefined"==typeof window},c.nodeBufferToArrayBuffer=function(a){for(var b=new ArrayBuffer(a.length),c=new Uint8Array(b),d=0;d<a.length;++d)c[d]=a[d];return b},c.arrayBufferToNodeBuffer=function(b){for(var c=new a(b.byteLength),d=new Uint8Array(b),e=0;e<c.length;++e)c[e]=d[e];return c},c.checkArgument=function(a,b){if(!a)throw b}}).call(this,a("buffer").Buffer)},{buffer:4}],43:[function(a,b,c){function d(){throw new Error("setTimeout has not been defined")}function e(){throw new Error("clearTimeout has not been defined")}function f(a){if(l===setTimeout)return setTimeout(a,0);if((l===d||!l)&&setTimeout)return l=setTimeout,setTimeout(a,0);try{return l(a,0)}catch(b){try{return l.call(null,a,0)}catch(b){return l.call(this,a,0)}}}function g(a){if(m===clearTimeout)return clearTimeout(a);if((m===e||!m)&&clearTimeout)return m=clearTimeout,clearTimeout(a);try{return m(a)}catch(b){try{return m.call(null,a)}catch(b){return m.call(this,a)}}}function h(){q&&o&&(q=!1,o.length?p=o.concat(p):r=-1,p.length&&i())}function i(){if(!q){var a=f(h);q=!0;for(var b=p.length;b;){for(o=p,p=[];++r<b;)o&&o[r].run();r=-1,b=p.length}o=null,q=!1,g(a)}}function j(a,b){this.fun=a,this.array=b}function k(){}var l,m,n=b.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:d}catch(a){l=d}try{m="function"==typeof clearTimeout?clearTimeout:e}catch(a){m=e}}();var o,p=[],q=!1,r=-1;n.nextTick=function(a){var b=new Array(arguments.length-1);if(arguments.length>1)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];p.push(new j(a,b)),1!==p.length||q||f(i)},j.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=k,n.addListener=k,n.once=k,n.off=k,n.removeListener=k,n.removeAllListeners=k,n.emit=k,n.binding=function(a){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(a){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},{}],44:[function(a,b,c){function d(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function e(a,b){this.source=a,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=b,this.destLen=0,this.ltree=new d,this.dtree=new d}function f(a,b,c,d){var e,f;for(e=0;e<c;++e)a[e]=0;for(e=0;e<30-c;++e)a[e+c]=e/c|0;for(f=d,e=0;e<30;++e)b[e]=f,f+=1<<a[e]}function g(a,b){var c;for(c=0;c<7;++c)a.table[c]=0;for(a.table[7]=24,a.table[8]=152,a.table[9]=112,c=0;c<24;++c)a.trans[c]=256+c;for(c=0;c<144;++c)a.trans[24+c]=c;for(c=0;c<8;++c)a.trans[168+c]=280+c;for(c=0;c<112;++c)a.trans[176+c]=144+c;for(c=0;c<5;++c)b.table[c]=0;for(b.table[5]=32,c=0;c<32;++c)b.trans[c]=c}function h(a,b,c,d){var e,f;for(e=0;e<16;++e)a.table[e]=0;for(e=0;e<d;++e)a.table[b[c+e]]++;for(a.table[0]=0,f=0,e=0;e<16;++e)A[e]=f,f+=a.table[e];for(e=0;e<d;++e)b[c+e]&&(a.trans[A[b[c+e]]++]=e)}function i(a){a.bitcount--||(a.tag=a.source[a.sourceIndex++],a.bitcount=7);var b=1&a.tag;return a.tag>>>=1,b}function j(a,b,c){if(!b)return c;for(;a.bitcount<24;)a.tag|=a.source[a.sourceIndex++]<<a.bitcount,a.bitcount+=8;var d=a.tag&65535>>>16-b;return a.tag>>>=b,a.bitcount-=b,d+c}function k(a,b){for(;a.bitcount<24;)a.tag|=a.source[a.sourceIndex++]<<a.bitcount,a.bitcount+=8;var c=0,d=0,e=0,f=a.tag;do{d=2*d+(1&f),f>>>=1,++e,c+=b.table[e],d-=b.table[e]}while(d>=0);return a.tag=f,a.bitcount-=e,b.trans[c+d]}function l(a,b,c){var d,e,f,g,i,l;for(d=j(a,5,257),e=j(a,5,1),f=j(a,4,4),g=0;g<19;++g)z[g]=0;for(g=0;g<f;++g){var m=j(a,3,0);z[x[g]]=m}for(h(y,z,0,19),i=0;i<d+e;){var n=k(a,y);switch(n){case 16:var o=z[i-1];for(l=j(a,2,3);l;--l)z[i++]=o;break;case 17:for(l=j(a,3,3);l;--l)z[i++]=0;break;case 18:for(l=j(a,7,11);l;--l)z[i++]=0;break;default:z[i++]=n}}h(b,z,0,d),h(c,z,d,e)}function m(a,b,c){for(;;){var d=k(a,b);if(256===d)return p;if(d<256)a.dest[a.destLen++]=d;else{var e,f,g,h;for(d-=257,e=j(a,t[d],u[d]),f=k(a,c),g=a.destLen-j(a,v[f],w[f]),h=g;h<g+e;++h)a.dest[a.destLen++]=a.dest[h]}}}function n(a){for(var b,c,d;a.bitcount>8;)a.sourceIndex--,a.bitcount-=8;if(b=a.source[a.sourceIndex+1],b=256*b+a.source[a.sourceIndex],c=a.source[a.sourceIndex+3],c=256*c+a.source[a.sourceIndex+2],b!==(65535&~c))return q;for(a.sourceIndex+=4,d=b;d;--d)a.dest[a.destLen++]=a.source[a.sourceIndex++];return a.bitcount=0,p}function o(a,b){var c,d,f=new e(a,b);do{switch(c=i(f),j(f,2,0)){case 0:d=n(f);break;case 1:d=m(f,r,s);break;case 2:l(f,f.ltree,f.dtree),d=m(f,f.ltree,f.dtree);break;default:d=q}if(d!==p)throw new Error("Data error")}while(!c);return f.destLen<f.dest.length?"function"==typeof f.dest.slice?f.dest.slice(0,f.destLen):f.dest.subarray(0,f.destLen):f.dest}var p=0,q=-3,r=new d,s=new d,t=new Uint8Array(30),u=new Uint16Array(30),v=new Uint8Array(30),w=new Uint16Array(30),x=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),y=new d,z=new Uint8Array(320),A=new Uint16Array(16);g(r,s),f(t,u,4,3),f(v,w,2,1),t[28]=0,u[28]=258,b.exports=o},{}],45:[function(a,b,c){!function(a){"use strict";function b(a){if("string"!=typeof a&&(a=String(a)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(a))throw new TypeError("Invalid character in header field name");return a.toLowerCase()}function c(a){return"string"!=typeof a&&(a=String(a)),a}function d(a){var b={next:function(){var b=a.shift();return{done:void 0===b,value:b}}};return r.iterable&&(b[Symbol.iterator]=function(){return b}),b}function e(a){this.map={},a instanceof e?a.forEach(function(a,b){this.append(b,a)},this):Array.isArray(a)?a.forEach(function(a){this.append(a[0],a[1])},this):a&&Object.getOwnPropertyNames(a).forEach(function(b){this.append(b,a[b])},this)}function f(a){if(a.bodyUsed)return Promise.reject(new TypeError("Already read"));a.bodyUsed=!0}function g(a){return new Promise(function(b,c){a.onload=function(){b(a.result)},a.onerror=function(){c(a.error)}})}function h(a){var b=new FileReader,c=g(b);return b.readAsArrayBuffer(a),c}function i(a){var b=new FileReader,c=g(b);return b.readAsText(a),c}function j(a){for(var b=new Uint8Array(a),c=new Array(b.length),d=0;d<b.length;d++)c[d]=String.fromCharCode(b[d]);return c.join("")}function k(a){if(a.slice)return a.slice(0);var b=new Uint8Array(a.byteLength);return b.set(new Uint8Array(a)),b.buffer}function l(){return this.bodyUsed=!1,this._initBody=function(a){if(this._bodyInit=a,a)if("string"==typeof a)this._bodyText=a;else if(r.blob&&Blob.prototype.isPrototypeOf(a))this._bodyBlob=a;else if(r.formData&&FormData.prototype.isPrototypeOf(a))this._bodyFormData=a;else if(r.searchParams&&URLSearchParams.prototype.isPrototypeOf(a))this._bodyText=a.toString();else if(r.arrayBuffer&&r.blob&&t(a))this._bodyArrayBuffer=k(a.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!r.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(a)&&!u(a))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=k(a)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof a?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(a)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},r.blob&&(this.blob=function(){var a=f(this);if(a)return a;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?f(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var a=f(this);if(a)return a;if(this._bodyBlob)return i(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(j(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(o)}),this.json=function(){return this.text().then(JSON.parse)},this}function m(a){var b=a.toUpperCase();return v.indexOf(b)>-1?b:a}function n(a,b){b=b||{};var c=b.body;if(a instanceof n){if(a.bodyUsed)throw new TypeError("Already read");this.url=a.url,this.credentials=a.credentials,b.headers||(this.headers=new e(a.headers)),this.method=a.method,this.mode=a.mode,c||null==a._bodyInit||(c=a._bodyInit,a.bodyUsed=!0)}else this.url=String(a);if(this.credentials=b.credentials||this.credentials||"omit",!b.headers&&this.headers||(this.headers=new e(b.headers)),this.method=m(b.method||this.method||"GET"),this.mode=b.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&c)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(c)}function o(a){var b=new FormData;return a.trim().split("&").forEach(function(a){if(a){var c=a.split("="),d=c.shift().replace(/\+/g," "),e=c.join("=").replace(/\+/g," ");b.append(decodeURIComponent(d),decodeURIComponent(e))}}),b}function p(a){var b=new e;return a.split(/\r?\n/).forEach(function(a){var c=a.split(":"),d=c.shift().trim();if(d){var e=c.join(":").trim();b.append(d,e)}}),b}function q(a,b){b||(b={}),this.type="default",this.status="status"in b?b.status:200,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in b?b.statusText:"OK",this.headers=new e(b.headers),this.url=b.url||"",this._initBody(a)}if(!a.fetch){var r={searchParams:"URLSearchParams"in a,iterable:"Symbol"in a&&"iterator"in Symbol,blob:"FileReader"in a&&"Blob"in a&&function(){try{return new Blob,!0}catch(a){return!1}}(),formData:"FormData"in a,arrayBuffer:"ArrayBuffer"in a};if(r.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],t=function(a){return a&&DataView.prototype.isPrototypeOf(a)},u=ArrayBuffer.isView||function(a){return a&&s.indexOf(Object.prototype.toString.call(a))>-1};e.prototype.append=function(a,d){a=b(a),d=c(d);var e=this.map[a];this.map[a]=e?e+","+d:d},e.prototype.delete=function(a){delete this.map[b(a)]},e.prototype.get=function(a){return a=b(a),this.has(a)?this.map[a]:null},e.prototype.has=function(a){return this.map.hasOwnProperty(b(a))},e.prototype.set=function(a,d){this.map[b(a)]=c(d)},e.prototype.forEach=function(a,b){for(var c in this.map)this.map.hasOwnProperty(c)&&a.call(b,this.map[c],c,this)},e.prototype.keys=function(){var a=[];return this.forEach(function(b,c){a.push(c)}),d(a)},e.prototype.values=function(){var a=[];return this.forEach(function(b){a.push(b)}),d(a)},e.prototype.entries=function(){var a=[];return this.forEach(function(b,c){a.push([c,b])}),d(a)},r.iterable&&(e.prototype[Symbol.iterator]=e.prototype.entries);var v=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];n.prototype.clone=function(){return new n(this,{body:this._bodyInit})},l.call(n.prototype),l.call(q.prototype),q.prototype.clone=function(){return new q(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new e(this.headers),url:this.url})},q.error=function(){var a=new q(null,{status:0,statusText:""});return a.type="error",a};var w=[301,302,303,307,308];q.redirect=function(a,b){if(w.indexOf(b)===-1)throw new RangeError("Invalid status code");return new q(null,{status:b,headers:{location:a}})},a.Headers=e,a.Request=n,a.Response=q,a.fetch=function(a,b){return new Promise(function(c,d){var e=new n(a,b),f=new XMLHttpRequest;f.onload=function(){var a={status:f.status,statusText:f.statusText,headers:p(f.getAllResponseHeaders()||"")};a.url="responseURL"in f?f.responseURL:a.headers.get("X-Request-URL"),c(new q("response"in f?f.response:f.responseText,a))},f.onerror=function(){d(new TypeError("Network request failed"))},f.ontimeout=function(){d(new TypeError("Network request failed"))},f.open(e.method,e.url,!0),"include"===e.credentials&&(f.withCredentials=!0),"responseType"in f&&r.blob&&(f.responseType="blob"),e.headers.forEach(function(a,b){f.setRequestHeader(b,a)}),f.send(void 0===e._bodyInit?null:e._bodyInit)})},a.fetch.polyfill=!0}}("undefined"!=typeof self?self:this)},{}],46:[function(a,b,c){"use strict";var d=a("./core/core");a("./color/p5.Color"),a("./core/p5.Element"),a("./typography/p5.Font"),a("./core/p5.Graphics"),a("./core/p5.Renderer2D"),a("./image/p5.Image"),a("./math/p5.Vector"),a("./io/p5.TableRow"),a("./io/p5.Table"),a("./io/p5.XML"),a("./color/creating_reading"),a("./color/setting"),a("./core/constants"),a("./utilities/conversion"),a("./utilities/array_functions"),a("./utilities/string_functions"),a("./core/environment"),a("./image/image"),a("./image/loading_displaying"),a("./image/pixels"),a("./io/files"),a("./events/keyboard"),a("./events/acceleration"),a("./events/mouse"),a("./utilities/time_date"),a("./events/touch"),a("./math/math"),a("./math/calculation"),a("./math/random"),a("./math/noise"),a("./math/trigonometry"),a("./core/rendering"),a("./core/2d_primitives"),a("./core/attributes"),a("./core/curves"),a("./core/vertex"),a("./core/structure"),a("./core/transform"),a("./typography/attributes"),a("./typography/loading_displaying"),a("./data/p5.TypedDict"),a("./webgl/p5.RendererGL"),a("./webgl/p5.Geometry"),a("./webgl/p5.RendererGL.Retained"),a("./webgl/p5.RendererGL.Immediate"),a("./webgl/primitives"),a("./webgl/loading"),a("./webgl/p5.Matrix"),a("./webgl/material"),a("./webgl/light"),a("./webgl/p5.Shader"),a("./webgl/camera"),a("./webgl/interaction"),a("./core/init.js"),b.exports=d},{"./color/creating_reading":48,"./color/p5.Color":49,"./color/setting":50,"./core/2d_primitives":51,"./core/attributes":52,"./core/constants":54,"./core/core":55,"./core/curves":56,"./core/environment":57,"./core/init.js":59,"./core/p5.Element":60,"./core/p5.Graphics":61,"./core/p5.Renderer2D":63,"./core/rendering":64,"./core/structure":66,"./core/transform":67,"./core/vertex":68,"./data/p5.TypedDict":69,"./events/acceleration":70,"./events/keyboard":71,"./events/mouse":72,"./events/touch":73,"./image/image":75,"./image/loading_displaying":76,"./image/p5.Image":77,"./image/pixels":78,"./io/files":79,"./io/p5.Table":80,"./io/p5.TableRow":81,"./io/p5.XML":82,"./math/calculation":83,"./math/math":84,"./math/noise":85,"./math/p5.Vector":86,"./math/random":88,"./math/trigonometry":89,"./typography/attributes":90,"./typography/loading_displaying":91,"./typography/p5.Font":92,"./utilities/array_functions":93,"./utilities/conversion":94,"./utilities/string_functions":95,"./utilities/time_date":96,"./webgl/camera":97,"./webgl/interaction":98,"./webgl/light":99,"./webgl/loading":100,"./webgl/material":101,"./webgl/p5.Geometry":102,"./webgl/p5.Matrix":103,"./webgl/p5.RendererGL":106,"./webgl/p5.RendererGL.Immediate":104,"./webgl/p5.RendererGL.Retained":105,"./webgl/p5.Shader":107,"./webgl/primitives":109}],47:[function(a,b,c){"use strict";var d=a("../core/core");d.ColorConversion={},d.ColorConversion._hsbaToHSLA=function(a){var b=a[0],c=a[1],d=a[2],e=(2-c)*d/2;return 0!==e&&(1===e?c=0:e<.5?c/=2-c:c=c*d/(2-2*e)),[b,c,e,a[3]]},d.ColorConversion._hsbaToRGBA=function(a){var b=6*a[0],c=a[1],d=a[2],e=[];if(0===c)e=[d,d,d,a[3]];else{var f,g,h,i=Math.floor(b),j=d*(1-c),k=d*(1-c*(b-i)),l=d*(1-c*(1+i-b));1===i?(f=k,g=d,h=j):2===i?(f=j,g=d,h=l):3===i?(f=j,g=k,h=d):4===i?(f=l,g=j,h=d):5===i?(f=d,g=j,h=k):(f=d,g=l,h=j),e=[f,g,h,a[3]]}return e},d.ColorConversion._hslaToHSBA=function(a){var b,c=a[0],d=a[1],e=a[2];return b=e<.5?(1+d)*e:e+d-e*d,d=2*(b-e)/b,[c,d,b,a[3]]},d.ColorConversion._hslaToRGBA=function(a){var b=6*a[0],c=a[1],d=a[2],e=[];if(0===c)e=[d,d,d,a[3]];else{var f;f=d<.5?(1+c)*d:d+c-d*c;var g=2*d-f,h=function(a,b,c){return a<0?a+=6:a>=6&&(a-=6),a<1?b+(c-b)*a:a<3?c:a<4?b+(c-b)*(4-a):b};e=[h(b+2,g,f),h(b,g,f),h(b-2,g,f),a[3]]}return e},d.ColorConversion._rgbaToHSBA=function(a){var b,c,d=a[0],e=a[1],f=a[2],g=Math.max(d,e,f),h=g-Math.min(d,e,f);return 0===h?(b=0,c=0):(c=h/g,d===g?b=(e-f)/h:e===g?b=2+(f-d)/h:f===g&&(b=4+(d-e)/h),b<0?b+=6:b>=6&&(b-=6)),[b/6,c,g,a[3]]},d.ColorConversion._rgbaToHSLA=function(a){var b,c,d=a[0],e=a[1],f=a[2],g=Math.max(d,e,f),h=Math.min(d,e,f),i=g+h,j=g-h;return 0===j?(b=0,c=0):(c=i<1?j/i:j/(2-i),d===g?b=(e-f)/j:e===g?b=2+(f-d)/j:f===g&&(b=4+(d-e)/j),b<0?b+=6:b>=6&&(b-=6)),[b/6,c,i/2,a[3]]},b.exports=d.ColorConversion},{"../core/core":55}],48:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("../core/constants");a("./p5.Color"),a("../core/error_helpers"),d.prototype.alpha=function(a){return d._validateParameters("alpha",arguments),this.color(a)._getAlpha()},d.prototype.blue=function(a){return d._validateParameters("blue",arguments),this.color(a)._getBlue()},d.prototype.brightness=function(a){return d._validateParameters("brightness",arguments),this.color(a)._getBrightness()},d.prototype.color=function(){return arguments[0]instanceof d.Color?arguments[0]:arguments[0]instanceof Array?this instanceof d.Renderer?new d.Color(this,arguments[0]):new d.Color(this._renderer,arguments[0]):(d._validateParameters("color",arguments),this instanceof d.Renderer?new d.Color(this,arguments):new d.Color(this._renderer,arguments))},d.prototype.green=function(a){return d._validateParameters("green",arguments),this.color(a)._getGreen()},d.prototype.hue=function(a){return d._validateParameters("hue",arguments),this.color(a)._getHue()},d.prototype.lerpColor=function(a,b,c){d._validateParameters("lerpColor",arguments);var f,g,h,i,j,k,l=this._renderer._colorMode,m=this._renderer._colorMaxes;if(l===e.RGB)j=arguments[0].levels.map(function(a){return a/255}),k=arguments[1].levels.map(function(a){return a/255});else if(l===e.HSB)arguments[0]._getBrightness(),arguments[1]._getBrightness(),j=arguments[0].hsba,k=arguments[1].hsba;else{if(l!==e.HSL)throw new Error(l+"cannot be used for interpolation.");arguments[0]._getLightness(),arguments[1]._getLightness(),j=arguments[0].hsla,k=arguments[1].hsla}return c=Math.max(Math.min(arguments[2],1),0),void 0===this.lerp&&(this.lerp=function(a,b,c){return c*(b-a)+a}),f=this.lerp(j[0],k[0],c),g=this.lerp(j[1],k[1],c),h=this.lerp(j[2],k[2],c),i=this.lerp(j[3],k[3],c),f*=m[l][0],g*=m[l][1],h*=m[l][2],i*=m[l][3],this.color(f,g,h,i)},d.prototype.lightness=function(a){return d._validateParameters("lightness",arguments),this.color(a)._getLightness()},d.prototype.red=function(a){return d._validateParameters("red",arguments),this.color(a)._getRed()},d.prototype.saturation=function(a){return d._validateParameters("saturation",arguments),this.color(a)._getSaturation()},b.exports=d},{"../core/constants":54,"../core/core":55,"../core/error_helpers":58,"./p5.Color":49}],49:[function(a,b,c){var d=a("../core/core"),e=a("../core/constants"),f=a("./color_conversion");d.Color=function(a,b){if(this._storeModeAndMaxes(a._colorMode,a._colorMaxes),this.mode!==e.RGB&&this.mode!==e.HSL&&this.mode!==e.HSB)throw new Error(this.mode+" is an invalid colorMode.");return this._array=d.Color._parseInputs.apply(this,b),this._calculateLevels(),this.name="p5.Color",this},d.Color.prototype.toString=function(){var a=this.levels,b=this._array[3];return"rgba("+a[0]+","+a[1]+","+a[2]+","+b+")"},d.Color.prototype.setRed=function(a){this._array[0]=a/this.maxes[e.RGB][0],this._calculateLevels()},d.Color.prototype.setGreen=function(a){this._array[1]=a/this.maxes[e.RGB][1],this._calculateLevels()},d.Color.prototype.setBlue=function(a){this._array[2]=a/this.maxes[e.RGB][2],this._calculateLevels()},d.Color.prototype.setAlpha=function(a){this._array[3]=a/this.maxes[this.mode][3],this._calculateLevels()},d.Color.prototype._calculateLevels=function(){this.levels=this._array.map(function(a){return Math.round(255*a)})},d.Color.prototype._getAlpha=function(){return this._array[3]*this.maxes[this.mode][3]},d.Color.prototype._storeModeAndMaxes=function(a,b){this.mode=a,this.maxes=b},d.Color.prototype._getMode=function(){return this.mode},d.Color.prototype._getMaxes=function(){return this.maxes},d.Color.prototype._getBlue=function(){return this._array[2]*this.maxes[e.RGB][2]},d.Color.prototype._getBrightness=function(){return this.hsba||(this.hsba=f._rgbaToHSBA(this._array)),this.hsba[2]*this.maxes[e.HSB][2]},d.Color.prototype._getGreen=function(){return this._array[1]*this.maxes[e.RGB][1]},d.Color.prototype._getHue=function(){return this.mode===e.HSB?(this.hsba||(this.hsba=f._rgbaToHSBA(this._array)),this.hsba[0]*this.maxes[e.HSB][0]):(this.hsla||(this.hsla=f._rgbaToHSLA(this._array)),this.hsla[0]*this.maxes[e.HSL][0])},d.Color.prototype._getLightness=function(){return this.hsla||(this.hsla=f._rgbaToHSLA(this._array)),this.hsla[2]*this.maxes[e.HSL][2]},d.Color.prototype._getRed=function(){return this._array[0]*this.maxes[e.RGB][0]},d.Color.prototype._getSaturation=function(){return this.mode===e.HSB?(this.hsba||(this.hsba=f._rgbaToHSBA(this._array)),this.hsba[1]*this.maxes[e.HSB][1]):(this.hsla||(this.hsla=f._rgbaToHSLA(this._array)),this.hsla[1]*this.maxes[e.HSL][1])};var g={
aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},h=/\s*/,i=/(\d{1,3})/,j=/((?:\d+(?:\.\d+)?)|(?:\.\d+))/,k=new RegExp(j.source+"%"),l={HEX3:/^#([a-f0-9])([a-f0-9])([a-f0-9])$/i,HEX4:/^#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])$/i,HEX6:/^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i,HEX8:/^#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i,RGB:new RegExp(["^rgb\\(",i.source,",",i.source,",",i.source,"\\)$"].join(h.source),"i"),RGB_PERCENT:new RegExp(["^rgb\\(",k.source,",",k.source,",",k.source,"\\)$"].join(h.source),"i"),RGBA:new RegExp(["^rgba\\(",i.source,",",i.source,",",i.source,",",j.source,"\\)$"].join(h.source),"i"),RGBA_PERCENT:new RegExp(["^rgba\\(",k.source,",",k.source,",",k.source,",",j.source,"\\)$"].join(h.source),"i"),HSL:new RegExp(["^hsl\\(",i.source,",",k.source,",",k.source,"\\)$"].join(h.source),"i"),HSLA:new RegExp(["^hsla\\(",i.source,",",k.source,",",k.source,",",j.source,"\\)$"].join(h.source),"i"),HSB:new RegExp(["^hsb\\(",i.source,",",k.source,",",k.source,"\\)$"].join(h.source),"i"),HSBA:new RegExp(["^hsba\\(",i.source,",",k.source,",",k.source,",",j.source,"\\)$"].join(h.source),"i")};d.Color._parseInputs=function(){var a=arguments.length,b=this.mode,c=this.maxes,h=[];if(a>=3)return h[0]=arguments[0]/c[b][0],h[1]=arguments[1]/c[b][1],h[2]=arguments[2]/c[b][2],"number"==typeof arguments[3]?h[3]=arguments[3]/c[b][3]:h[3]=1,h=h.map(function(a){return Math.max(Math.min(a,1),0)}),b===e.HSL?f._hslaToRGBA(h):b===e.HSB?f._hsbaToRGBA(h):h;if(1===a&&"string"==typeof arguments[0]){var i=arguments[0].trim().toLowerCase();if(g[i])return d.Color._parseInputs.apply(this,[g[i]]);if(l.HEX3.test(i))return h=l.HEX3.exec(i).slice(1).map(function(a){return parseInt(a+a,16)/255}),h[3]=1,h;if(l.HEX6.test(i))return h=l.HEX6.exec(i).slice(1).map(function(a){return parseInt(a,16)/255}),h[3]=1,h;if(l.HEX4.test(i))return h=l.HEX4.exec(i).slice(1).map(function(a){return parseInt(a+a,16)/255});if(l.HEX8.test(i))return h=l.HEX8.exec(i).slice(1).map(function(a){return parseInt(a,16)/255});if(l.RGB.test(i))return h=l.RGB.exec(i).slice(1).map(function(a){return a/255}),h[3]=1,h;if(l.RGB_PERCENT.test(i))return h=l.RGB_PERCENT.exec(i).slice(1).map(function(a){return parseFloat(a)/100}),h[3]=1,h;if(l.RGBA.test(i))return h=l.RGBA.exec(i).slice(1).map(function(a,b){return 3===b?parseFloat(a):a/255});if(l.RGBA_PERCENT.test(i))return h=l.RGBA_PERCENT.exec(i).slice(1).map(function(a,b){return 3===b?parseFloat(a):parseFloat(a)/100});if(l.HSL.test(i)?(h=l.HSL.exec(i).slice(1).map(function(a,b){return 0===b?parseInt(a,10)/360:parseInt(a,10)/100}),h[3]=1):l.HSLA.test(i)&&(h=l.HSLA.exec(i).slice(1).map(function(a,b){return 0===b?parseInt(a,10)/360:3===b?parseFloat(a):parseInt(a,10)/100})),h=h.map(function(a){return Math.max(Math.min(a,1),0)}),h.length)return f._hslaToRGBA(h);if(l.HSB.test(i)?(h=l.HSB.exec(i).slice(1).map(function(a,b){return 0===b?parseInt(a,10)/360:parseInt(a,10)/100}),h[3]=1):l.HSBA.test(i)&&(h=l.HSBA.exec(i).slice(1).map(function(a,b){return 0===b?parseInt(a,10)/360:3===b?parseFloat(a):parseInt(a,10)/100})),h=h.map(function(a){return Math.max(Math.min(a,1),0)}),h.length)return f._hsbaToRGBA(h);h=[1,1,1,1]}else{if(1!==a&&2!==a||"number"!=typeof arguments[0])throw new Error(arguments+"is not a valid color representation.");h[0]=arguments[0]/c[b][2],h[1]=arguments[0]/c[b][2],h[2]=arguments[0]/c[b][2],"number"==typeof arguments[1]?h[3]=arguments[1]/c[b][3]:h[3]=1,h=h.map(function(a){return Math.max(Math.min(a,1),0)})}return h},b.exports=d.Color},{"../core/constants":54,"../core/core":55,"./color_conversion":47}],50:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("../core/constants");a("./p5.Color"),d.prototype.background=function(){return arguments[0]instanceof d.Image?this.image(arguments[0],0,0,this.width,this.height):this._renderer.background.apply(this._renderer,arguments),this},d.prototype.clear=function(){return this._renderer.clear(),this},d.prototype.colorMode=function(){if(arguments[0]===e.RGB||arguments[0]===e.HSB||arguments[0]===e.HSL){this._renderer._colorMode=arguments[0];var a=this._renderer._colorMaxes[this._renderer._colorMode];2===arguments.length?(a[0]=arguments[1],a[1]=arguments[1],a[2]=arguments[1],a[3]=arguments[1]):4===arguments.length?(a[0]=arguments[1],a[1]=arguments[2],a[2]=arguments[3]):5===arguments.length&&(a[0]=arguments[1],a[1]=arguments[2],a[2]=arguments[3],a[3]=arguments[4])}return this},d.prototype.fill=function(){return this._renderer._setProperty("_fillSet",!0),this._renderer._setProperty("_doFill",!0),this._renderer.fill.apply(this._renderer,arguments),this},d.prototype.noFill=function(){return this._renderer.isP3D&&this._renderer.noFill(),this._renderer._setProperty("_doFill",!1),this},d.prototype.noStroke=function(){return this._renderer.isP3D&&this._renderer.noStroke(),this._renderer._setProperty("_doStroke",!1),this},d.prototype.stroke=function(){return this._renderer._setProperty("_strokeSet",!0),this._renderer._setProperty("_doStroke",!0),this._renderer.stroke.apply(this._renderer,arguments),this},b.exports=d},{"../core/constants":54,"../core/core":55,"./p5.Color":49}],51:[function(a,b,c){"use strict";var d=a("./core"),e=a("./constants"),f=a("./canvas");a("./error_helpers"),d.prototype.arc=function(a,b,c,f,g,h,i){for(var j=new Array(arguments.length),k=0;k<j.length;++k)j[k]=arguments[k];if(d._validateParameters("arc",j),!this._renderer._doStroke&&!this._renderer._doFill)return this;for(this._angleMode===e.DEGREES&&(g=this.radians(g),h=this.radians(h));g<0;)g+=e.TWO_PI;for(;h<0;)h+=e.TWO_PI;return g%=e.TWO_PI,h%=e.TWO_PI,h===g&&(h+=e.TWO_PI),g=g<=e.HALF_PI?Math.atan(c/f*Math.tan(g)):g>e.HALF_PI&&g<=3*e.HALF_PI?Math.atan(c/f*Math.tan(g))+e.PI:Math.atan(c/f*Math.tan(g))+e.TWO_PI,h=h<=e.HALF_PI?Math.atan(c/f*Math.tan(h)):h>e.HALF_PI&&h<=3*e.HALF_PI?Math.atan(c/f*Math.tan(h))+e.PI:Math.atan(c/f*Math.tan(h))+e.TWO_PI,g>h&&(h+=e.TWO_PI),c=Math.abs(c),f=Math.abs(f),this._renderer.arc(a,b,c,f,g,h,i),this},d.prototype.ellipse=function(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];if(3===a.length&&a.push(a[2]),d._validateParameters("ellipse",a),a[2]<0&&(a[2]=Math.abs(a[2])),a[3]<0&&(a[3]=Math.abs(a[3])),!this._renderer._doStroke&&!this._renderer._doFill)return this;var c=f.modeAdjust(a[0],a[1],a[2],a[3],this._renderer._ellipseMode);return a[0]=c.x,a[1]=c.y,a[2]=c.w,a[3]=c.h,this._renderer.ellipse(a),this},d.prototype.line=function(){if(!this._renderer._doStroke)return this;for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];return d._validateParameters("line",a),this._renderer.isP3D?this._renderer.line(a[0],a[1],a[2],a[3],a[4],a[5]):this._renderer.line(a[0],a[1],a[2],a[3]),this},d.prototype.point=function(){if(!this._renderer._doStroke)return this;for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];return d._validateParameters("point",a),this._renderer.isP3D?this._renderer.point(a[0],a[1],a[2]):this._renderer.point(a[0],a[1]),this},d.prototype.quad=function(){if(!this._renderer._doStroke&&!this._renderer._doFill)return this;for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];return d._validateParameters("quad",a),this._renderer.isP3D?this._renderer.quad(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7],a[8],a[9],a[10],a[11]):this._renderer.quad(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]),this},d.prototype.rect=function(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];if(!this._renderer._doStroke&&!this._renderer._doFill)return this;d._validateParameters("rect",a);var c=f.modeAdjust(a[0],a[1],a[2],a[3],this._renderer._rectMode);return a[0]=c.x,a[1]=c.y,a[2]=c.w,a[3]=c.h,this._renderer.rect(a),this},d.prototype.triangle=function(){if(!this._renderer._doStroke&&!this._renderer._doFill)return this;for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];return d._validateParameters("triangle",a),this._renderer.triangle(a),this},b.exports=d},{"./canvas":53,"./constants":54,"./core":55,"./error_helpers":58}],52:[function(a,b,c){"use strict";var d=a("./core"),e=a("./constants");d.prototype.ellipseMode=function(a){return a!==e.CORNER&&a!==e.CORNERS&&a!==e.RADIUS&&a!==e.CENTER||(this._renderer._ellipseMode=a),this},d.prototype.noSmooth=function(){return this._renderer.noSmooth(),this},d.prototype.rectMode=function(a){return a!==e.CORNER&&a!==e.CORNERS&&a!==e.RADIUS&&a!==e.CENTER||(this._renderer._rectMode=a),this},d.prototype.smooth=function(){return this._renderer.smooth(),this},d.prototype.strokeCap=function(a){return a!==e.ROUND&&a!==e.SQUARE&&a!==e.PROJECT||this._renderer.strokeCap(a),this},d.prototype.strokeJoin=function(a){return a!==e.ROUND&&a!==e.BEVEL&&a!==e.MITER||this._renderer.strokeJoin(a),this},d.prototype.strokeWeight=function(a){return this._renderer.strokeWeight(a),this},b.exports=d},{"./constants":54,"./core":55}],53:[function(a,b,c){var d=a("./constants");b.exports={modeAdjust:function(a,b,c,e,f){return f===d.CORNER?{x:a,y:b,w:c,h:e}:f===d.CORNERS?{x:a,y:b,w:c-a,h:e-b}:f===d.RADIUS?{x:a-c,y:b-e,w:2*c,h:2*e}:f===d.CENTER?{x:a-.5*c,y:b-.5*e,w:c,h:e}:void 0},arcModeAdjust:function(a,b,c,e,f){return f===d.CORNER?{x:a+.5*c,y:b+.5*e,w:c,h:e}:f===d.CORNERS?{x:a,y:b,w:c+a,h:e+b}:f===d.RADIUS?{x:a,y:b,w:2*c,h:2*e}:f===d.CENTER?{x:a,y:b,w:c,h:e}:void 0}}},{"./constants":54}],54:[function(a,b,c){var d=Math.PI;b.exports={P2D:"p2d",WEBGL:"webgl",ARROW:"default",CROSS:"crosshair",HAND:"pointer",MOVE:"move",TEXT:"text",WAIT:"wait",HALF_PI:d/2,PI:d,QUARTER_PI:d/4,TAU:2*d,TWO_PI:2*d,DEGREES:"degrees",RADIANS:"radians",DEG_TO_RAD:d/180,RAD_TO_DEG:180/d,CORNER:"corner",CORNERS:"corners",RADIUS:"radius",RIGHT:"right",LEFT:"left",CENTER:"center",TOP:"top",BOTTOM:"bottom",BASELINE:"alphabetic",POINTS:0,LINES:1,LINE_STRIP:3,LINE_LOOP:2,TRIANGLES:4,TRIANGLE_FAN:6,TRIANGLE_STRIP:5,QUADS:"quads",QUAD_STRIP:"quad_strip",CLOSE:"close",OPEN:"open",CHORD:"chord",PIE:"pie",PROJECT:"square",SQUARE:"butt",ROUND:"round",BEVEL:"bevel",MITER:"miter",RGB:"rgb",HSB:"hsb",HSL:"hsl",AUTO:"auto",ALT:18,BACKSPACE:8,CONTROL:17,DELETE:46,DOWN_ARROW:40,ENTER:13,ESCAPE:27,LEFT_ARROW:37,OPTION:18,RETURN:13,RIGHT_ARROW:39,SHIFT:16,TAB:9,UP_ARROW:38,BLEND:"source-over",ADD:"lighter",DARKEST:"darken",LIGHTEST:"lighten",DIFFERENCE:"difference",EXCLUSION:"exclusion",MULTIPLY:"multiply",SCREEN:"screen",REPLACE:"copy",OVERLAY:"overlay",HARD_LIGHT:"hard-light",SOFT_LIGHT:"soft-light",DODGE:"color-dodge",BURN:"color-burn",THRESHOLD:"threshold",GRAY:"gray",OPAQUE:"opaque",INVERT:"invert",POSTERIZE:"posterize",DILATE:"dilate",ERODE:"erode",BLUR:"blur",NORMAL:"normal",ITALIC:"italic",BOLD:"bold",_DEFAULT_TEXT_FILL:"#000000",_DEFAULT_LEADMULT:1.25,_CTX_MIDDLE:"middle",LINEAR:"linear",QUADRATIC:"quadratic",BEZIER:"bezier",CURVE:"curve",STROKE:"stroke",FILL:"fill",TEXTURE:"texture",IMMEDIATE:"immediate",LANDSCAPE:"landscape",PORTRAIT:"portrait",_DEFAULT_STROKE:"#000000",_DEFAULT_FILL:"#FFFFFF"}},{}],55:[function(a,b,c){"use strict";a("./shim");var d=a("./constants"),e=function(a,b,c){2===arguments.length&&"boolean"==typeof b&&(c=b,b=void 0),this._setupDone=!1,this._pixelDensity=Math.ceil(window.devicePixelRatio)||1,this._userNode=b,this._curElement=null,this._elements=[],this._requestAnimId=0,this._preloadCount=0,this._isGlobal=!1,this._loop=!0,this._styles=[],this._defaultCanvasSize={width:100,height:100},this._events={mousemove:null,mousedown:null,mouseup:null,dragend:null,dragover:null,click:null,mouseover:null,mouseout:null,keydown:null,keyup:null,keypress:null,touchstart:null,touchmove:null,touchend:null,resize:null,blur:null},this._events.wheel=null,this._loadingScreenId="p5_loading",window.DeviceOrientationEvent&&(this._events.deviceorientation=null),window.DeviceMotionEvent&&!window._isNodeWebkit&&(this._events.devicemotion=null),this._start=function(){this._userNode&&"string"==typeof this._userNode&&(this._userNode=document.getElementById(this._userNode));var a=this.preload||window.preload;if(a){var b=document.getElementById(this._loadingScreenId);if(!b){b=document.createElement("div"),b.innerHTML="Loading...",b.style.position="absolute",b.id=this._loadingScreenId;(this._userNode||document.body).appendChild(b)}for(var c in this._preloadMethods){this._preloadMethods[c]=this._preloadMethods[c]||e;var d=this._preloadMethods[c];d!==e.prototype&&d!==e||(d=this._isGlobal?window:this),this._registeredPreloadMethods[c]=d[c],d[c]=this._wrapPreload(d,c)}a(),this._runIfPreloadsAreDone()}else this._setup(),this._runFrames(),this._draw()}.bind(this),this._runIfPreloadsAreDone=function(){var a=this._isGlobal?window:this;if(0===a._preloadCount){var b=document.getElementById(a._loadingScreenId);b&&b.parentNode.removeChild(b),a._setup(),a._runFrames(),a._draw()}},this._decrementPreload=function(){var a=this._isGlobal?window:this;"function"==typeof a.preload&&(a._setProperty("_preloadCount",a._preloadCount-1),a._runIfPreloadsAreDone())},this._wrapPreload=function(a,b){return function(){this._incrementPreload();for(var c=new Array(arguments.length),d=0;d<c.length;++d)c[d]=arguments[d];return this._registeredPreloadMethods[b].apply(a,c)}.bind(this)},this._incrementPreload=function(){var a=this._isGlobal?window:this;a._setProperty("_preloadCount",a._preloadCount+1)},this._setup=function(){this.createCanvas(this._defaultCanvasSize.width,this._defaultCanvasSize.height,"p2d",!0);var a=this._isGlobal?window:this;if("function"==typeof a.preload)for(var b in this._preloadMethods)a[b]=this._preloadMethods[b][b],a[b]&&this&&(a[b]=a[b].bind(this));"function"==typeof a.setup&&a.setup();for(var c=document.getElementsByTagName("canvas"),d=0;d<c.length;d++){var e=c[d];"true"===e.dataset.hidden&&(e.style.visibility="",delete e.dataset.hidden)}this._setupDone=!0}.bind(this),this._draw=function(){var a=window.performance.now(),b=a-this._lastFrameTime,c=1e3/this._targetFrameRate;(!this._loop||b>=c-5)&&(this.redraw(),this._frameRate=1e3/(a-this._lastFrameTime),this._lastFrameTime=a,void 0!==this._updateMouseCoords&&this._updateMouseCoords()),this._loop&&(this._requestAnimId=window.requestAnimationFrame(this._draw))}.bind(this),this._runFrames=function(){this._updateInterval&&clearInterval(this._updateInterval)}.bind(this),this._setProperty=function(a,b){this[a]=b,this._isGlobal&&(window[a]=b)}.bind(this),this.remove=function(){if(this._curElement){this._loop=!1,this._requestAnimId&&window.cancelAnimationFrame(this._requestAnimId);for(var a in this._events)window.removeEventListener(a,this._events[a]);for(var b=0;b<this._elements.length;b++){var c=this._elements[b];c.elt.parentNode&&c.elt.parentNode.removeChild(c.elt);for(var d in c._events)c.elt.removeEventListener(d,c._events[d])}var f=this;if(this._registeredMethods.remove.forEach(function(a){void 0!==a&&a.call(f)}),this._isGlobal){for(var g in e.prototype)try{delete window[g]}catch(a){window[g]=void 0}for(var h in this)if(this.hasOwnProperty(h))try{delete window[h]}catch(a){window[h]=void 0}}}}.bind(this),this._registeredMethods.init.forEach(function(a){void 0!==a&&a.call(this)},this);var d=this._createFriendlyGlobalFunctionBinder();if(a)a(this);else{this._isGlobal=!0,e.instance=this;for(var f in e.prototype)if("function"==typeof e.prototype[f]){var g=f.substring(2);this._events.hasOwnProperty(g)||(Math.hasOwnProperty(f)&&Math[f]===e.prototype[f]?d(f,e.prototype[f]):d(f,e.prototype[f].bind(this)))}else d(f,e.prototype[f]);for(var h in this)this.hasOwnProperty(h)&&d(h,this[h])}for(var i in this._events){var j=this["_on"+i];if(j){var k=j.bind(this);window.addEventListener(i,k,{passive:!1}),this._events[i]=k}}var l=function(){this._setProperty("focused",!0)}.bind(this),m=function(){this._setProperty("focused",!1)}.bind(this);window.addEventListener("focus",l),window.addEventListener("blur",m),this.registerMethod("remove",function(){window.removeEventListener("focus",l),window.removeEventListener("blur",m)}),c?this._start():"complete"===document.readyState?this._start():window.addEventListener("load",this._start.bind(this),!1)};e.instance=null,e.disableFriendlyErrors=!1;for(var f in d)e.prototype[f]=d[f];e.prototype._preloadMethods={loadJSON:e.prototype,loadImage:e.prototype,loadStrings:e.prototype,loadXML:e.prototype,loadShape:e.prototype,loadTable:e.prototype,loadFont:e.prototype,loadModel:e.prototype,loadShader:e.prototype},e.prototype._registeredMethods={init:[],pre:[],post:[],remove:[]},e.prototype._registeredPreloadMethods={},e.prototype.registerPreloadMethod=function(a,b){e.prototype._preloadMethods.hasOwnProperty(a)||(e.prototype._preloadMethods[a]=b)},e.prototype.registerMethod=function(a,b){e.prototype._registeredMethods.hasOwnProperty(a)||(e.prototype._registeredMethods[a]=[]),e.prototype._registeredMethods[a].push(b)},e.prototype._createFriendlyGlobalFunctionBinder=function(a){a=a||{};var b=a.globalObject||window,c=a.log||console.log.bind(console),d={print:!0};return function(a,f){if(e.disableFriendlyErrors,1)b[a]=f;else try{if(a in b&&!(a in d))throw new Error('global "'+a+'" already exists');Object.defineProperty(b,a,{configurable:!0,enumerable:!0,get:function(){return f},set:function(d){Object.defineProperty(b,a,{configurable:!0,enumerable:!0,value:d,writable:!0}),c('You just changed the value of "'+a+"\", which was a p5 function. This could cause problems later if you're not careful.")}})}catch(d){c('p5 had problems creating the global function "'+a+'", possibly because your code is already using that name as a variable. You may want to rename your variable to something else.'),b[a]=f}}},b.exports=e},{"./constants":54,"./shim":65}],56:[function(a,b,c){"use strict";var d=a("./core");a("./error_helpers");var e=20,f=20;d.prototype.bezier=function(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];return d._validateParameters("bezier",a),this._renderer._doStroke||this._renderer._doFill?(this._renderer.isP3D?(a.push(e),this._renderer.bezier(a)):this._renderer.bezier(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]),this):this},d.prototype.bezierDetail=function(a){return e=a,this},d.prototype.bezierPoint=function(a,b,c,e,f){for(var g=new Array(arguments.length),h=0;h<g.length;++h)g[h]=arguments[h];d._validateParameters("bezierPoint",g);var i=1-g[4];return Math.pow(i,3)*g[0]+3*Math.pow(i,2)*g[4]*g[1]+3*i*Math.pow(g[4],2)*g[2]+Math.pow(g[4],3)*g[3]},d.prototype.bezierTangent=function(a,b,c,e,f){for(var g=new Array(arguments.length),h=0;h<g.length;++h)g[h]=arguments[h];d._validateParameters("bezierTangent",g);var i=1-g[4];return 3*g[3]*Math.pow(g[4],2)-3*g[2]*Math.pow(g[4],2)+6*g[2]*i*g[4]-6*g[1]*i*g[4]+3*g[1]*Math.pow(i,2)-3*g[0]*Math.pow(i,2)},d.prototype.curve=function(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];return d._validateParameters("curve",a),this._renderer._doStroke?(this._renderer.isP3D?(a.push(f),this._renderer.curve(a)):this._renderer.curve(a[0],a[1],a[2],a[3],a[4],a[5],a[6],a[7]),this):this},d.prototype.curveDetail=function(a){return f=a,this},d.prototype.curveTightness=function(a){this._renderer._curveTightness=a},d.prototype.curvePoint=function(a,b,c,e,f){for(var g=new Array(arguments.length),h=0;h<g.length;++h)g[h]=arguments[h];d._validateParameters("curvePoint",g);var i=g[4]*g[4]*g[4],j=g[4]*g[4],k=-.5*i+j-.5*g[4],l=1.5*i-2.5*j+1,m=-1.5*i+2*j+.5*g[4],n=.5*i-.5*j;return g[0]*k+g[1]*l+g[2]*m+g[3]*n},d.prototype.curveTangent=function(a,b,c,e,f){for(var g=new Array(arguments.length),h=0;h<g.length;++h)g[h]=arguments[h];d._validateParameters("curveTangent",g);var i=g[4]*g[4],j=-3*i/2+2*g[4]-.5,k=9*i/2-5*g[4],l=-9*i/2+4*g[4]+.5,m=3*i/2-g[4];return g[0]*j+g[1]*k+g[2]*l+g[3]*m},b.exports=d},{"./core":55,"./error_helpers":58}],57:[function(a,b,c){"use strict";function d(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth||0}function e(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight||0}function f(a){if(!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled))throw new Error("Fullscreen not enabled in this browser.");a.requestFullscreen?a.requestFullscreen():a.mozRequestFullScreen?a.mozRequestFullScreen():a.webkitRequestFullscreen?a.webkitRequestFullscreen():a.msRequestFullscreen&&a.msRequestFullscreen()}function g(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()}var h=a("./core"),i=a("./constants"),j=[i.ARROW,i.CROSS,i.HAND,i.MOVE,i.TEXT,i.WAIT];h.prototype._frameRate=0,h.prototype._lastFrameTime=window.performance.now(),h.prototype._targetFrameRate=60;var k=window.print;h.prototype.print=function(a){0===arguments.length?k():console.log.apply(console,arguments)},h.prototype.frameCount=0,h.prototype.focused=document.hasFocus(),h.prototype.cursor=function(a,b,c){var d="auto",e=this._curElement.elt;if(j.indexOf(a)>-1)d=a;else if("string"==typeof a){var f="";b&&c&&"number"==typeof b&&"number"==typeof c&&(f=b+" "+c),d="http://"===a.substring(0,7)||"https://"===a.substring(0,8)?"url("+a+") "+f+", auto":/\.(cur|jpg|jpeg|gif|png|CUR|JPG|JPEG|GIF|PNG)$/.test(a)?"url("+a+") "+f+", auto":a}e.style.cursor=d},h.prototype.frameRate=function(a){return"number"!=typeof a||a<0?this._frameRate:(this._setProperty("_targetFrameRate",a),this._runFrames(),this)},h.prototype.getFrameRate=function(){return this.frameRate()},h.prototype.setFrameRate=function(a){return this.frameRate(a)},h.prototype.noCursor=function(){this._curElement.elt.style.cursor="none"},h.prototype.displayWidth=screen.width,h.prototype.displayHeight=screen.height,h.prototype.windowWidth=d(),h.prototype.windowHeight=e(),h.prototype._onresize=function(a){this._setProperty("windowWidth",d()),this._setProperty("windowHeight",e());var b,c=this._isGlobal?window:this;"function"==typeof c.windowResized&&(void 0===(b=c.windowResized(a))||b||a.preventDefault())},h.prototype.width=0,h.prototype.height=0,h.prototype.fullscreen=function(a){if(void 0===a)return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;a?f(document.documentElement):g()},h.prototype.pixelDensity=function(a){if("number"!=typeof a)return this._pixelDensity;this._pixelDensity=a,this.resizeCanvas(this.width,this.height,!0)},h.prototype.displayDensity=function(){return window.devicePixelRatio},h.prototype.getURL=function(){return location.href},h.prototype.getURLPath=function(){return location.pathname.split("/").filter(function(a){return""!==a})},h.prototype.getURLParams=function(){for(var a,b=/[?&]([^&=]+)(?:[&=])([^&=]+)/gim,c={};null!=(a=b.exec(location.search));)a.index===b.lastIndex&&b.lastIndex++,c[a[1]]=a[2];return c},b.exports=h},{"./constants":54,"./core":55}],58:[function(a,b,c){"use strict";function d(a,b,c){m&&(i(),m=!1),"undefined"===t(c)?c="#B40033":"number"===t(c)&&(c=v[c]),"load"===b.substring(0,4)?console.log("> p5.js says: "+a+"[https://github.com/processing/p5.js/wiki/Local-server]"):console.log("> p5.js says: "+a+" [http://p5js.org/reference/#p5/"+b+"]")}function e(a){var b=o.classitems.filter(function(b){return b.name===a});if(b[0].hasOwnProperty("overloads")){for(var c=[],d=0;d<b[0].overloads.length;d++)c.push(b[0].overloads[d].params);return c}return[b[0].params]}function f(a,b){for(var c,d=[],e=0;e<b.length;e++){var f=typeof a[e];if("undefined"===f||null===f)b[e].optional!==!0&&(c={type:"EMPTY_VAR",position:e},d.push(c));else{var i=b[e].type.split("|");"object"===f?g(a[e],i)||(c={type:"WRONG_CLASS",position:e,correctClass:i[e],wrongClass:a[e].name},d.push(c)):h(a[e],i)||(c={type:"WRONG_TYPE",position:e,correctType:i[e],wrongType:f},d.push(c))}}return d}function g(a,b){for(var c=0;c<b.length;c++)if("Array"===b[c]){if(a instanceof Array)return!0}else{if(a.name===b[c])return!0;if("Constant"===b[c])return!0}return!1}function h(a,b){for(var c=0;c<b.length;c++){if(typeof a===b[c].toLowerCase())return!0;if("Constant"===b[c])return!0}return!1}function i(){console.log(" _ \n /\\| |/\\ \n \\ ` ' / \n / , . \\ \n \\/|_|\\/ \n\n> p5.js says: Welcome! This is your friendly debugger. To turn me off switch to using “p5.min.js”.")}function j(){var b={},c=function(a){return Object.getOwnPropertyNames(a).filter(function(a){return"_"!==a[0]&&(!(a in b)&&(b[a]=!0,!0))}).map(function(b){var c;return c="function"==typeof a[b]?"function":b===b.toUpperCase()?"constant":"variable",{name:b,type:c}})};x=[].concat(c(l.prototype),c(a("./constants"))),x.sort(function(a,b){return b.name.length-a.name.length})}function k(a,b){b||(b=console.log.bind(console)),x||j(),x.some(function(c){if(a.message&&null!==a.message.match("\\W?"+c.name+"\\W"))return b("Did you just try to use p5.js's "+c.name+("function"===c.type?"() ":" ")+c.type+"? If so, you may want to move it into your sketch's setup() function.\n\nFor more details, see: "+y),!0})}for(var l=a("./core"),m=!1,n=a("../../docs/reference/data.json"),o=JSON.parse(JSON.stringify(n)),p={},q=p.toString,r=["Boolean","Number","String","Function","Array","Date","RegExp","Object","Error"],s=0;s<r.length;s++)p["[object "+r[s]+"]"]=r[s].toLowerCase();var t=function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?p[q.call(a)]||"object":typeof a},u=3,v=["#2D7BB6","#EE9900","#4DB200","#C83C00"],w={0:{fileType:"image",method:"loadImage",message:" hosting the image online,"},1:{fileType:"XML file",method:"loadXML"},2:{fileType:"table file",method:"loadTable"},3:{fileType:"text file",method:"loadStrings"},4:{fileType:"font",method:"loadFont",message:" hosting the font online,"}};l._friendlyFileLoadError=function(a,b){var c=w[a];d("It looks like there was a problem loading your "+c.fileType+". Try checking if the file path ["+b+"] is correct,"+(c.message||"")+" or running a local server.",c.method,3)},l._validateParameters=function(a,b){if(l.disableFriendlyErrors,0){var c=e(a),d=[],g=999999;if(c.length>1){for(var h=0;h<c.length;h++){var i=f(b,c[h]);if(0===i.length)return;g>i.length&&(g=i.length,d=i)}for(var j=0;j<d.length;j++)l._friendlyParamError(d[j],a)}else{d=f(b,c[0]);for(var k=0;k<d.length;k++)l._friendlyParamError(d[k],a)}}},l._friendlyParamError=function(a,b){var c;switch(a.type){case"EMPTY_VAR":c="It looks like "+b+"() received an empty variable in spot #"+a.position+" (zero-based index). If not intentional, this is often a problem with scope: [https://p5js.org/examples/data-variable-scope.html].",d(c,b,u);break;case"WRONG_CLASS":c=b+"() was expecting "+a.correctClass+" for parameter #"+a.position+" (zero-based index), received ",c+="an object with name "+a.wrongClass+" instead.",d(c,b,u);break;case"WRONG_TYPE":c=b+"() was expecting "+a.correctType+" for parameter #"+a.position+" (zero-based index), received ",c+=a.wrongType+" instead.",d(c,b,u)}};var x=null,y="https://github.com/processing/p5.js/wiki/Frequently-Asked-Questions#why-cant-i-assign-variables-using-p5-functions-and-variables-before-setup";l.prototype._helpForMisusedAtTopLevelCode=k,l.prototype._validateParameters=l.validateParameters,"complete"!==document.readyState&&(window.addEventListener("error",k,!1),window.addEventListener("load",function(){window.removeEventListener("error",k,!1)})),b.exports=l},{"../../docs/reference/data.json":1,"./constants":54,"./core":55}],59:[function(a,b,c){var d=a("../core/core"),e=function(){window.PHANTOMJS||window.mocha||(window.setup&&"function"==typeof window.setup||window.draw&&"function"==typeof window.draw)&&!d.instance&&new d};"complete"===document.readyState?e():window.addEventListener("load",e,!1)},{"../core/core":55}],60:[function(a,b,c){function d(a,b,c){return b===!1?f(a,c):e(a,b,c),this}function e(a,b,c){c._events[a]&&f(a,c);var d=b.bind(c);c.elt.addEventListener(a,d,!1),c._events[a]=d}function f(a,b){var c=b._events[a];b.elt.removeEventListener(a,c,!1),b._events[a]=null}var g=a("./core");g.Element=function(a,b){this.elt=a,this._pInst=b,this._events={},this.width=this.elt.offsetWidth,this.height=this.elt.offsetHeight,this.name="p5.Element"},g.Element.prototype.parent=function(a){return 0===arguments.length?this.elt.parentNode:("string"==typeof a?("#"===a[0]&&(a=a.substring(1)),a=document.getElementById(a)):a instanceof g.Element&&(a=a.elt),a.appendChild(this.elt),this)},g.Element.prototype.id=function(a){return 0===arguments.length?this.elt.id:(this.elt.id=a,this.width=this.elt.offsetWidth,this.height=this.elt.offsetHeight,this)},g.Element.prototype.class=function(a){return 0===arguments.length?this.elt.className:(this.elt.className=a,this)},g.Element.prototype.mousePressed=function(a){return d("mousedown",a,this),d("touchstart",a,this),this},g.Element.prototype.doubleClicked=function(a){return d("doubleClicked",a,this),this},g.Element.prototype.mouseWheel=function(a){return d("wheel",a,this),this},g.Element.prototype.mouseReleased=function(a){return d("mouseup",a,this),d("touchend",a,this),this},g.Element.prototype.mouseClicked=function(a){return d("click",a,this),this},
g.Element.prototype.mouseMoved=function(a){return d("mousemove",a,this),d("touchmove",a,this),this},g.Element.prototype.mouseOver=function(a){return d("mouseover",a,this),this},g.Element.prototype.changed=function(a){return d("change",a,this),this},g.Element.prototype.input=function(a){return d("input",a,this),this},g.Element.prototype.mouseOut=function(a){return d("mouseout",a,this),this},g.Element.prototype.touchStarted=function(a){return d("touchstart",a,this),d("mousedown",a,this),this},g.Element.prototype.touchMoved=function(a){return d("touchmove",a,this),d("mousemove",a,this),this},g.Element.prototype.touchEnded=function(a){return d("touchend",a,this),d("mouseup",a,this),this},g.Element.prototype.dragOver=function(a){return d("dragover",a,this),this},g.Element.prototype.dragLeave=function(a){return d("dragleave",a,this),this},g.Element.prototype.drop=function(a,b){function c(b){var c=new g.File(b);return function(b){c.data=b.target.result,a(c)}}return window.File&&window.FileReader&&window.FileList&&window.Blob?(e("dragover",function(a){a.stopPropagation(),a.preventDefault()},this),e("dragleave",function(a){a.stopPropagation(),a.preventDefault()},this),arguments.length>1&&e("drop",b,this),e("drop",function(a){a.stopPropagation(),a.preventDefault();for(var b=a.dataTransfer.files,d=0;d<b.length;d++){var e=b[d],f=new FileReader;f.onload=c(e),e.type.indexOf("text")>-1?f.readAsText(e):f.readAsDataURL(e)}},this)):console.log("The File APIs are not fully supported in this browser."),this},g.Element.prototype._setProperty=function(a,b){this[a]=b},b.exports=g.Element},{"./core":55}],61:[function(a,b,c){var d=a("./core"),e=a("./constants");d.Graphics=function(a,b,c,f){var g=c||e.P2D;this.canvas=document.createElement("canvas"),(this._userNode||document.body).appendChild(this.canvas),d.Element.call(this,this.canvas,f,!1),this._styles=[],this.width=a,this.height=b,this._pixelDensity=f._pixelDensity,g===e.WEBGL?this._renderer=new d.RendererGL(this.canvas,this,!1):this._renderer=new d.Renderer2D(this.canvas,this,!1),this._renderer.resize(a,b),this._renderer._applyDefaults(),f._elements.push(this);for(var h in d.prototype)this[h]||("function"==typeof d.prototype[h]?this[h]=d.prototype[h].bind(this):this[h]=d.prototype[h]);return this.name="p5.Graphics",this},d.Graphics.prototype=Object.create(d.Element.prototype),d.Graphics.prototype.remove=function(){this.elt.parentNode&&this.elt.parentNode.removeChild(this.elt);for(var a in this._events)this.elt.removeEventListener(a,this._events[a])},b.exports=d.Graphics},{"./constants":54,"./core":55}],62:[function(a,b,c){function d(a){var b=0,c=0;if(a.offsetParent)do{b+=a.offsetLeft,c+=a.offsetTop}while(a=a.offsetParent);else b+=a.offsetLeft,c+=a.offsetTop;return[b,c]}var e=a("./core"),f=a("../core/constants");e.Renderer=function(a,b,c){e.Element.call(this,a,b),this.name="p5.Renderer",this.canvas=a,this._pInst=b,c?(this._isMainCanvas=!0,this._pInst._setProperty("_curElement",this),this._pInst._setProperty("canvas",this.canvas),this._pInst._setProperty("width",this.width),this._pInst._setProperty("height",this.height)):(this.canvas.style.display="none",this._styles=[]),this._textSize=12,this._textLeading=15,this._textFont="sans-serif",this._textStyle=f.NORMAL,this._textAscent=null,this._textDescent=null,this._rectMode=f.CORNER,this._ellipseMode=f.CENTER,this._curveTightness=0,this._imageMode=f.CORNER,this._tint=null,this._doStroke=!0,this._doFill=!0,this._strokeSet=!1,this._fillSet=!1,this._colorMode=f.RGB,this._colorMaxes={rgb:[255,255,255,255],hsb:[360,100,100,1],hsl:[360,100,100,1]}},e.Renderer.prototype=Object.create(e.Element.prototype),e.Renderer.prototype.resize=function(a,b){this.width=a,this.height=b,this.elt.width=a*this._pInst._pixelDensity,this.elt.height=b*this._pInst._pixelDensity,this.elt.style.width=a+"px",this.elt.style.height=b+"px",this._isMainCanvas&&(this._pInst._setProperty("width",this.width),this._pInst._setProperty("height",this.height))},e.Renderer.prototype.textLeading=function(a){return arguments.length&&arguments[0]?(this._setProperty("_textLeading",a),this):this._textLeading},e.Renderer.prototype.textSize=function(a){return arguments.length&&arguments[0]?(this._setProperty("_textSize",a),this._setProperty("_textLeading",a*f._DEFAULT_LEADMULT),this._applyTextProperties()):this._textSize},e.Renderer.prototype.textStyle=function(a){return arguments.length&&arguments[0]?(a!==f.NORMAL&&a!==f.ITALIC&&a!==f.BOLD||this._setProperty("_textStyle",a),this._applyTextProperties()):this._textStyle},e.Renderer.prototype.textAscent=function(){return null===this._textAscent&&this._updateTextMetrics(),this._textAscent},e.Renderer.prototype.textDescent=function(){return null===this._textDescent&&this._updateTextMetrics(),this._textDescent},e.Renderer.prototype._applyDefaults=function(){return this},e.Renderer.prototype._isOpenType=function(a){return"object"==typeof(a=a||this._textFont)&&a.font&&a.font.supported},e.Renderer.prototype._updateTextMetrics=function(){if(this._isOpenType())return this._setProperty("_textAscent",this._textFont._textAscent()),this._setProperty("_textDescent",this._textFont._textDescent()),this;var a=document.createElement("span");a.style.fontFamily=this._textFont,a.style.fontSize=this._textSize+"px",a.innerHTML="ABCjgq|";var b=document.createElement("div");b.style.display="inline-block",b.style.width="1px",b.style.height="0px";var c=document.createElement("div");c.appendChild(a),c.appendChild(b),c.style.height="0px",c.style.overflow="hidden",document.body.appendChild(c),b.style.verticalAlign="baseline";var e=d(b),f=d(a),g=e[1]-f[1];b.style.verticalAlign="bottom",e=d(b),f=d(a);var h=e[1]-f[1],i=h-g;return document.body.removeChild(c),this._setProperty("_textAscent",g),this._setProperty("_textDescent",i),this},b.exports=e.Renderer},{"../core/constants":54,"./core":55}],63:[function(a,b,c){var d=a("./core"),e=a("./canvas"),f=a("./constants"),g=a("../image/filters");a("./p5.Renderer");var h="rgba(0,0,0,0)";d.Renderer2D=function(a,b,c){return d.Renderer.call(this,a,b,c),this.name="p5.Renderer2D",this.drawingContext=this.canvas.getContext("2d"),this._pInst._setProperty("drawingContext",this.drawingContext),this},d.Renderer2D.prototype=Object.create(d.Renderer.prototype),d.Renderer2D.prototype._applyDefaults=function(){this._cachedFillStyle=this._cachedStrokeStyle=void 0,this._setFill(f._DEFAULT_FILL),this._setStroke(f._DEFAULT_STROKE),this.drawingContext.lineCap=f.ROUND,this.drawingContext.font="normal 12px sans-serif"},d.Renderer2D.prototype.resize=function(a,b){d.Renderer.prototype.resize.call(this,a,b),this.drawingContext.scale(this._pInst._pixelDensity,this._pInst._pixelDensity)},d.Renderer2D.prototype.background=function(){if(this.drawingContext.save(),this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pInst._pixelDensity,this._pInst._pixelDensity),arguments[0]instanceof d.Image)this._pInst.image(arguments[0],0,0,this.width,this.height);else{var a=this._getFill(),b=this._pInst.color.apply(this,arguments),c=b.toString();this._setFill(c),this.drawingContext.fillRect(0,0,this.width,this.height),this._setFill(a)}this.drawingContext.restore()},d.Renderer2D.prototype.clear=function(){this.drawingContext.clearRect(0,0,this.width,this.height)},d.Renderer2D.prototype.fill=function(){var a=this._pInst.color.apply(this,arguments);this._setFill(a.toString())},d.Renderer2D.prototype.stroke=function(){var a=this._pInst.color.apply(this,arguments);this._setStroke(a.toString())},d.Renderer2D.prototype.image=function(a,b,c,e,f,g,h,i,j){var k;try{this._tint&&(d.MediaElement&&a instanceof d.MediaElement&&a.loadPixels(),a.canvas&&(k=this._getTintedImageCanvas(a))),k||(k=a.canvas||a.elt),this.drawingContext.drawImage(k,b,c,e,f,g,h,i,j)}catch(a){if("NS_ERROR_NOT_AVAILABLE"!==a.name)throw a}},d.Renderer2D.prototype._getTintedImageCanvas=function(a){if(!a.canvas)return a;var b=g._toPixels(a.canvas),c=document.createElement("canvas");c.width=a.canvas.width,c.height=a.canvas.height;for(var d=c.getContext("2d"),e=d.createImageData(a.canvas.width,a.canvas.height),f=e.data,h=0;h<b.length;h+=4){var i=b[h],j=b[h+1],k=b[h+2],l=b[h+3];f[h]=i*this._tint[0]/255,f[h+1]=j*this._tint[1]/255,f[h+2]=k*this._tint[2]/255,f[h+3]=l*this._tint[3]/255}return d.putImageData(e,0,0),c},d.Renderer2D.prototype.blendMode=function(a){this.drawingContext.globalCompositeOperation=a},d.Renderer2D.prototype.blend=function(){var a=this.drawingContext.globalCompositeOperation,b=arguments[arguments.length-1],c=Array.prototype.slice.call(arguments,0,arguments.length-1);this.drawingContext.globalCompositeOperation=b,this._pInst?this._pInst.copy.apply(this._pInst,c):this.copy.apply(this,c),this.drawingContext.globalCompositeOperation=a},d.Renderer2D.prototype.copy=function(){var a,b,c,e,f,g,h,i,j;if(9===arguments.length)a=arguments[0],b=arguments[1],c=arguments[2],e=arguments[3],f=arguments[4],g=arguments[5],h=arguments[6],i=arguments[7],j=arguments[8];else{if(8!==arguments.length)throw new Error("Signature not supported");a=this._pInst,b=arguments[0],c=arguments[1],e=arguments[2],f=arguments[3],g=arguments[4],h=arguments[5],i=arguments[6],j=arguments[7]}d.Renderer2D._copyHelper(a,b,c,e,f,g,h,i,j)},d.Renderer2D._copyHelper=function(a,b,c,d,e,f,g,h,i){a.loadPixels();var j=a.canvas.width/a.width;this.drawingContext.drawImage(a.canvas,j*b,j*c,j*d,j*e,f,g,h,i)},d.Renderer2D.prototype.get=function(a,b,c,e){if(void 0===a&&void 0===b&&void 0===c&&void 0===e?(a=0,b=0,c=this.width,e=this.height):void 0===c&&void 0===e&&(c=1,e=1),a+c<0||b+e<0||a>this.width||b>this.height)return[0,0,0,255];var f=this._pInst||this;f.loadPixels();var g=f._pixelDensity;a=Math.floor(a),b=Math.floor(b),c=Math.floor(c),e=Math.floor(e);var h=a*g,i=b*g;if(1!==c||1!==e||this instanceof d.RendererGL){var j=Math.min(c,f.width),k=Math.min(e,f.height),l=j*g,m=k*g,n=new d.Image(j,k);return n.canvas.getContext("2d").drawImage(this.canvas,h,i,l,m,0,0,j,k),n}var o=this.drawingContext.getImageData(h,i,1,1).data;return[o[0],o[1],o[2],o[3]]},d.Renderer2D.prototype.loadPixels=function(){var a=this._pixelDensity||this._pInst._pixelDensity,b=this.width*a,c=this.height*a,d=this.drawingContext.getImageData(0,0,b,c);this._pInst?(this._pInst._setProperty("imageData",d),this._pInst._setProperty("pixels",d.data)):(this._setProperty("imageData",d),this._setProperty("pixels",d.data))},d.Renderer2D.prototype.set=function(a,b,c){if(a=Math.floor(a),b=Math.floor(b),c instanceof d.Image)this.drawingContext.save(),this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pInst._pixelDensity,this._pInst._pixelDensity),this.drawingContext.drawImage(c.canvas,a,b),this.loadPixels.call(this._pInst),this.drawingContext.restore();else{var e=this._pInst||this,f=0,g=0,h=0,i=0,j=4*(b*e._pixelDensity*(this.width*e._pixelDensity)+a*e._pixelDensity);if(e.imageData||e.loadPixels.call(e),"number"==typeof c)j<e.pixels.length&&(f=c,g=c,h=c,i=255);else if(c instanceof Array){if(c.length<4)throw new Error("pixel array must be of the form [R, G, B, A]");j<e.pixels.length&&(f=c[0],g=c[1],h=c[2],i=c[3])}else c instanceof d.Color&&j<e.pixels.length&&(f=c.levels[0],g=c.levels[1],h=c.levels[2],i=c.levels[3]);for(var k=0;k<e._pixelDensity;k++)for(var l=0;l<e._pixelDensity;l++)j=4*((b*e._pixelDensity+l)*this.width*e._pixelDensity+(a*e._pixelDensity+k)),e.pixels[j]=f,e.pixels[j+1]=g,e.pixels[j+2]=h,e.pixels[j+3]=i}},d.Renderer2D.prototype.updatePixels=function(a,b,c,d){var e=this._pixelDensity||this._pInst._pixelDensity;void 0===a&&void 0===b&&void 0===c&&void 0===d&&(a=0,b=0,c=this.width,d=this.height),c*=e,d*=e,this._pInst?this.drawingContext.putImageData(this._pInst.imageData,a,b,0,0,c,d):this.drawingContext.putImageData(this.imageData,a,b,0,0,c,d)},d.Renderer2D.prototype._acuteArcToBezier=function(a,b){var c=b/2,d=Math.cos(c),e=Math.sin(c),f=1/Math.tan(c),g=a+c,h=Math.cos(g),i=Math.sin(g),j=(4-d)/3,k=e+(d-j)*f;return{ax:Math.cos(a),ay:Math.sin(a),bx:j*h+k*i,by:j*i-k*h,cx:j*h-k*i,cy:j*i+k*h,dx:Math.cos(a+b),dy:Math.sin(a+b)}},d.Renderer2D.prototype.arc=function(a,b,c,d,g,h,i){for(var j=this.drawingContext,k=e.arcModeAdjust(a,b,c,d,this._ellipseMode),l=k.w/2,m=k.h/2,n=1e-5,o=0,p=[];h-g>n;)o=Math.min(h-g,f.HALF_PI),p.push(this._acuteArcToBezier(g,o)),g+=o;return this._doFill&&(j.beginPath(),p.forEach(function(a,b){0===b&&j.moveTo(k.x+a.ax*l,k.y+a.ay*m),j.bezierCurveTo(k.x+a.bx*l,k.y+a.by*m,k.x+a.cx*l,k.y+a.cy*m,k.x+a.dx*l,k.y+a.dy*m)}),i!==f.PIE&&null!=i||j.lineTo(k.x,k.y),j.closePath(),j.fill()),this._doStroke&&(j.beginPath(),p.forEach(function(a,b){0===b&&j.moveTo(k.x+a.ax*l,k.y+a.ay*m),j.bezierCurveTo(k.x+a.bx*l,k.y+a.by*m,k.x+a.cx*l,k.y+a.cy*m,k.x+a.dx*l,k.y+a.dy*m)}),i===f.PIE?(j.lineTo(k.x,k.y),j.closePath()):i===f.CHORD&&j.closePath(),j.stroke()),this},d.Renderer2D.prototype.ellipse=function(a){var b=this.drawingContext,c=this._doFill,d=this._doStroke,e=a[0],f=a[1],g=a[2],i=a[3];if(c&&!d){if(this._getFill()===h)return this}else if(!c&&d&&this._getStroke()===h)return this;var j=.5522847498,k=g/2*j,l=i/2*j,m=e+g,n=f+i,o=e+g/2,p=f+i/2;b.beginPath(),b.moveTo(e,p),b.bezierCurveTo(e,p-l,o-k,f,o,f),b.bezierCurveTo(o+k,f,m,p-l,m,p),b.bezierCurveTo(m,p+l,o+k,n,o,n),b.bezierCurveTo(o-k,n,e,p+l,e,p),b.closePath(),c&&b.fill(),d&&b.stroke()},d.Renderer2D.prototype.line=function(a,b,c,d){var e=this.drawingContext;return this._doStroke?this._getStroke()===h?this:(e.lineWidth%2==1&&e.translate(.5,.5),e.beginPath(),e.moveTo(a,b),e.lineTo(c,d),e.stroke(),e.lineWidth%2==1&&e.translate(-.5,-.5),this):this},d.Renderer2D.prototype.point=function(a,b){var c=this.drawingContext;if(!this._doStroke)return this;if(this._getStroke()===h)return this;var d=this._getStroke(),e=this._getFill();a=Math.round(a),b=Math.round(b),this._setFill(d),c.lineWidth>1?(c.beginPath(),c.arc(a,b,c.lineWidth/2,0,f.TWO_PI,!1),c.fill()):c.fillRect(a,b,1,1),this._setFill(e)},d.Renderer2D.prototype.quad=function(a,b,c,d,e,f,g,i){var j=this.drawingContext,k=this._doFill,l=this._doStroke;if(k&&!l){if(this._getFill()===h)return this}else if(!k&&l&&this._getStroke()===h)return this;return j.beginPath(),j.moveTo(a,b),j.lineTo(c,d),j.lineTo(e,f),j.lineTo(g,i),j.closePath(),k&&j.fill(),l&&j.stroke(),this},d.Renderer2D.prototype.rect=function(a){var b=a[0],c=a[1],d=a[2],e=a[3],f=a[4],g=a[5],i=a[6],j=a[7],k=this.drawingContext,l=this._doFill,m=this._doStroke;if(l&&!m){if(this._getFill()===h)return this}else if(!l&&m&&this._getStroke()===h)return this;if(this._doStroke&&k.lineWidth%2==1&&k.translate(.5,.5),k.beginPath(),void 0===f)k.rect(b,c,d,e);else{void 0===g&&(g=f),void 0===i&&(i=g),void 0===j&&(j=i);var n=d/2,o=e/2;d<2*f&&(f=n),e<2*f&&(f=o),d<2*g&&(g=n),e<2*g&&(g=o),d<2*i&&(i=n),e<2*i&&(i=o),d<2*j&&(j=n),e<2*j&&(j=o),k.beginPath(),k.moveTo(b+f,c),k.arcTo(b+d,c,b+d,c+e,g),k.arcTo(b+d,c+e,b,c+e,i),k.arcTo(b,c+e,b,c,j),k.arcTo(b,c,b+d,c,f),k.closePath()}return this._doFill&&k.fill(),this._doStroke&&k.stroke(),this._doStroke&&k.lineWidth%2==1&&k.translate(-.5,-.5),this},d.Renderer2D.prototype.triangle=function(a){var b=this.drawingContext,c=this._doFill,d=this._doStroke,e=a[0],f=a[1],g=a[2],i=a[3],j=a[4],k=a[5];if(c&&!d){if(this._getFill()===h)return this}else if(!c&&d&&this._getStroke()===h)return this;b.beginPath(),b.moveTo(e,f),b.lineTo(g,i),b.lineTo(j,k),b.closePath(),c&&b.fill(),d&&b.stroke()},d.Renderer2D.prototype.endShape=function(a,b,c,d,e,g,h){if(0===b.length)return this;if(!this._doStroke&&!this._doFill)return this;var i,j=a===f.CLOSE;j&&!g&&b.push(b[0]);var k,l,m=b.length;if(!c||h!==f.POLYGON&&null!==h)if(!d||h!==f.POLYGON&&null!==h)if(!e||h!==f.POLYGON&&null!==h)if(h===f.POINTS)for(k=0;k<m;k++)i=b[k],this._doStroke&&this._pInst.stroke(i[6]),this._pInst.point(i[0],i[1]);else if(h===f.LINES)for(k=0;k+1<m;k+=2)i=b[k],this._doStroke&&this._pInst.stroke(b[k+1][6]),this._pInst.line(i[0],i[1],b[k+1][0],b[k+1][1]);else if(h===f.TRIANGLES)for(k=0;k+2<m;k+=3)i=b[k],this.drawingContext.beginPath(),this.drawingContext.moveTo(i[0],i[1]),this.drawingContext.lineTo(b[k+1][0],b[k+1][1]),this.drawingContext.lineTo(b[k+2][0],b[k+2][1]),this.drawingContext.lineTo(i[0],i[1]),this._doFill&&(this._pInst.fill(b[k+2][5]),this.drawingContext.fill()),this._doStroke&&(this._pInst.stroke(b[k+2][6]),this.drawingContext.stroke()),this.drawingContext.closePath();else if(h===f.TRIANGLE_STRIP)for(k=0;k+1<m;k++)i=b[k],this.drawingContext.beginPath(),this.drawingContext.moveTo(b[k+1][0],b[k+1][1]),this.drawingContext.lineTo(i[0],i[1]),this._doStroke&&this._pInst.stroke(b[k+1][6]),this._doFill&&this._pInst.fill(b[k+1][5]),k+2<m&&(this.drawingContext.lineTo(b[k+2][0],b[k+2][1]),this._doStroke&&this._pInst.stroke(b[k+2][6]),this._doFill&&this._pInst.fill(b[k+2][5])),this._doFillStrokeClose();else if(h===f.TRIANGLE_FAN){if(m>2){for(this.drawingContext.beginPath(),k=2;k<m;k++)i=b[k],this.drawingContext.moveTo(b[0][0],b[0][1]),this.drawingContext.lineTo(b[k-1][0],b[k-1][1]),this.drawingContext.lineTo(i[0],i[1]),this.drawingContext.lineTo(b[0][0],b[0][1]),k<m-1&&(this._doFill&&i[5]!==b[k+1][5]||this._doStroke&&i[6]!==b[k+1][6])&&(this._doFill&&(this._pInst.fill(i[5]),this.drawingContext.fill(),this._pInst.fill(b[k+1][5])),this._doStroke&&(this._pInst.stroke(i[6]),this.drawingContext.stroke(),this._pInst.stroke(b[k+1][6])),this.drawingContext.closePath(),this.drawingContext.beginPath());this._doFillStrokeClose()}}else if(h===f.QUADS)for(k=0;k+3<m;k+=4){for(i=b[k],this.drawingContext.beginPath(),this.drawingContext.moveTo(i[0],i[1]),l=1;l<4;l++)this.drawingContext.lineTo(b[k+l][0],b[k+l][1]);this.drawingContext.lineTo(i[0],i[1]),this._doFill&&this._pInst.fill(b[k+3][5]),this._doStroke&&this._pInst.stroke(b[k+3][6]),this._doFillStrokeClose()}else if(h===f.QUAD_STRIP){if(m>3)for(k=0;k+1<m;k+=2)i=b[k],this.drawingContext.beginPath(),k+3<m?(this.drawingContext.moveTo(b[k+2][0],b[k+2][1]),this.drawingContext.lineTo(i[0],i[1]),this.drawingContext.lineTo(b[k+1][0],b[k+1][1]),this.drawingContext.lineTo(b[k+3][0],b[k+3][1]),this._doFill&&this._pInst.fill(b[k+3][5]),this._doStroke&&this._pInst.stroke(b[k+3][6])):(this.drawingContext.moveTo(i[0],i[1]),this.drawingContext.lineTo(b[k+1][0],b[k+1][1])),this._doFillStrokeClose()}else{for(this.drawingContext.beginPath(),this.drawingContext.moveTo(b[0][0],b[0][1]),k=1;k<m;k++)i=b[k],i.isVert&&(i.moveTo?this.drawingContext.moveTo(i[0],i[1]):this.drawingContext.lineTo(i[0],i[1]));this._doFillStrokeClose()}else{for(this.drawingContext.beginPath(),k=0;k<m;k++)b[k].isVert?b[k].moveTo?this.drawingContext.moveTo([0],b[k][1]):this.drawingContext.lineTo(b[k][0],b[k][1]):this.drawingContext.quadraticCurveTo(b[k][0],b[k][1],b[k][2],b[k][3]);this._doFillStrokeClose()}else{for(this.drawingContext.beginPath(),k=0;k<m;k++)b[k].isVert?b[k].moveTo?this.drawingContext.moveTo(b[k][0],b[k][1]):this.drawingContext.lineTo(b[k][0],b[k][1]):this.drawingContext.bezierCurveTo(b[k][0],b[k][1],b[k][2],b[k][3],b[k][4],b[k][5]);this._doFillStrokeClose()}else if(m>3){var n=[],o=1-this._curveTightness;for(this.drawingContext.beginPath(),this.drawingContext.moveTo(b[1][0],b[1][1]),k=1;k+2<m;k++)i=b[k],n[0]=[i[0],i[1]],n[1]=[i[0]+(o*b[k+1][0]-o*b[k-1][0])/6,i[1]+(o*b[k+1][1]-o*b[k-1][1])/6],n[2]=[b[k+1][0]+(o*b[k][0]-o*b[k+2][0])/6,b[k+1][1]+(o*b[k][1]-o*b[k+2][1])/6],n[3]=[b[k+1][0],b[k+1][1]],this.drawingContext.bezierCurveTo(n[1][0],n[1][1],n[2][0],n[2][1],n[3][0],n[3][1]);j&&this.drawingContext.lineTo(b[k+1][0],b[k+1][1]),this._doFillStrokeClose()}return c=!1,d=!1,e=!1,g=!1,j&&b.pop(),this},d.Renderer2D.prototype.noSmooth=function(){return"imageSmoothingEnabled"in this.drawingContext&&(this.drawingContext.imageSmoothingEnabled=!1),this},d.Renderer2D.prototype.smooth=function(){return"imageSmoothingEnabled"in this.drawingContext&&(this.drawingContext.imageSmoothingEnabled=!0),this},d.Renderer2D.prototype.strokeCap=function(a){return a!==f.ROUND&&a!==f.SQUARE&&a!==f.PROJECT||(this.drawingContext.lineCap=a),this},d.Renderer2D.prototype.strokeJoin=function(a){return a!==f.ROUND&&a!==f.BEVEL&&a!==f.MITER||(this.drawingContext.lineJoin=a),this},d.Renderer2D.prototype.strokeWeight=function(a){return this.drawingContext.lineWidth=void 0===a||0===a?1e-4:a,this},d.Renderer2D.prototype._getFill=function(){return this._cachedFillStyle||(this._cachedFillStyle=this.drawingContext.fillStyle),this._cachedFillStyle},d.Renderer2D.prototype._setFill=function(a){a!==this._cachedFillStyle&&(this.drawingContext.fillStyle=a,this._cachedFillStyle=a)},d.Renderer2D.prototype._getStroke=function(){return this._cachedStrokeStyle||(this._cachedStrokeStyle=this.drawingContext.strokeStyle),this._cachedStrokeStyle},d.Renderer2D.prototype._setStroke=function(a){a!==this._cachedStrokeStyle&&(this.drawingContext.strokeStyle=a,this._cachedStrokeStyle=a)},d.Renderer2D.prototype.bezier=function(a,b,c,d,e,f,g,h){return this._pInst.beginShape(),this._pInst.vertex(a,b),this._pInst.bezierVertex(c,d,e,f,g,h),this._pInst.endShape(),this},d.Renderer2D.prototype.curve=function(a,b,c,d,e,f,g,h){return this._pInst.beginShape(),this._pInst.curveVertex(a,b),this._pInst.curveVertex(c,d),this._pInst.curveVertex(e,f),this._pInst.curveVertex(g,h),this._pInst.endShape(),this},d.Renderer2D.prototype._doFillStrokeClose=function(){this._doFill&&this.drawingContext.fill(),this._doStroke&&this.drawingContext.stroke(),this.drawingContext.closePath()},d.Renderer2D.prototype.applyMatrix=function(a,b,c,d,e,f){this.drawingContext.transform(a,b,c,d,e,f)},d.Renderer2D.prototype.resetMatrix=function(){return this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pInst._pixelDensity,this._pInst._pixelDensity),this},d.Renderer2D.prototype.rotate=function(a){this.drawingContext.rotate(a)},d.Renderer2D.prototype.scale=function(a,b){return this.drawingContext.scale(a,b),this},d.Renderer2D.prototype.shearX=function(a){return this._pInst._angleMode===f.DEGREES&&(a=this._pInst.degrees(a)),this.drawingContext.transform(1,0,this._pInst.tan(a),1,0,0),this},d.Renderer2D.prototype.shearY=function(a){return this._pInst._angleMode===f.DEGREES&&(a=this._pInst.degrees(a)),this.drawingContext.transform(1,this._pInst.tan(a),0,1,0,0),this},d.Renderer2D.prototype.translate=function(a,b){return this.drawingContext.translate(a,b),this},d.Renderer2D.prototype.text=function(a,b,c,d,e){var g,h,i,j,k,l,m,n,o,p,q=this._pInst,r=Number.MAX_VALUE;if(this._doFill||this._doStroke){if("string"!=typeof a&&(a=a.toString()),a=a.replace(/(\t)/g," "),g=a.split("\n"),void 0!==d){for(o=0,i=0;i<g.length;i++)for(k="",n=g[i].split(" "),h=0;h<n.length;h++)l=k+n[h]+" ",m=this.textWidth(l),m>d?(k=n[h]+" ",o+=q.textLeading()):k=l;switch(this._rectMode===f.CENTER&&(b-=d/2,c-=e/2),this.drawingContext.textAlign){case f.CENTER:b+=d/2;break;case f.RIGHT:b+=d}if(void 0!==e){switch(this.drawingContext.textBaseline){case f.BOTTOM:c+=e-o;break;case f._CTX_MIDDLE:c+=(e-o)/2;break;case f.BASELINE:p=!0,this.drawingContext.textBaseline=f.TOP}r=c+e-q.textAscent()}for(i=0;i<g.length;i++){for(k="",n=g[i].split(" "),h=0;h<n.length;h++)l=k+n[h]+" ",m=this.textWidth(l),m>d&&k.length>0?(this._renderText(q,k,b,c,r),k=n[h]+" ",c+=q.textLeading()):k=l;this._renderText(q,k,b,c,r),c+=q.textLeading()}}else{var s=0,t=q.textAlign().vertical;for(t===f.CENTER?s=(g.length-1)*q.textLeading()/2:t===f.BOTTOM&&(s=(g.length-1)*q.textLeading()),j=0;j<g.length;j++)this._renderText(q,g[j],b,c-s,r),c+=q.textLeading()}return p&&(this.drawingContext.textBaseline=f.BASELINE),q}},d.Renderer2D.prototype._renderText=function(a,b,c,d,e){if(!(d>=e))return a.push(),this._isOpenType()?this._textFont._renderPath(b,c,d,{renderer:this}):(this._doStroke&&this._strokeSet&&this.drawingContext.strokeText(b,c,d),this._doFill&&(this._fillSet||this._setFill(f._DEFAULT_TEXT_FILL),this.drawingContext.fillText(b,c,d))),a.pop(),a},d.Renderer2D.prototype.textWidth=function(a){return this._isOpenType()?this._textFont._textWidth(a,this._textSize):this.drawingContext.measureText(a).width},d.Renderer2D.prototype.textAlign=function(a,b){if(arguments.length)return a!==f.LEFT&&a!==f.RIGHT&&a!==f.CENTER||(this.drawingContext.textAlign=a),b!==f.TOP&&b!==f.BOTTOM&&b!==f.CENTER&&b!==f.BASELINE||(b===f.CENTER?this.drawingContext.textBaseline=f._CTX_MIDDLE:this.drawingContext.textBaseline=b),this._pInst;var c=this.drawingContext.textBaseline;return c===f._CTX_MIDDLE&&(c=f.CENTER),{horizontal:this.drawingContext.textAlign,vertical:c}},d.Renderer2D.prototype._applyTextProperties=function(){var a,b=this._pInst;return this._setProperty("_textAscent",null),this._setProperty("_textDescent",null),a=this._textFont,this._isOpenType()&&(a=this._textFont.font.familyName,this._setProperty("_textStyle",this._textFont.font.styleName)),this.drawingContext.font=(this._textStyle||"normal")+" "+(this._textSize||12)+"px "+(a||"sans-serif"),b},d.Renderer2D.prototype.push=function(){this.drawingContext.save()},d.Renderer2D.prototype.pop=function(){this.drawingContext.restore(),this._cachedFillStyle=this.drawingContext.fillStyle,this._cachedStrokeStyle=this.drawingContext.strokeStyle},b.exports=d.Renderer2D},{"../image/filters":74,"./canvas":53,"./constants":54,"./core":55,"./p5.Renderer":62}],64:[function(a,b,c){var d=a("./core"),e=a("./constants");a("./p5.Graphics"),a("./p5.Renderer2D"),a("../webgl/p5.RendererGL");var f="defaultCanvas0";d.prototype.createCanvas=function(a,b,c){var g,h=c||e.P2D;if(h===e.WEBGL)g=document.getElementById(f),g&&(g.parentNode.removeChild(g),this._elements=this._elements.filter(function(a){return a!==this._renderer})),g=document.createElement("canvas"),g.id=f;else if(this._defaultGraphicsCreated)g=this.canvas;else{g=document.createElement("canvas");for(var i=0;document.getElementById("defaultCanvas"+i);)i++;f="defaultCanvas"+i,g.id=f}return this._setupDone||(g.dataset.hidden=!0,g.style.visibility="hidden"),this._userNode?this._userNode.appendChild(g):document.body.appendChild(g),h===e.WEBGL?(this._setProperty("_renderer",new d.RendererGL(g,this,!0)),this._elements.push(this._renderer)):this._defaultGraphicsCreated||(this._setProperty("_renderer",new d.Renderer2D(g,this,!0)),this._defaultGraphicsCreated=!0,this._elements.push(this._renderer)),this._renderer.resize(a,b),this._renderer._applyDefaults(),this._renderer},d.prototype.resizeCanvas=function(a,b,c){if(this._renderer){var d={};for(var e in this.drawingContext){var f=this.drawingContext[e];"object"!=typeof f&&"function"!=typeof f&&(d[e]=f)}this._renderer.resize(a,b);for(var g in d)this.drawingContext[g]=d[g];c||this.redraw()}},d.prototype.noCanvas=function(){this.canvas&&this.canvas.parentNode.removeChild(this.canvas)},d.prototype.createGraphics=function(a,b,c){return new d.Graphics(a,b,c,this)},d.prototype.blendMode=function(a){if(a!==e.BLEND&&a!==e.DARKEST&&a!==e.LIGHTEST&&a!==e.DIFFERENCE&&a!==e.MULTIPLY&&a!==e.EXCLUSION&&a!==e.SCREEN&&a!==e.REPLACE&&a!==e.OVERLAY&&a!==e.HARD_LIGHT&&a!==e.SOFT_LIGHT&&a!==e.DODGE&&a!==e.BURN&&a!==e.ADD&&a!==e.NORMAL)throw new Error("Mode "+a+" not recognized.");this._renderer.blendMode(a)},b.exports=d},{"../webgl/p5.RendererGL":106,"./constants":54,"./core":55,"./p5.Graphics":61,"./p5.Renderer2D":63}],65:[function(a,b,c){window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(a,b){window.setTimeout(a,1e3/60)}}(),window.performance=window.performance||{},window.performance.now=function(){var a=Date.now();return window.performance.now||window.performance.mozNow||window.performance.msNow||window.performance.oNow||window.performance.webkitNow||function(){return Date.now()-a}}(),function(){"use strict";"undefined"==typeof Uint8ClampedArray||Uint8ClampedArray.prototype.slice||Object.defineProperty(Uint8ClampedArray.prototype,"slice",{value:Array.prototype.slice,writable:!0,configurable:!0,enumerable:!1})}()},{}],66:[function(a,b,c){"use strict";var d=a("./core");d.prototype.exit=function(){throw"exit() not implemented, see remove()"},d.prototype.noLoop=function(){this._loop=!1},d.prototype.loop=function(){this._loop=!0,this._draw()},d.prototype.push=function(){this._renderer.push(),this._styles.push({_doStroke:this._renderer._doStroke,_strokeSet:this._renderer._strokeSet,_doFill:this._renderer._doFill,_fillSet:this._renderer._fillSet,_tint:this._renderer._tint,_imageMode:this._renderer._imageMode,_rectMode:this._renderer._rectMode,_ellipseMode:this._renderer._ellipseMode,_colorMode:this._renderer._colorMode,_textFont:this._renderer._textFont,_textLeading:this._renderer._textLeading,_textSize:this._renderer._textSize,_textStyle:this._renderer._textStyle})},d.prototype.pop=function(){this._renderer.pop();var a=this._styles.pop();for(var b in a)this._renderer[b]=a[b]},d.prototype.pushStyle=function(){throw new Error("pushStyle() not used, see push()")},d.prototype.popStyle=function(){throw new Error("popStyle() not used, see pop()")},d.prototype.redraw=function(){this.resetMatrix(),this._renderer.isP3D&&this._renderer._update();var a=1;if(1===arguments.length)try{parseInt(arguments[0])>1&&(a=parseInt(arguments[0]))}catch(a){}var b=this.setup||window.setup,c=this.draw||window.draw;if("function"==typeof c){void 0===b&&this.scale(this._pixelDensity,this._pixelDensity);for(var d=this,e=function(a){a.call(d)},f=0;f<a;f++)this._setProperty("frameCount",this.frameCount+1),this._registeredMethods.pre.forEach(e),c(),this._registeredMethods.post.forEach(e)}},d.prototype.size=function(){var a="size() is not a valid p5 function, to set the size of the ";throw a+="drawing canvas, please use createCanvas() instead"},b.exports=d},{"./core":55}],67:[function(a,b,c){"use strict";var d=a("./core"),e=a("./constants");d.prototype.applyMatrix=function(a,b,c,d,e,f){return this._renderer.applyMatrix(a,b,c,d,e,f),this},d.prototype.popMatrix=function(){throw new Error("popMatrix() not used, see pop()")},d.prototype.printMatrix=function(){throw new Error("printMatrix() not implemented")},d.prototype.pushMatrix=function(){throw new Error("pushMatrix() not used, see push()")},d.prototype.resetMatrix=function(){return this._renderer.resetMatrix(),this},d.prototype.rotate=function(a,b){for(var c,d=new Array(arguments.length),f=0;f<d.length;++f)d[f]=arguments[f];return this._angleMode===e.DEGREES?c=this.radians(d[0]):this._angleMode===e.RADIANS&&(c=d[0]),d.length>1?this._renderer.rotate(c,d[1]):this._renderer.rotate(c),this},d.prototype.rotateX=function(a){if(!this._renderer.isP3D)throw"not supported in p2d. Please use webgl mode";return this._renderer.rotateX(a),this},d.prototype.rotateY=function(a){if(!this._renderer.isP3D)throw"not supported in p2d. Please use webgl mode";return this._renderer.rotateY(a),this},d.prototype.rotateZ=function(a){if(!this._renderer.isP3D)throw"not supported in p2d. Please use webgl mode";return this._renderer.rotateZ(a),this},d.prototype.scale=function(){for(var a,b,c,e=new Array(arguments.length),f=0;f<e.length;f++)e[f]=arguments[f];return void 0!==d.Vector&&e[0]instanceof d.Vector?(a=e[0].x,b=e[0].y,c=e[0].z):e[0]instanceof Array?(a=e[0][0],b=e[0][1],c=e[0][2]||1):1===e.length?a=b=c=e[0]:(a=e[0],b=e[1],c=e[2]||1),this._renderer.isP3D?this._renderer.scale.call(this._renderer,a,b,c):this._renderer.scale.call(this._renderer,a,b),this},d.prototype.shearX=function(a){return this._angleMode===e.DEGREES&&(a=this.radians(a)),this._renderer.shearX(a),this},d.prototype.shearY=function(a){return this._angleMode===e.DEGREES&&(a=this.radians(a)),this._renderer.shearY(a),this},d.prototype.translate=function(a,b,c){return this._renderer.isP3D?this._renderer.translate(a,b,c):this._renderer.translate(a,b),this},b.exports=d},{"./constants":54,"./core":55}],68:[function(a,b,c){"use strict";var d=a("./core"),e=a("./constants"),f=null,g=[],h=[],i=!1,j=!1,k=!1,l=!1,m=!0;d.prototype.beginContour=function(){return h=[],l=!0,this},d.prototype.beginShape=function(a){return f=a===e.POINTS||a===e.LINES||a===e.TRIANGLES||a===e.TRIANGLE_FAN||a===e.TRIANGLE_STRIP||a===e.QUADS||a===e.QUAD_STRIP?a:null,
this._renderer.isP3D?this._renderer.beginShape(a):(g=[],h=[]),this},d.prototype.bezierVertex=function(a,b,c,d,e,f){if(0===g.length)throw"vertex() must be used once before calling bezierVertex()";i=!0;for(var j=[],k=0;k<arguments.length;k++)j[k]=arguments[k];return j.isVert=!1,l?h.push(j):g.push(j),this},d.prototype.curveVertex=function(a,b){return j=!0,this.vertex(a,b),this},d.prototype.endContour=function(){var a=h[0].slice();a.isVert=h[0].isVert,a.moveTo=!1,h.push(a),m&&(g.push(g[0]),m=!1);for(var b=0;b<h.length;b++)g.push(h[b]);return this},d.prototype.endShape=function(a){if(this._renderer.isP3D)this._renderer.endShape(a,j,i,k,l,f);else{if(0===g.length)return this;if(!this._renderer._doStroke&&!this._renderer._doFill)return this;var b=a===e.CLOSE;b&&!l&&g.push(g[0]),this._renderer.endShape(a,g,j,i,k,l,f),j=!1,i=!1,k=!1,l=!1,m=!0,b&&g.pop()}return this},d.prototype.quadraticVertex=function(a,b,c,d){if(this._contourInited){var f={};return f.x=a,f.y=b,f.x3=c,f.y3=d,f.type=e.QUADRATIC,this._contourVertices.push(f),this}if(!(g.length>0))throw"vertex() must be used once before calling quadraticVertex()";k=!0;for(var i=[],j=0;j<arguments.length;j++)i[j]=arguments[j];return i.isVert=!1,l?h.push(i):g.push(i),this},d.prototype.vertex=function(a,b,c,d,e){if(this._renderer.isP3D)this._renderer.vertex.apply(this._renderer,arguments);else{var f=[];f.isVert=!0,f[0]=a,f[1]=b,f[2]=0,f[3]=0,f[4]=0,f[5]=this._renderer._getFill(),f[6]=this._renderer._getStroke(),c&&(f.moveTo=c),l?(0===h.length&&(f.moveTo=!0),h.push(f)):g.push(f)}return this},b.exports=d},{"./constants":54,"./core":55}],69:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.createStringDict=function(){return new d.StringDict(arguments[0],arguments[1])},d.prototype.createNumberDict=function(){return new d.NumberDict(arguments[0],arguments[1])},d.TypedDict=function(){return this.data={},arguments[0][0]instanceof Object?this.data=arguments[0][0]:this.data[arguments[0][0]]=arguments[0][1],this},d.TypedDict.prototype.size=function(){return Object.keys(this.data).length},d.TypedDict.prototype.hasKey=function(a){return this.data.hasOwnProperty(a)},d.TypedDict.prototype.get=function(a){if(this.data.hasOwnProperty(a))return this.data[a];console.log(a+" does not exist in this Dictionary")},d.TypedDict.prototype.set=function(a,b){2===arguments.length&&(this.data.hasOwnProperty(a)?this.data[a]=b:this.create(a,b))},d.TypedDict.prototype._addObj=function(a){for(var b in a)this._validate(a[b])?this.data[b]=a[b]:console.log("Those values dont work for this dictionary type.")},d.TypedDict.prototype.create=function(){if(1===arguments.length&&arguments[0]instanceof Object)this._addObj(arguments[0]);else if(2===arguments.length){var a={};a[arguments[0]]=arguments[1],this._addObj(a)}else console.log("In order to create a new Dictionary entry you must pass an object or a key, value pair")},d.TypedDict.prototype.clear=function(){this.data={}},d.TypedDict.prototype.remove=function(a){if(!this.data.hasOwnProperty(a))throw a+" does not exist in this Dictionary";delete this.data[a]},d.TypedDict.prototype.print=function(){for(var a in this.data)console.log("key:"+a+" value:"+this.data[a])},d.TypedDict.prototype.saveTable=function(){var a="";for(var b in this.data)a+=b+","+this.data[b]+"\n";var c=arguments[0]||"mycsv",e=new Blob([a],{type:"text/csv"}),f=window.URL.createObjectURL(e);d.prototype.downloadFile(f,c,"csv")},d.TypedDict.prototype.saveJSON=function(a,b){d.prototype.saveJSON(this.data,a,b)},d.TypedDict.prototype._validate=function(a,b){return!0},d.StringDict=function(){d.TypedDict.call(this,arguments)},d.StringDict.prototype=Object.create(d.TypedDict.prototype),d.StringDict.prototype._validate=function(a){return"string"==typeof a},d.NumberDict=function(){d.TypedDict.call(this,arguments)},d.NumberDict.prototype=Object.create(d.TypedDict.prototype),d.NumberDict.prototype._validate=function(a){return"number"==typeof a},d.NumberDict.prototype.add=function(a,b){this.data.hasOwnProperty(a)?this.data[a]+=b:console.log("The key - "+a+" does not exist in this dictionary.")},d.NumberDict.prototype.sub=function(a,b){this.add(a,-b)},d.NumberDict.prototype.mult=function(a,b){this.data.hasOwnProperty(a)?this.data[a]*=b:console.log("The key - "+a+" does not exist in this dictionary.")},d.NumberDict.prototype.div=function(a,b){this.data.hasOwnProperty(a)?this.data[a]/=b:console.log("The key - "+a+" does not exist in this dictionary.")},d.NumberDict.prototype._valueTest=function(a){if(0===Object.keys(this.data).length)throw"Unable to search for a minimum or maximum value on an empty NumberDict";if(1===Object.keys(this.data).length)return this.data[Object.keys(this.data)[0]];var b=this.data[Object.keys(this.data)[0]];for(var c in this.data)this.data[c]*a<b*a&&(b=this.data[c]);return b},d.NumberDict.prototype.minValue=function(){return this._valueTest(1)},d.NumberDict.prototype.maxValue=function(){return this._valueTest(-1)},d.NumberDict.prototype._keyTest=function(a){if(0===Object.keys(this.data).length)throw"Unable to use minValue on an empty NumberDict";if(1===Object.keys(this.data).length)return Object.keys(this.data)[0];for(var b=Object.keys(this.data)[0],c=1;c<Object.keys(this.data).length;c++)Object.keys(this.data)[c]*a<b*a&&(b=Object.keys(this.data)[c]);return b},d.NumberDict.prototype.minKey=function(){return this._keyTest(1)},d.NumberDict.prototype.maxKey=function(){return this._keyTest(-1)},b.exports=d.TypedDict},{"../core/core":55}],70:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.deviceOrientation=void 0,d.prototype.accelerationX=0,d.prototype.accelerationY=0,d.prototype.accelerationZ=0,d.prototype.pAccelerationX=0,d.prototype.pAccelerationY=0,d.prototype.pAccelerationZ=0,d.prototype._updatePAccelerations=function(){this._setProperty("pAccelerationX",this.accelerationX),this._setProperty("pAccelerationY",this.accelerationY),this._setProperty("pAccelerationZ",this.accelerationZ)},d.prototype.rotationX=0,d.prototype.rotationY=0,d.prototype.rotationZ=0,d.prototype.pRotationX=0,d.prototype.pRotationY=0,d.prototype.pRotationZ=0;var e,f,g,h=0,i=0,j=0,k="clockwise",l="clockwise",m="clockwise";d.prototype._updatePRotations=function(){this._setProperty("pRotationX",this.rotationX),this._setProperty("pRotationY",this.rotationY),this._setProperty("pRotationZ",this.rotationZ)},d.prototype.turnAxis=void 0;var n=.5,o=30;d.prototype.setMoveThreshold=function(a){"number"==typeof a&&(n=a)},d.prototype.setShakeThreshold=function(a){"number"==typeof a&&(o=a)},d.prototype._ondeviceorientation=function(a){this._updatePRotations(),this._setProperty("rotationX",a.beta),this._setProperty("rotationY",a.gamma),this._setProperty("rotationZ",a.alpha),this._handleMotion()},d.prototype._ondevicemotion=function(a){this._updatePAccelerations(),this._setProperty("accelerationX",2*a.acceleration.x),this._setProperty("accelerationY",2*a.acceleration.y),this._setProperty("accelerationZ",2*a.acceleration.z),this._handleMotion()},d.prototype._handleMotion=function(){90===window.orientation||window.orientation===-90?this._setProperty("deviceOrientation","landscape"):0===window.orientation?this._setProperty("deviceOrientation","portrait"):void 0===window.orientation&&this._setProperty("deviceOrientation","undefined");var a=this.deviceMoved||window.deviceMoved;"function"==typeof a&&(Math.abs(this.accelerationX-this.pAccelerationX)>n||Math.abs(this.accelerationY-this.pAccelerationY)>n||Math.abs(this.accelerationZ-this.pAccelerationZ)>n)&&a();var b=this.deviceTurned||window.deviceTurned;if("function"==typeof b){var c=this.rotationX+180,d=this.pRotationX+180,p=h+180;c-d>0&&c-d<270||c-d<-270?k="clockwise":(c-d<0||c-d>270)&&(k="counter-clockwise"),k!==e&&(p=c),Math.abs(c-p)>90&&Math.abs(c-p)<270&&(p=c,this._setProperty("turnAxis","X"),b()),e=k,h=p-180;var q=this.rotationY+180,r=this.pRotationY+180,s=i+180;q-r>0&&q-r<270||q-r<-270?l="clockwise":(q-r<0||q-this.pRotationY>270)&&(l="counter-clockwise"),l!==f&&(s=q),Math.abs(q-s)>90&&Math.abs(q-s)<270&&(s=q,this._setProperty("turnAxis","Y"),b()),f=l,i=s-180,this.rotationZ-this.pRotationZ>0&&this.rotationZ-this.pRotationZ<270||this.rotationZ-this.pRotationZ<-270?m="clockwise":(this.rotationZ-this.pRotationZ<0||this.rotationZ-this.pRotationZ>270)&&(m="counter-clockwise"),m!==g&&(j=this.rotationZ),Math.abs(this.rotationZ-j)>90&&Math.abs(this.rotationZ-j)<270&&(j=this.rotationZ,this._setProperty("turnAxis","Z"),b()),g=m,this._setProperty("turnAxis",void 0)}var t=this.deviceShaken||window.deviceShaken;if("function"==typeof t){var u,v;null!==this.pAccelerationX&&(u=Math.abs(this.accelerationX-this.pAccelerationX),v=Math.abs(this.accelerationY-this.pAccelerationY)),u+v>o&&t()}},b.exports=d},{"../core/core":55}],71:[function(a,b,c){"use strict";function d(){for(var a in f)if(f.hasOwnProperty(a)&&f[a]===!0)return!0;return!1}var e=a("../core/core"),f={};e.prototype.isKeyPressed=!1,e.prototype.keyIsPressed=!1,e.prototype.key="",e.prototype.keyCode=0,e.prototype._onkeydown=function(a){if(!f[a.which]){this._setProperty("isKeyPressed",!0),this._setProperty("keyIsPressed",!0),this._setProperty("keyCode",a.which),f[a.which]=!0;var b=String.fromCharCode(a.which);b||(b=a.which),this._setProperty("key",b);var c=this.keyPressed||window.keyPressed;if("function"==typeof c&&!a.charCode){c(a)===!1&&a.preventDefault()}}},e.prototype._onkeyup=function(a){var b=this.keyReleased||window.keyReleased;f[a.which]=!1,d()||(this._setProperty("isKeyPressed",!1),this._setProperty("keyIsPressed",!1)),this._setProperty("_lastKeyCodeTyped",null);var c=String.fromCharCode(a.which);if(c||(c=a.which),this._setProperty("key",c),this._setProperty("keyCode",a.which),"function"==typeof b){b(a)===!1&&a.preventDefault()}},e.prototype._onkeypress=function(a){if(a.which!==this._lastKeyCodeTyped){this._setProperty("keyCode",a.which),this._setProperty("_lastKeyCodeTyped",a.which),this._setProperty("key",String.fromCharCode(a.which));var b=this.keyTyped||window.keyTyped;if("function"==typeof b){b(a)===!1&&a.preventDefault()}}},e.prototype._onblur=function(a){f={}},e.prototype.keyIsDown=function(a){return f[a]},b.exports=e},{"../core/core":55}],72:[function(a,b,c){"use strict";function d(a,b,c,d){d&&!d.clientX&&(d.touches?d=d.touches[0]:d.changedTouches&&(d=d.changedTouches[0]));var e=a.getBoundingClientRect(),f=a.scrollWidth/b,g=a.scrollHeight/c;return{x:(d.clientX-e.left)/f,y:(d.clientY-e.top)/g,winX:d.clientX,winY:d.clientY,id:d.identifier}}var e=a("../core/core"),f=a("../core/constants");e.prototype._hasMouseInteracted=!1,e.prototype.mouseX=0,e.prototype.mouseY=0,e.prototype.pmouseX=0,e.prototype.pmouseY=0,e.prototype.winMouseX=0,e.prototype.winMouseY=0,e.prototype.pwinMouseX=0,e.prototype.pwinMouseY=0,e.prototype.mouseButton=0,e.prototype.mouseIsPressed=!1,e.prototype._updateNextMouseCoords=function(a){if(null!==this._curElement&&(!a.touches||a.touches.length>0)){var b=d(this._curElement.elt,this.width,this.height,a);this._setProperty("mouseX",b.x),this._setProperty("mouseY",b.y),this._setProperty("winMouseX",b.winX),this._setProperty("winMouseY",b.winY)}this._hasMouseInteracted||(this._updateMouseCoords(),this._setProperty("_hasMouseInteracted",!0))},e.prototype._updateMouseCoords=function(){this._setProperty("pmouseX",this.mouseX),this._setProperty("pmouseY",this.mouseY),this._setProperty("pwinMouseX",this.winMouseX),this._setProperty("pwinMouseY",this.winMouseY)},e.prototype._setMouseButton=function(a){1===a.button?this._setProperty("mouseButton",f.CENTER):2===a.button?this._setProperty("mouseButton",f.RIGHT):this._setProperty("mouseButton",f.LEFT)},e.prototype._onmousemove=function(a){var b=this._isGlobal?window:this;this._updateNextMouseCoords(a),this.mouseIsPressed?"function"==typeof b.mouseDragged?b.mouseDragged(a)===!1&&a.preventDefault():"function"==typeof b.touchMoved&&b.touchMoved(a)===!1&&a.preventDefault():"function"==typeof b.mouseMoved&&b.mouseMoved(a)===!1&&a.preventDefault()},e.prototype._onmousedown=function(a){var b=this._isGlobal?window:this;this._setProperty("mouseIsPressed",!0),this._setMouseButton(a),this._updateNextMouseCoords(a),"function"==typeof b.mousePressed?b.mousePressed(a)===!1&&a.preventDefault():"function"==typeof b.touchStarted&&b.touchStarted(a)===!1&&a.preventDefault()},e.prototype._onmouseup=function(a){var b=this._isGlobal?window:this;this._setProperty("mouseIsPressed",!1),"function"==typeof b.mouseReleased?b.mouseReleased(a)===!1&&a.preventDefault():"function"==typeof b.touchEnded&&b.touchEnded(a)===!1&&a.preventDefault()},e.prototype._ondragend=e.prototype._onmouseup,e.prototype._ondragover=e.prototype._onmousemove,e.prototype._onclick=function(a){var b=this._isGlobal?window:this;if("function"==typeof b.mouseClicked){b.mouseClicked(a)===!1&&a.preventDefault()}},e.prototype._doubleClicked=function(a){var b=this._isGlobal?window:this;if("function"==typeof b.doubleClicked){b.ondblclick(a)===!1&&a.preventDefault()}},e.prototype._onwheel=function(a){var b=this._isGlobal?window:this;if("function"==typeof b.mouseWheel){a.delta=a.deltaY;b.mouseWheel(a)===!1&&a.preventDefault()}},b.exports=e},{"../core/constants":54,"../core/core":55}],73:[function(a,b,c){"use strict";function d(a,b,c,d,e){e=e||0;var f=a.getBoundingClientRect(),g=a.scrollWidth/b,h=a.scrollHeight/c,i=d.touches[e]||d.changedTouches[e];return{x:(i.clientX-f.left)/g,y:(i.clientY-f.top)/h,winX:i.clientX,winY:i.clientY,id:i.identifier}}var e=a("../core/core");e.prototype.touches=[],e.prototype._updateTouchCoords=function(a){if(null!==this._curElement){for(var b=[],c=0;c<a.touches.length;c++)b[c]=d(this._curElement.elt,this.width,this.height,a,c);this._setProperty("touches",b)}},e.prototype._ontouchstart=function(a){var b=this._isGlobal?window:this;this._setProperty("mouseIsPressed",!0),this._updateTouchCoords(a),this._updateNextMouseCoords(a),"function"==typeof b.touchStarted?b.touchStarted(a)===!1&&a.preventDefault():"function"==typeof b.mousePressed&&b.mousePressed(a)===!1&&a.preventDefault()},e.prototype._ontouchmove=function(a){var b=this._isGlobal?window:this;this._updateTouchCoords(a),this._updateNextMouseCoords(a),"function"==typeof b.touchMoved?b.touchMoved(a)===!1&&a.preventDefault():"function"==typeof b.mouseDragged&&b.mouseDragged(a)===!1&&a.preventDefault()},e.prototype._ontouchend=function(a){this._setProperty("mouseIsPressed",!1),this._updateTouchCoords(a),this._updateNextMouseCoords(a);var b=this._isGlobal?window:this;"function"==typeof b.touchEnded?b.touchEnded(a)===!1&&a.preventDefault():"function"==typeof b.mouseReleased&&b.mouseReleased(a)===!1&&a.preventDefault()},b.exports=e},{"../core/core":55}],74:[function(a,b,c){"use strict";function d(a){var b=3.5*a|0;if(b=b<1?1:b<248?b:248,g!==b){g=b,h=1+g<<1,i=new Int32Array(h),j=new Array(h);for(var c=0;c<h;c++)j[c]=new Int32Array(256);for(var d,e,f,k,l=1,m=b-1;l<b;l++){i[b+l]=i[m]=e=m*m,f=j[b+l],k=j[m--];for(var n=0;n<256;n++)f[n]=k[n]=e*n}d=i[b]=b*b,f=j[b];for(var o=0;o<256;o++)f[o]=d*o}}function e(a,b){for(var c=f._toPixels(a),e=a.width,k=a.height,l=e*k,m=new Int32Array(l),n=0;n<l;n++)m[n]=f._getARGB(c,n);var o,p,q,r,s,t,u,v,w,x,y=new Int32Array(l),z=new Int32Array(l),A=new Int32Array(l),B=new Int32Array(l),C=0;d(b);var D,E,F,G;for(E=0;E<k;E++){for(D=0;D<e;D++){if(r=q=p=s=o=0,(t=D-g)<0)x=-t,t=0;else{if(t>=e)break;x=0}for(F=x;F<h&&!(t>=e);F++){var H=m[t+C];G=j[F],s+=G[(H&-16777216)>>>24],p+=G[(16711680&H)>>16],q+=G[(65280&H)>>8],r+=G[255&H],o+=i[F],t++}u=C+D,y[u]=s/o,z[u]=p/o,A[u]=q/o,B[u]=r/o}C+=e}for(C=0,v=-g,w=v*e,E=0;E<k;E++){for(D=0;D<e;D++){if(r=q=p=s=o=0,v<0)x=u=-v,t=D;else{if(v>=k)break;x=0,u=v,t=D+w}for(F=x;F<h&&!(u>=k);F++)G=j[F],s+=G[y[t]],p+=G[z[t]],q+=G[A[t]],r+=G[B[t]],o+=i[F],u++,t+=e;m[D+C]=s/o<<24|p/o<<16|q/o<<8|r/o}C+=e,w+=e,v++}f._setPixels(c,m)}var f={};f._toPixels=function(a){return a instanceof ImageData?a.data:a.getContext("2d").getImageData(0,0,a.width,a.height).data},f._getARGB=function(a,b){var c=4*b;return a[c+3]<<24&4278190080|a[c]<<16&16711680|a[c+1]<<8&65280|255&a[c+2]},f._setPixels=function(a,b){for(var c=0,d=0,e=a.length;d<e;d++)c=4*d,a[c+0]=(16711680&b[d])>>>16,a[c+1]=(65280&b[d])>>>8,a[c+2]=255&b[d],a[c+3]=(4278190080&b[d])>>>24},f._toImageData=function(a){return a instanceof ImageData?a:a.getContext("2d").getImageData(0,0,a.width,a.height)},f._createImageData=function(a,b){return f._tmpCanvas=document.createElement("canvas"),f._tmpCtx=f._tmpCanvas.getContext("2d"),this._tmpCtx.createImageData(a,b)},f.apply=function(a,b,c){var d=a.getContext("2d"),e=d.getImageData(0,0,a.width,a.height),f=b(e,c);f instanceof ImageData?d.putImageData(f,0,0,0,0,a.width,a.height):d.putImageData(e,0,0,0,0,a.width,a.height)},f.threshold=function(a,b){var c=f._toPixels(a);void 0===b&&(b=.5);for(var d=Math.floor(255*b),e=0;e<c.length;e+=4){var g,h=c[e],i=c[e+1],j=c[e+2],k=.2126*h+.7152*i+.0722*j;g=k>=d?255:0,c[e]=c[e+1]=c[e+2]=g}},f.gray=function(a){for(var b=f._toPixels(a),c=0;c<b.length;c+=4){var d=b[c],e=b[c+1],g=b[c+2],h=.2126*d+.7152*e+.0722*g;b[c]=b[c+1]=b[c+2]=h}},f.opaque=function(a){for(var b=f._toPixels(a),c=0;c<b.length;c+=4)b[c+3]=255;return b},f.invert=function(a){for(var b=f._toPixels(a),c=0;c<b.length;c+=4)b[c]=255-b[c],b[c+1]=255-b[c+1],b[c+2]=255-b[c+2]},f.posterize=function(a,b){var c=f._toPixels(a);if(b<2||b>255)throw new Error("Level must be greater than 2 and less than 255 for posterize");for(var d=b-1,e=0;e<c.length;e+=4){var g=c[e],h=c[e+1],i=c[e+2];c[e]=255*(g*b>>8)/d,c[e+1]=255*(h*b>>8)/d,c[e+2]=255*(i*b>>8)/d}},f.dilate=function(a){for(var b,c,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t=f._toPixels(a),u=0,v=t.length?t.length/4:0,w=new Int32Array(v);u<v;)for(b=u,c=u+a.width;u<c;)d=e=f._getARGB(t,u),i=u-1,h=u+1,j=u-a.width,k=u+a.width,i<b&&(i=u),h>=c&&(h=u),j<0&&(j=0),k>=v&&(k=u),n=f._getARGB(t,j),m=f._getARGB(t,i),o=f._getARGB(t,k),l=f._getARGB(t,h),g=77*(d>>16&255)+151*(d>>8&255)+28*(255&d),q=77*(m>>16&255)+151*(m>>8&255)+28*(255&m),p=77*(l>>16&255)+151*(l>>8&255)+28*(255&l),r=77*(n>>16&255)+151*(n>>8&255)+28*(255&n),s=77*(o>>16&255)+151*(o>>8&255)+28*(255&o),q>g&&(e=m,g=q),p>g&&(e=l,g=p),r>g&&(e=n,g=r),s>g&&(e=o,g=s),w[u++]=e;f._setPixels(t,w)},f.erode=function(a){for(var b,c,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t=f._toPixels(a),u=0,v=t.length?t.length/4:0,w=new Int32Array(v);u<v;)for(b=u,c=u+a.width;u<c;)d=e=f._getARGB(t,u),i=u-1,h=u+1,j=u-a.width,k=u+a.width,i<b&&(i=u),h>=c&&(h=u),j<0&&(j=0),k>=v&&(k=u),n=f._getARGB(t,j),m=f._getARGB(t,i),o=f._getARGB(t,k),l=f._getARGB(t,h),g=77*(d>>16&255)+151*(d>>8&255)+28*(255&d),q=77*(m>>16&255)+151*(m>>8&255)+28*(255&m),p=77*(l>>16&255)+151*(l>>8&255)+28*(255&l),r=77*(n>>16&255)+151*(n>>8&255)+28*(255&n),s=77*(o>>16&255)+151*(o>>8&255)+28*(255&o),q<g&&(e=m,g=q),p<g&&(e=l,g=p),r<g&&(e=n,g=r),s<g&&(e=o,g=s),w[u++]=e;f._setPixels(t,w)};var g,h,i,j;f.blur=function(a,b){e(a,b)},b.exports=f},{}],75:[function(a,b,c){"use strict";var d=a("../core/core"),e=[];d.prototype.createImage=function(a,b){return new d.Image(a,b)},d.prototype.saveCanvas=function(){var a,b,c;if(3===arguments.length?(a=arguments[0],b=arguments[1],c=arguments[2]):2===arguments.length?"object"==typeof arguments[0]?(a=arguments[0],b=arguments[1]):(b=arguments[0],c=arguments[1]):1===arguments.length&&("object"==typeof arguments[0]?a=arguments[0]:b=arguments[0]),a instanceof d.Element&&(a=a.elt),a instanceof HTMLCanvasElement||(a=null),c||""===(c=d.prototype._checkFileExtension(b,c)[1])&&(c="png"),a||this._curElement&&this._curElement.elt&&(a=this._curElement.elt),d.prototype._isSafari()){var e="Hello, Safari user!\n";e+="Now capturing a screenshot...\n",e+="To save this image,\n",e+="go to File --> Save As.\n",alert(e),window.location.href=a.toDataURL()}else{var f;if(void 0===c)c="png",f="image/png";else switch(c){case"png":f="image/png";break;case"jpeg":f="image/jpeg";break;case"jpg":f="image/jpeg";break;default:f="image/png"}var g=a.toDataURL(f);g=g.replace(f,"image/octet-stream"),d.prototype.downloadFile(g,b,c)}},d.prototype.saveFrames=function(a,b,c,f,g){var h=c||3;h=d.prototype.constrain(h,0,15),h*=1e3;var i=f||15;i=d.prototype.constrain(i,0,22);var j=0,k=d.prototype._makeFrame,l=this._curElement.elt,m=setInterval(function(){k(a+j,b,l),j++},1e3/i);setTimeout(function(){if(clearInterval(m),g)g(e);else for(var a=0;a<e.length;a++){var b=e[a];d.prototype.downloadFile(b.imageData,b.filename,b.ext)}e=[]},h+.01)},d.prototype._makeFrame=function(a,b,c){var d;d=this?this._curElement.elt:c;var f;if(b)switch(b.toLowerCase()){case"png":f="image/png";break;case"jpeg":f="image/jpeg";break;case"jpg":f="image/jpeg";break;default:f="image/png"}else b="png",f="image/png";var g=d.toDataURL(f);g=g.replace(f,"image/octet-stream");var h={};h.imageData=g,h.filename=a,h.ext=b,e.push(h)},b.exports=d},{"../core/core":55}],76:[function(a,b,c){"use strict";function d(a,b){return a>0&&a<b?a:b}var e=a("../core/core"),f=a("./filters"),g=a("../core/canvas"),h=a("../core/constants");a("../core/error_helpers"),e.prototype.loadImage=function(a,b,c){var d=new Image,f=new e.Image(1,1,this),g=this;return d.onload=function(){f.width=f.canvas.width=d.width,f.height=f.canvas.height=d.height,f.drawingContext.drawImage(d,0,0),f.modified=!0,"function"==typeof b&&b(f),g._decrementPreload()},d.onerror=function(a){e._friendlyFileLoadError(0,d.src),"function"==typeof c&&c(a)},0!==a.indexOf("data:image/")&&(d.crossOrigin="Anonymous"),d.src=a,f},e.prototype.image=function(a,b,c,e,f,h,i,j,k){var l=a.width,m=a.height;a.elt&&a.elt.videoWidth&&!a.canvas&&(l=a.elt.videoWidth,m=a.elt.videoHeight);var n=b,o=c,p=e||l,q=f||m,r=h||0,s=i||0,t=j||l,u=k||m;t=d(t,l),u=d(u,m);var v=1;a.elt&&!a.canvas&&a.elt.style.width&&(v=a.elt.videoWidth&&!e?a.elt.videoWidth:a.elt.width,v/=parseInt(a.elt.style.width,10)),r*=v,s*=v,u*=v,t*=v;var w=g.modeAdjust(n,o,p,q,this._renderer._imageMode);this._renderer.image(a,r,s,t,u,w.x,w.y,w.w,w.h)},e.prototype.tint=function(){var a=this.color.apply(this,arguments);this._renderer._tint=a.levels},e.prototype.noTint=function(){this._renderer._tint=null},e.prototype._getTintedImageCanvas=function(a){if(!a.canvas)return a;var b=f._toPixels(a.canvas),c=document.createElement("canvas");c.width=a.canvas.width,c.height=a.canvas.height;for(var d=c.getContext("2d"),e=d.createImageData(a.canvas.width,a.canvas.height),g=e.data,h=0;h<b.length;h+=4){var i=b[h],j=b[h+1],k=b[h+2],l=b[h+3];g[h]=i*this._renderer._tint[0]/255,g[h+1]=j*this._renderer._tint[1]/255,g[h+2]=k*this._renderer._tint[2]/255,g[h+3]=l*this._renderer._tint[3]/255}return d.putImageData(e,0,0),c},e.prototype.imageMode=function(a){a!==h.CORNER&&a!==h.CORNERS&&a!==h.CENTER||(this._renderer._imageMode=a)},b.exports=e},{"../core/canvas":53,"../core/constants":54,"../core/core":55,"../core/error_helpers":58,"./filters":74}],77:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("./filters");d.Image=function(a,b){this.width=a,this.height=b,this.canvas=document.createElement("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,this.drawingContext=this.canvas.getContext("2d"),this._pixelDensity=1,this._modified=!1,this.pixels=[],this.name="p5.Image"},d.Image.prototype._setProperty=function(a,b){this[a]=b,this.setModified(!0)},d.Image.prototype.loadPixels=function(){d.Renderer2D.prototype.loadPixels.call(this),this.setModified(!0)},d.Image.prototype.updatePixels=function(a,b,c,e){d.Renderer2D.prototype.updatePixels.call(this,a,b,c,e),this.setModified(!0)},d.Image.prototype.get=function(a,b,c,e){return d.Renderer2D.prototype.get.call(this,a,b,c,e)},d.Image.prototype.set=function(a,b,c){d.Renderer2D.prototype.set.call(this,a,b,c),this.setModified(!0)},d.Image.prototype.resize=function(a,b){0===a&&0===b?(a=this.canvas.width,b=this.canvas.height):0===a?a=this.canvas.width*b/this.canvas.height:0===b&&(b=this.canvas.height*a/this.canvas.width),a=Math.floor(a),b=Math.floor(b);var c=document.createElement("canvas");c.width=a,c.height=b,c.getContext("2d").drawImage(this.canvas,0,0,this.canvas.width,this.canvas.height,0,0,c.width,c.height),this.canvas.width=this.width=a,this.canvas.height=this.height=b,this.drawingContext.drawImage(c,0,0,a,b,0,0,a,b),this.pixels.length>0&&this.loadPixels(),this.setModified(!0)},d.Image.prototype.copy=function(){d.prototype.copy.apply(this,arguments)},d.Image.prototype.mask=function(a){void 0===a&&(a=this);var b=this.drawingContext.globalCompositeOperation,c=1;a instanceof d.Renderer&&(c=a._pInst._pixelDensity);var e=[a,0,0,c*a.width,c*a.height,0,0,this.width,this.height];this.drawingContext.globalCompositeOperation="destination-in",d.Image.prototype.copy.apply(this,e),this.drawingContext.globalCompositeOperation=b,this.setModified(!0)},d.Image.prototype.filter=function(a,b){e.apply(this.canvas,e[a.toLowerCase()],b),this.setModified(!0)},d.Image.prototype.blend=function(){d.prototype.blend.apply(this,arguments),this.setModified(!0)},d.Image.prototype.setModified=function(a){this._modified=a},d.Image.prototype.isModified=function(){return this._modified},d.Image.prototype.save=function(a,b){var c;if(b)switch(b.toLowerCase()){case"png":c="image/png";break;case"jpeg":c="image/jpeg";break;case"jpg":c="image/jpeg";break;default:c="image/png"}else b="png",c="image/png";var e=this.canvas.toDataURL(c);e=e.replace(c,"image/octet-stream"),d.prototype.downloadFile(e,a,b)},b.exports=d.Image},{"../core/core":55,"./filters":74}],78:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("./filters");a("../color/p5.Color"),d.prototype.pixels=[],d.prototype.blend=function(){this._renderer?this._renderer.blend.apply(this._renderer,arguments):d.Renderer2D.prototype.blend.apply(this,arguments)},d.prototype.copy=function(){d.Renderer2D._copyHelper.apply(this,arguments)},d.prototype.filter=function(a,b){void 0!==this.canvas?e.apply(this.canvas,e[a.toLowerCase()],b):e.apply(this.elt,e[a.toLowerCase()],b)},d.prototype.get=function(a,b,c,d){return this._renderer.get(a,b,c,d)},d.prototype.loadPixels=function(){this._renderer.loadPixels()},d.prototype.set=function(a,b,c){this._renderer.set(a,b,c)},d.prototype.updatePixels=function(a,b,c,d){0!==this.pixels.length&&this._renderer.updatePixels(a,b,c,d)},b.exports=d},{"../color/p5.Color":49,"../core/core":55,"./filters":74}],79:[function(a,b,c){"use strict";function d(a,b){var c={};if(void 0===(b=b||[]))for(var d=0;d<a.length;d++)b[d.toString()]=d;for(var e=0;e<b.length;e++){var f=b[e],g=a[e];c[f]=g}return c}function e(a){return a.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function f(a,b){b&&b!==!0&&"true"!==b||(b=""),a||(a="untitled");var c="";return a&&a.indexOf(".")>-1&&(c=a.split(".").pop()),b&&c!==b&&(c=b,a=a+"."+c),[a,c]}function g(a){document.body.removeChild(a.target)}var h=a("../core/core");a("whatwg-fetch"),a("es6-promise").polyfill();var i=a("fetch-jsonp");a("../core/error_helpers"),h.prototype.loadJSON=function(){for(var a,b,c,d=arguments[0],e={},f="json",g=1;g<arguments.length;g++){var h=arguments[g];"string"==typeof h?"jsonp"!==h&&"json"!==h||(f=h):"function"==typeof h?a?b=h:a=h:"object"==typeof h&&h.hasOwnProperty("jsonpCallback")&&(f="jsonp",c=h)}var i=this;return this.httpDo(d,"GET",c,f,function(b){for(var c in b)e[c]=b[c];void 0!==a&&a(b),i._decrementPreload()},b),e},h.prototype.loadStrings=function(){for(var a,b,c=[],d=1;d<arguments.length;d++){var e=arguments[d];"function"==typeof e&&(void 0===a?a=e:void 0===b&&(b=e))}var f=this;return h.prototype.httpDo.call(this,arguments[0],"GET","text",function(b){var d=b.match(/[^\r\n]+/g);for(var e in d)c[e]=d[e];void 0!==a&&a(c),f._decrementPreload()},b),c},h.prototype.loadTable=function(a){var b,c,e=[],f=!1,g=a.substring(a.lastIndexOf(".")+1,a.length),i=",",j=!1;"tsv"===g&&(i="\t");for(var k=1;k<arguments.length;k++)if("function"==typeof arguments[k])void 0===b?b=arguments[k]:void 0===c&&(c=arguments[k]);else if("string"==typeof arguments[k])if(e.push(arguments[k]),"header"===arguments[k]&&(f=!0),"csv"===arguments[k]){if(j)throw new Error("Cannot set multiple separator types.");i=",",j=!0}else if("tsv"===arguments[k]){if(j)throw new Error("Cannot set multiple separator types.");i="\t",j=!0}var l=new h.Table,m=this;return this.httpDo(a,"GET","text",function(a){for(var c,e={},g=0,j=1,n=2,o=4,p='"',q="\r",r="\n",s=[],t=0,u=null,v=function(){e.currentState=g,e.token=""},w=function(){u.push(e.token),v()},x=function(){e.escaped=!1,u=[],v()},y=function(){e.currentState=o,s.push(u),u=null};;){if(null==(c=a[t++])){if(e.escaped)throw new Error("Unclosed quote in file.");if(u){w(),y();break}}if(null===u&&x(),e.currentState===g){if(c===p){e.escaped=!0,e.currentState=j;continue}e.currentState=j}if(e.currentState===j&&e.escaped)if(c===p)a[t]===p?(e.token+=p,t++):(e.escaped=!1,e.currentState=n);else{if(c===q)continue;e.token+=c}else c===q?(a[t]===r&&t++,w(),y()):c===r?(w(),y()):c===i?w():e.currentState===j&&(e.token+=c)}if(f)l.columns=s.shift();else for(k=0;k<s[0].length;k++)l.columns[k]="null";var z;for(k=0;k<s.length;k++)(1!==s[k].length||"undefined"!==s[k][0]&&""!==s[k][0])&&(z=new h.TableRow,z.arr=s[k],z.obj=d(s[k],l.columns),l.addRow(z));"function"==typeof b&&b(l),m._decrementPreload()},function(b){if(h._friendlyFileLoadError(2,a),!c)throw b;c(b)}),l},h.prototype.parseXML=function(a){var b,c=new h.XML;if(a.children.length){for(b=0;b<a.children.length;b++){var d=parseXML(a.children[b]);c.addChild(d)}c.setName(a.nodeName),c._setCont(a.textContent),c._setAttributes(a);for(var e=0;e<c.children.length;e++)c.children[e].parent=c;return c}return c.setName(a.nodeName),c._setCont(a.textContent),c._setAttributes(a),c},h.prototype.loadXML=function(){for(var a,b,c={},d=1;d<arguments.length;d++){var e=arguments[d];"function"==typeof e&&(void 0===a?a=e:void 0===b&&(b=e))}var f=this;return this.httpDo(arguments[0],"GET","xml",function(b){for(var d in b)c[d]=b[d];void 0!==a&&a(c),f._decrementPreload()},b),c},h.prototype.httpGet=function(){var a=Array.prototype.slice.call(arguments);a.splice(1,0,"GET"),h.prototype.httpDo.apply(this,a)},h.prototype.httpPost=function(){var a=Array.prototype.slice.call(arguments);a.splice(1,0,"POST"),h.prototype.httpDo.apply(this,a)},h.prototype.httpDo=function(){for(var a,b,c,d="",e={},f=0,g="text/plain",h=arguments.length-1;h>0&&"function"==typeof arguments[h];h--)f++;if(2==arguments.length-f&&"string"==typeof arguments[0]&&"object"==typeof arguments[1])c=new Request(arguments[0],arguments[1]),a=arguments[2],b=arguments[3],""===d&&(d=c.url.indexOf("json")!==-1?"json":c.url.indexOf("xml")!==-1?"xml":"text");else{for(var j,k=arguments[0],l="GET",m=1;m<arguments.length;m++){var n=arguments[m];if("string"==typeof n)"GET"===n||"POST"===n||"PUT"===n||"DELETE"===n?l=n:"json"===n||"jsonp"===n||"xml"===n||"text"===n?d=n:j=n;else if("number"==typeof n)j=n.toString();else if("object"==typeof n)if(n.hasOwnProperty("jsonpCallback"))for(var o in n)e[o]=n[o];else j=JSON.stringify(n),g="application/json";else"function"==typeof n&&(a?b=n:a=n)}""===d&&(d=k.indexOf("json")!==-1?"json":k.indexOf("xml")!==-1?"xml":"text"),c=new Request(k,{method:l,mode:"cors",body:j,headers:new Headers({"Content-Type":g})})}"jsonp"===d?i(arguments[0],e).then(function(a){if(a.ok)return a.json();throw a}).then(function(b){a(b)}).catch(function(a){if(!b)throw a;b(a)}):fetch(c).then(function(a){if(a.ok)return"json"===d?a.json():a.text();throw a}).then(function(b){if("xml"===d){b=(new DOMParser).parseFromString(b,"text/xml"),b=parseXML(b.documentElement)}a(b)}).catch(function(a,c){if(!b)throw a;b(a)})},window.URL=window.URL||window.webkitURL,h.prototype._pWriters=[],h.prototype.createWriter=function(a,b){var c;for(var d in h.prototype._pWriters)if(h.prototype._pWriters[d].name===a)return c=new h.PrintWriter(a+window.millis(),b),h.prototype._pWriters.push(c),c;return c=new h.PrintWriter(a,b),h.prototype._pWriters.push(c),c},h.PrintWriter=function(a,b){var c=this;this.name=a,this.content="",this.write=function(a){this.content+=a},this.print=function(a){this.content+=a+"\n"},this.flush=function(){this.content=""},this.close=function(){var d=[];d.push(this.content),h.prototype.writeFile(d,a,b)
;for(var e in h.prototype._pWriters)h.prototype._pWriters[e].name===this.name&&h.prototype._pWriters.splice(e,1);c.flush(),c={}}},h.prototype.save=function(a,b,c){var d=arguments,e=this._curElement.elt;if(0===d.length)return void h.prototype.saveCanvas(e);if(d[0]instanceof h.Renderer||d[0]instanceof h.Graphics)return void h.prototype.saveCanvas(d[0].elt,d[1],d[2]);if(1===d.length&&"string"==typeof d[0])h.prototype.saveCanvas(e,d[0]);else{switch(f(d[1],d[2])[1]){case"json":return void h.prototype.saveJSON(d[0],d[1],d[2]);case"txt":return void h.prototype.saveStrings(d[0],d[1],d[2]);default:d[0]instanceof Array?h.prototype.saveStrings(d[0],d[1],d[2]):d[0]instanceof h.Table?h.prototype.saveTable(d[0],d[1],d[2],d[3]):d[0]instanceof h.Image?h.prototype.saveCanvas(d[0].canvas,d[1]):d[0]instanceof h.SoundFile&&h.prototype.saveSound(d[0],d[1],d[2],d[3])}}},h.prototype.saveJSON=function(a,b,c){var d;d=c?JSON.stringify(a):JSON.stringify(a,void 0,2),this.saveStrings(d.split("\n"),b,"json")},h.prototype.saveJSONObject=h.prototype.saveJSON,h.prototype.saveJSONArray=h.prototype.saveJSON,h.prototype.saveStrings=function(a,b,c){for(var d=c||"txt",e=this.createWriter(b,d),f=0;f<a.length;f++)a.length,e.print(a[f]);e.close(),e.flush()},h.prototype.saveTable=function(a,b,c){var d;d=void 0===c?b.substring(b.lastIndexOf(".")+1,b.length):c;var f=this.createWriter(b,d),g=a.columns,h=",";if("tsv"===d&&(h="\t"),"html"!==d){if("0"!==g[0]){for(var i=0;i<g.length;i++)i<g.length-1?f.write(g[i]+h):f.write(g[i]);f.write("\n")}for(var j=0;j<a.rows.length;j++){var k;for(k=0;k<a.rows[j].arr.length;k++)k<a.rows[j].arr.length-1?f.write(a.rows[j].arr[k]+h):(a.rows.length,f.write(a.rows[j].arr[k]));f.write("\n")}}else{f.print("<html>"),f.print("<head>");var l=' <meta http-equiv="content-type" content';if(l+='="text/html;charset=utf-8" />',f.print(l),f.print("</head>"),f.print("<body>"),f.print(" <table>"),"0"!==g[0]){f.print(" <tr>");for(var m=0;m<g.length;m++){var n=e(g[m]);f.print(" <td>"+n),f.print(" </td>")}f.print(" </tr>")}for(var o=0;o<a.rows.length;o++){f.print(" <tr>");for(var p=0;p<a.columns.length;p++){var q=a.rows[o].getString(p),r=e(q);f.print(" <td>"+r),f.print(" </td>")}f.print(" </tr>")}f.print(" </table>"),f.print("</body>"),f.print("</html>")}f.close(),f.flush()},h.prototype.writeFile=function(a,b,c){var d="application/octet-stream";h.prototype._isSafari()&&(d="text/plain");var e=new Blob(a,{type:d}),f=window.URL.createObjectURL(e);h.prototype.downloadFile(f,b,c)},h.prototype.downloadFile=function(a,b,c){var d=f(b,c),e=d[0],i=d[1],j=document.createElement("a");if(j.href=a,j.download=e,j.onclick=function(a){g(a),a.stopPropagation()},j.style.display="none",document.body.appendChild(j),h.prototype._isSafari()){var k="Hello, Safari user! To download this file...\n";k+="1. Go to File --> Save As.\n",k+='2. Choose "Page Source" as the Format.\n',k+='3. Name it with this extension: ."'+i+'"',alert(k)}j.click(),a=null},h.prototype._checkFileExtension=f,h.prototype._isSafari=function(){return Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0},b.exports=h},{"../core/core":55,"../core/error_helpers":58,"es6-promise":5,"fetch-jsonp":6,"whatwg-fetch":45}],80:[function(a,b,c){"use strict";var d=a("../core/core");d.Table=function(a){this.columns=[],this.rows=[],this.name="p5.Table"},d.Table.prototype.addRow=function(a){var b=a||new d.TableRow;if(void 0===b.arr||void 0===b.obj)throw"invalid TableRow: "+b;return b.table=this,this.rows.push(b),b},d.Table.prototype.removeRow=function(a){this.rows[a].table=null;var b=this.rows.splice(a+1,this.rows.length);this.rows.pop(),this.rows=this.rows.concat(b)},d.Table.prototype.getRow=function(a){return this.rows[a]},d.Table.prototype.getRows=function(){return this.rows},d.Table.prototype.findRow=function(a,b){if("string"==typeof b){for(var c=0;c<this.rows.length;c++)if(this.rows[c].obj[b]===a)return this.rows[c]}else for(var d=0;d<this.rows.length;d++)if(this.rows[d].arr[b]===a)return this.rows[d];return null},d.Table.prototype.findRows=function(a,b){var c=[];if("string"==typeof b)for(var d=0;d<this.rows.length;d++)this.rows[d].obj[b]===a&&c.push(this.rows[d]);else for(var e=0;e<this.rows.length;e++)this.rows[e].arr[b]===a&&c.push(this.rows[e]);return c},d.Table.prototype.matchRow=function(a,b){if("number"==typeof b){for(var c=0;c<this.rows.length;c++)if(this.rows[c].arr[b].match(a))return this.rows[c]}else for(var d=0;d<this.rows.length;d++)if(this.rows[d].obj[b].match(a))return this.rows[d];return null},d.Table.prototype.matchRows=function(a,b){var c=[];if("number"==typeof b)for(var d=0;d<this.rows.length;d++)this.rows[d].arr[b].match(a)&&c.push(this.rows[d]);else for(var e=0;e<this.rows.length;e++)this.rows[e].obj[b].match(a)&&c.push(this.rows[e]);return c},d.Table.prototype.getColumn=function(a){var b=[];if("string"==typeof a)for(var c=0;c<this.rows.length;c++)b.push(this.rows[c].obj[a]);else for(var d=0;d<this.rows.length;d++)b.push(this.rows[d].arr[a]);return b},d.Table.prototype.clearRows=function(){delete this.rows,this.rows=[]},d.Table.prototype.addColumn=function(a){var b=a||null;this.columns.push(b)},d.Table.prototype.getColumnCount=function(){return this.columns.length},d.Table.prototype.getRowCount=function(){return this.rows.length},d.Table.prototype.removeTokens=function(a,b){for(var c=function(a){return a.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},d=[],e=0;e<a.length;e++)d.push(c(a.charAt(e)));var f=new RegExp(d.join("|"),"g");if(void 0===b)for(var g=0;g<this.columns.length;g++)for(var h=0;h<this.rows.length;h++){var i=this.rows[h].arr[g];i=i.replace(f,""),this.rows[h].arr[g]=i,this.rows[h].obj[this.columns[g]]=i}else if("string"==typeof b)for(var j=0;j<this.rows.length;j++){var k=this.rows[j].obj[b];k=k.replace(f,""),this.rows[j].obj[b]=k;var l=this.columns.indexOf(b);this.rows[j].arr[l]=k}else for(var m=0;m<this.rows.length;m++){var n=this.rows[m].arr[b];n=n.replace(f,""),this.rows[m].arr[b]=n,this.rows[m].obj[this.columns[b]]=n}},d.Table.prototype.trim=function(a){var b=new RegExp(" ","g");if(void 0===a)for(var c=0;c<this.columns.length;c++)for(var d=0;d<this.rows.length;d++){var e=this.rows[d].arr[c];e=e.replace(b,""),this.rows[d].arr[c]=e,this.rows[d].obj[this.columns[c]]=e}else if("string"==typeof a)for(var f=0;f<this.rows.length;f++){var g=this.rows[f].obj[a];g=g.replace(b,""),this.rows[f].obj[a]=g;var h=this.columns.indexOf(a);this.rows[f].arr[h]=g}else for(var i=0;i<this.rows.length;i++){var j=this.rows[i].arr[a];j=j.replace(b,""),this.rows[i].arr[a]=j,this.rows[i].obj[this.columns[a]]=j}},d.Table.prototype.removeColumn=function(a){var b,c;"string"==typeof a?(b=a,c=this.columns.indexOf(a),console.log("string")):(c=a,b=this.columns[a]);var d=this.columns.splice(c+1,this.columns.length);this.columns.pop(),this.columns=this.columns.concat(d);for(var e=0;e<this.rows.length;e++){var f=this.rows[e].arr,g=f.splice(c+1,f.length);f.pop(),this.rows[e].arr=f.concat(g),delete this.rows[e].obj[b]}},d.Table.prototype.set=function(a,b,c){this.rows[a].set(b,c)},d.Table.prototype.setNum=function(a,b,c){this.rows[a].setNum(b,c)},d.Table.prototype.setString=function(a,b,c){this.rows[a].setString(b,c)},d.Table.prototype.get=function(a,b){return this.rows[a].get(b)},d.Table.prototype.getNum=function(a,b){return this.rows[a].getNum(b)},d.Table.prototype.getString=function(a,b){return this.rows[a].getString(b)},d.Table.prototype.getObject=function(a){for(var b,c,d={},e=0;e<this.rows.length;e++)if(b=this.rows[e].obj,"string"==typeof a){if(!(this.columns.indexOf(a)>=0))throw'This table has no column named "'+a+'"';c=b[a],d[c]=b}else d[e]=this.rows[e].obj;return d},d.Table.prototype.getArray=function(){for(var a=[],b=0;b<this.rows.length;b++)a.push(this.rows[b].arr);return a},b.exports=d},{"../core/core":55}],81:[function(a,b,c){"use strict";var d=a("../core/core");d.TableRow=function(a,b){var c=[],d={};a&&(b=b||",",c=a.split(b));for(var e=0;e<c.length;e++){var f=e,g=c[e];d[f]=g}this.arr=c,this.obj=d,this.table=null,this.name="p5.TableRow"},d.TableRow.prototype.set=function(a,b){if("string"==typeof a){var c=this.table.columns.indexOf(a);if(!(c>=0))throw'This table has no column named "'+a+'"';this.obj[a]=b,this.arr[c]=b}else{if(!(a<this.table.columns.length))throw"Column #"+a+" is out of the range of this table";this.arr[a]=b;var d=this.table.columns[a];this.obj[d]=b}},d.TableRow.prototype.setNum=function(a,b){var c=parseFloat(b);this.set(a,c)},d.TableRow.prototype.setString=function(a,b){var c=b.toString();this.set(a,c)},d.TableRow.prototype.get=function(a){return"string"==typeof a?this.obj[a]:this.arr[a]},d.TableRow.prototype.getNum=function(a){var b;if(b="string"==typeof a?parseFloat(this.obj[a]):parseFloat(this.arr[a]),"NaN"===b.toString())throw"Error: "+this.obj[a]+" is NaN (Not a Number)";return b},d.TableRow.prototype.getString=function(a){return"string"==typeof a?this.obj[a].toString():this.arr[a].toString()},b.exports=d},{"../core/core":55}],82:[function(a,b,c){"use strict";var d=a("../core/core");d.XML=function(){this.name=null,this.attributes={},this.children=[],this.parent=null,this.content=null,this.name="p5.XML"},d.XML.prototype.getParent=function(){return this.parent},d.XML.prototype.getName=function(){return this.name},d.XML.prototype.setName=function(a){this.name=a},d.XML.prototype.hasChildren=function(){return this.children.length>0},d.XML.prototype.listChildren=function(){return this.children.map(function(a){return a.name})},d.XML.prototype.getChildren=function(a){return a?this.children.filter(function(b){return b.name===a}):this.children},d.XML.prototype.getChild=function(a){return"string"==typeof a?this.children.find(function(b){return b.name===a}):this.children[a]},d.XML.prototype.addChild=function(a){a instanceof d.XML&&this.children.push(a)},d.XML.prototype.removeChild=function(a){var b=-1;if("string"==typeof a){for(var c=0;c<this.children.length;c++)if(this.children[c].name===a){b=c;break}}else b=a;b!==-1&&this.children.splice(b,1)},d.XML.prototype.getAttributeCount=function(){return Object.keys(this.attributes).length},d.XML.prototype.listAttributes=function(){return Object.keys(this.attributes)},d.XML.prototype.hasAttribute=function(a){return!!this.attributes[a]},d.XML.prototype.getNum=function(a,b){return Number(this.attributes[a])||b||0},d.XML.prototype.getString=function(a,b){return String(this.attributes[a])||b||null},d.XML.prototype.setAttribute=function(a,b){this.attributes[a]&&(this.attributes[a]=b)},d.XML.prototype.getContent=function(a){return this.content||a||null},d.XML.prototype.setContent=function(a){this.children.length||(this.content=a)},d.XML.prototype._setCont=function(a){var b;b=a,b=b.replace(/\s\s+/g,","),this.content=b},d.XML.prototype._setAttributes=function(a){var b,c={};for(b=0;b<a.attributes.length;b++)c[a.attributes[b].nodeName]=a.attributes[b].nodeValue;this.attributes=c},b.exports=d},{"../core/core":55}],83:[function(a,b,c){"use strict";function d(a,b,c){if("function"==typeof Math.hypot)return Math.hypot.apply(null,arguments);for(var d=arguments.length,e=[],f=0,g=0;g<d;g++){var h=arguments[g];if((h=+h)===1/0||h===-(1/0))return 1/0;h=Math.abs(h),h>f&&(f=h),e[g]=h}0===f&&(f=1);for(var i=0,j=0,k=0;k<d;k++){var l=e[k]/f,m=l*l-j,n=i+m;j=n-i-m,i=n}return Math.sqrt(i)*f}var e=a("../core/core");e.prototype.abs=Math.abs,e.prototype.ceil=Math.ceil,e.prototype.constrain=function(a,b,c){return Math.max(Math.min(a,c),b)},e.prototype.dist=function(){return 4===arguments.length?d(arguments[2]-arguments[0],arguments[3]-arguments[1]):6===arguments.length?d(arguments[3]-arguments[0],arguments[4]-arguments[1],arguments[5]-arguments[2]):void 0},e.prototype.exp=Math.exp,e.prototype.floor=Math.floor,e.prototype.lerp=function(a,b,c){return c*(b-a)+a},e.prototype.log=Math.log,e.prototype.mag=function(a,b){return d(a,b)},e.prototype.map=function(a,b,c,d,e,f){var g=(a-b)/(c-b)*(e-d)+d;return f?d<e?this.constrain(g,d,e):this.constrain(g,e,d):g},e.prototype.max=function(){return arguments[0]instanceof Array?Math.max.apply(null,arguments[0]):Math.max.apply(null,arguments)},e.prototype.min=function(){return arguments[0]instanceof Array?Math.min.apply(null,arguments[0]):Math.min.apply(null,arguments)},e.prototype.norm=function(a,b,c){return this.map(a,b,c,0,1)},e.prototype.pow=Math.pow,e.prototype.round=Math.round,e.prototype.sq=function(a){return a*a},e.prototype.sqrt=Math.sqrt,b.exports=e},{"../core/core":55}],84:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.createVector=function(a,b,c){return this instanceof d?new d.Vector(this,arguments):new d.Vector(a,b,c)},b.exports=d},{"../core/core":55}],85:[function(a,b,c){"use strict";var d,e=a("../core/core"),f=4,g=1<<f,h=8,i=1<<h,j=4095,k=4,l=.5,m=function(a){return.5*(1-Math.cos(a*Math.PI))};e.prototype.noise=function(a,b,c){if(b=b||0,c=c||0,null==d){d=new Array(j+1);for(var e=0;e<j+1;e++)d[e]=Math.random()}a<0&&(a=-a),b<0&&(b=-b),c<0&&(c=-c);for(var n,o,p,q,r,s=Math.floor(a),t=Math.floor(b),u=Math.floor(c),v=a-s,w=b-t,x=c-u,y=0,z=.5,A=0;A<k;A++){var B=s+(t<<f)+(u<<h);n=m(v),o=m(w),p=d[B&j],p+=n*(d[B+1&j]-p),q=d[B+g&j],q+=n*(d[B+g+1&j]-q),p+=o*(q-p),B+=i,q=d[B&j],q+=n*(d[B+1&j]-q),r=d[B+g&j],r+=n*(d[B+g+1&j]-r),q+=o*(r-q),p+=m(x)*(q-p),y+=p*z,z*=l,s<<=1,v*=2,t<<=1,w*=2,u<<=1,x*=2,v>=1&&(s++,v--),w>=1&&(t++,w--),x>=1&&(u++,x--)}return y},e.prototype.noiseDetail=function(a,b){a>0&&(k=a),b>0&&(l=b)},e.prototype.noiseSeed=function(a){var b=function(){var a,b,c=4294967296,d=1664525,e=1013904223;return{setSeed:function(d){b=a=(null==d?Math.random()*c:d)>>>0},getSeed:function(){return a},rand:function(){return(b=(d*b+e)%c)/c}}}();b.setSeed(a),d=new Array(j+1);for(var c=0;c<j+1;c++)d[c]=b.rand()},b.exports=e},{"../core/core":55}],86:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("./polargeometry"),f=a("../core/constants");d.Vector=function(){var a,b,c;arguments[0]instanceof d?(this.p5=arguments[0],a=arguments[1][0]||0,b=arguments[1][1]||0,c=arguments[1][2]||0):(a=arguments[0]||0,b=arguments[1]||0,c=arguments[2]||0),this.x=a,this.y=b,this.z=c,this.name="p5.Vector"},d.Vector.prototype.toString=function(){return"p5.Vector Object : ["+this.x+", "+this.y+", "+this.z+"]"},d.Vector.prototype.set=function(a,b,c){return a instanceof d.Vector?(this.x=a.x||0,this.y=a.y||0,this.z=a.z||0,this):a instanceof Array?(this.x=a[0]||0,this.y=a[1]||0,this.z=a[2]||0,this):(this.x=a||0,this.y=b||0,this.z=c||0,this)},d.Vector.prototype.copy=function(){return this.p5?new d.Vector(this.p5,[this.x,this.y,this.z]):new d.Vector(this.x,this.y,this.z)},d.Vector.prototype.add=function(a,b,c){return a instanceof d.Vector?(this.x+=a.x||0,this.y+=a.y||0,this.z+=a.z||0,this):a instanceof Array?(this.x+=a[0]||0,this.y+=a[1]||0,this.z+=a[2]||0,this):(this.x+=a||0,this.y+=b||0,this.z+=c||0,this)},d.Vector.prototype.sub=function(a,b,c){return a instanceof d.Vector?(this.x-=a.x||0,this.y-=a.y||0,this.z-=a.z||0,this):a instanceof Array?(this.x-=a[0]||0,this.y-=a[1]||0,this.z-=a[2]||0,this):(this.x-=a||0,this.y-=b||0,this.z-=c||0,this)},d.Vector.prototype.mult=function(a){return this.x*=a||0,this.y*=a||0,this.z*=a||0,this},d.Vector.prototype.div=function(a){return this.x/=a,this.y/=a,this.z/=a,this},d.Vector.prototype.mag=function(){return Math.sqrt(this.magSq())},d.Vector.prototype.magSq=function(){var a=this.x,b=this.y,c=this.z;return a*a+b*b+c*c},d.Vector.prototype.dot=function(a,b,c){return a instanceof d.Vector?this.dot(a.x,a.y,a.z):this.x*(a||0)+this.y*(b||0)+this.z*(c||0)},d.Vector.prototype.cross=function(a){var b=this.y*a.z-this.z*a.y,c=this.z*a.x-this.x*a.z,e=this.x*a.y-this.y*a.x;return this.p5?new d.Vector(this.p5,[b,c,e]):new d.Vector(b,c,e)},d.Vector.prototype.dist=function(a){return a.copy().sub(this).mag()},d.Vector.prototype.normalize=function(){return 0===this.mag()?this:this.div(this.mag())},d.Vector.prototype.limit=function(a){var b=this.magSq();return b>a*a&&(this.div(Math.sqrt(b)),this.mult(a)),this},d.Vector.prototype.setMag=function(a){return this.normalize().mult(a)},d.Vector.prototype.heading=function(){var a=Math.atan2(this.y,this.x);return this.p5?this.p5._angleMode===f.RADIANS?a:e.radiansToDegrees(a):a},d.Vector.prototype.rotate=function(a){var b=this.heading()+a;this.p5&&this.p5._angleMode===f.DEGREES&&(b=e.degreesToRadians(b));var c=this.mag();return this.x=Math.cos(b)*c,this.y=Math.sin(b)*c,this},d.Vector.prototype.angleBetween=function(a){var b=this.dot(a)/(this.mag()*a.mag()),c=Math.acos(Math.min(1,Math.max(-1,b)));return this.p5&&this.p5._angleMode===f.DEGREES&&(c=e.radiansToDegrees(c)),c},d.Vector.prototype.lerp=function(a,b,c,e){return a instanceof d.Vector?this.lerp(a.x,a.y,a.z,b):(this.x+=(a-this.x)*e||0,this.y+=(b-this.y)*e||0,this.z+=(c-this.z)*e||0,this)},d.Vector.prototype.array=function(){return[this.x||0,this.y||0,this.z||0]},d.Vector.prototype.equals=function(a,b,c){var e,f,g;return a instanceof d.Vector?(e=a.x||0,f=a.y||0,g=a.z||0):a instanceof Array?(e=a[0]||0,f=a[1]||0,g=a[2]||0):(e=a||0,f=b||0,g=c||0),this.x===e&&this.y===f&&this.z===g},d.Vector.fromAngle=function(a){return this.p5&&this.p5._angleMode===f.DEGREES&&(a=e.degreesToRadians(a)),this.p5?new d.Vector(this.p5,[Math.cos(a),Math.sin(a),0]):new d.Vector(Math.cos(a),Math.sin(a),0)},d.Vector.random2D=function(){var a;return a=this.p5?this.p5._angleMode===f.DEGREES?this.p5.random(360):this.p5.random(f.TWO_PI):Math.random()*Math.PI*2,this.fromAngle(a)},d.Vector.random3D=function(){var a,b;this.p5?(a=this.p5.random(0,f.TWO_PI),b=this.p5.random(-1,1)):(a=Math.random()*Math.PI*2,b=2*Math.random()-1);var c=Math.sqrt(1-b*b)*Math.cos(a),e=Math.sqrt(1-b*b)*Math.sin(a);return this.p5?new d.Vector(this.p5,[c,e,b]):new d.Vector(c,e,b)},d.Vector.add=function(a,b,c){return c?c.set(a):c=a.copy(),c.add(b),c},d.Vector.sub=function(a,b,c){return c?c.set(a):c=a.copy(),c.sub(b),c},d.Vector.mult=function(a,b,c){return c?c.set(a):c=a.copy(),c.mult(b),c},d.Vector.div=function(a,b,c){return c?c.set(a):c=a.copy(),c.div(b),c},d.Vector.dot=function(a,b){return a.dot(b)},d.Vector.cross=function(a,b){return a.cross(b)},d.Vector.dist=function(a,b){return a.dist(b)},d.Vector.lerp=function(a,b,c,d){return d?d.set(a):d=a.copy(),d.lerp(b,c),d},d.Vector.mag=function(a){var b=a.x,c=a.y,d=a.z,e=b*b+c*c+d*d;return Math.sqrt(e)},b.exports=d.Vector},{"../core/constants":54,"../core/core":55,"./polargeometry":87}],87:[function(a,b,c){b.exports={degreesToRadians:function(a){return 2*Math.PI*a/360},radiansToDegrees:function(a){return 360*a/(2*Math.PI)}}},{}],88:[function(a,b,c){"use strict";var d=a("../core/core"),e=!1,f=!1,g=0,h=function(){var a,b,c=4294967296,d=1664525,e=1013904223;return{setSeed:function(d){b=a=(null==d?Math.random()*c:d)>>>0},getSeed:function(){return a},rand:function(){return(b=(d*b+e)%c)/c}}}();d.prototype.randomSeed=function(a){h.setSeed(a),e=!0,f=!1},d.prototype.random=function(a,b){var c;if(c=e?h.rand():Math.random(),void 0===a)return c;if(void 0===b)return a instanceof Array?a[Math.floor(c*a.length)]:c*a;if(a>b){var d=a;a=b,b=d}return c*(b-a)+a},d.prototype.randomGaussian=function(a,b){var c,d,e,h;if(f)c=g,f=!1;else{do{d=this.random(2)-1,e=this.random(2)-1,h=d*d+e*e}while(h>=1);h=Math.sqrt(-2*Math.log(h)/h),c=d*h,g=e*h,f=!0}var i=a||0;return c*(b||1)+i},b.exports=d},{"../core/core":55}],89:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("./polargeometry"),f=a("../core/constants");d.prototype._angleMode=f.RADIANS,d.prototype.acos=function(a){return this._angleMode===f.RADIANS?Math.acos(a):e.radiansToDegrees(Math.acos(a))},d.prototype.asin=function(a){return this._angleMode===f.RADIANS?Math.asin(a):e.radiansToDegrees(Math.asin(a))},d.prototype.atan=function(a){return this._angleMode===f.RADIANS?Math.atan(a):e.radiansToDegrees(Math.atan(a))},d.prototype.atan2=function(a,b){return this._angleMode===f.RADIANS?Math.atan2(a,b):e.radiansToDegrees(Math.atan2(a,b))},d.prototype.cos=function(a){return this._angleMode===f.RADIANS?Math.cos(a):Math.cos(this.radians(a))},d.prototype.sin=function(a){return this._angleMode===f.RADIANS?Math.sin(a):Math.sin(this.radians(a))},d.prototype.tan=function(a){return this._angleMode===f.RADIANS?Math.tan(a):Math.tan(this.radians(a))},d.prototype.degrees=function(a){return e.radiansToDegrees(a)},d.prototype.radians=function(a){return e.degreesToRadians(a)},d.prototype.angleMode=function(a){a!==f.DEGREES&&a!==f.RADIANS||(this._angleMode=a)},b.exports=d},{"../core/constants":54,"../core/core":55,"./polargeometry":87}],90:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.textAlign=function(a,b){return this._renderer.textAlign.apply(this._renderer,arguments)},d.prototype.textLeading=function(a){return this._renderer.textLeading.apply(this._renderer,arguments)},d.prototype.textSize=function(a){return this._renderer.textSize.apply(this._renderer,arguments)},d.prototype.textStyle=function(a){return this._renderer.textStyle.apply(this._renderer,arguments)},d.prototype.textWidth=function(a){return 0===a.length?0:this._renderer.textWidth.apply(this._renderer,arguments)},d.prototype.textAscent=function(){return this._renderer.textAscent()},d.prototype.textDescent=function(){return this._renderer.textDescent()},d.prototype._updateTextMetrics=function(){return this._renderer._updateTextMetrics()},b.exports=d},{"../core/core":55}],91:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("../core/constants"),f=a("opentype.js");a("../core/error_helpers"),d.prototype.loadFont=function(a,b,c){var e=new d.Font(this),g=this;return f.load(a,function(f,h){if(f)return void 0!==c?c(f):(d._friendlyFileLoadError(4,a),void console.error(f,a));e.font=h,void 0!==b&&b(e),g._decrementPreload();var i,j,k=["ttf","otf","woff","woff2"],l=a.split("\\").pop().split("/").pop(),m=l.lastIndexOf("."),n=m<1?null:l.substr(m+1);k.indexOf(n)>-1&&(i=l.substr(0,m),j=document.createElement("style"),j.appendChild(document.createTextNode("\n@font-face {\nfont-family: "+i+";\nsrc: url("+a+");\n}\n")),document.head.appendChild(j))}),e},d.prototype.text=function(a,b,c,d,e){return this._renderer._doFill||this._renderer._doStroke?this._renderer.text.apply(this._renderer,arguments):this},d.prototype.textFont=function(a,b){if(arguments.length){if(!a)throw Error("null font passed to textFont");return this._renderer._setProperty("_textFont",a),b&&(this._renderer._setProperty("_textSize",b),this._renderer._setProperty("_textLeading",b*e._DEFAULT_LEADMULT)),this._renderer._applyTextProperties()}return this._renderer._textFont},b.exports=d},{"../core/constants":54,"../core/core":55,"../core/error_helpers":58,"opentype.js":18}],92:[function(a,b,c){"use strict";function d(a,b){for(var c=h(b,{sampleFactor:.1,simplifyThreshold:0}),d=n(a,0,1),f=d/(d*c.sampleFactor),g=[],i=0;i<d;i+=f)g.push(n(a,i));return c.simplifyThreshold&&e(g,c.simplifyThreshold),g}function e(a,b){b=void 0===b?0:b;for(var c=0,d=a.length-1;a.length>3&&d>=0;--d)j(i(a,d-1),i(a,d),i(a,d+1),b)&&(a.splice(d%a.length,1),c++);return c}function f(a){for(var b,c=[],d=0;d<a.length;d++)"M"===a[d].type&&(b&&c.push(b),b=[]),b.push(g(a[d]));return c.push(b),c}function g(a){var b=[a.type];return"M"===a.type||"L"===a.type?b.push(a.x,a.y):"C"===a.type?b.push(a.x1,a.y1,a.x2,a.y2,a.x,a.y):"Q"===a.type&&b.push(a.x1,a.y1,a.x,a.y),b}function h(a,b){if("object"!=typeof a)a=b;else for(var c in b)void 0===a[c]&&(a[c]=b[c]);return a}function i(a,b){var c=a.length;return a[b<0?b%c+c:b%c]}function j(a,b,c,d){if(!d)return 0===k(a,b,c);void 0===j.tmpPoint1&&(j.tmpPoint1=[],j.tmpPoint2=[]);var e=j.tmpPoint1,f=j.tmpPoint2;e.x=b.x-a.x,e.y=b.y-a.y,f.x=c.x-b.x,f.y=c.y-b.y;var g=e.x*f.x+e.y*f.y,h=Math.sqrt(e.x*e.x+e.y*e.y),i=Math.sqrt(f.x*f.x+f.y*f.y);return Math.acos(g/(h*i))<d}function k(a,b,c){return(b[0]-a[0])*(c[1]-a[1])-(c[0]-a[0])*(b[1]-a[1])}function l(a,b,c,d,e,f,g,h,i){var j=1-i,k=Math.pow(j,3),l=Math.pow(j,2),m=i*i,n=m*i,o=k*a+3*l*i*c+3*j*i*i*e+n*g,p=k*b+3*l*i*d+3*j*i*i*f+n*h,q=a+2*i*(c-a)+m*(e-2*c+a),r=b+2*i*(d-b)+m*(f-2*d+b),s=c+2*i*(e-c)+m*(g-2*e+c),t=d+2*i*(f-d)+m*(h-2*f+d),u=j*a+i*c,v=j*b+i*d,w=j*e+i*g,x=j*f+i*h,y=90-180*Math.atan2(q-s,r-t)/Math.PI;return(q>s||r<t)&&(y+=180),{x:o,y:p,m:{x:q,y:r},n:{x:s,y:t},start:{x:u,y:v},end:{x:w,y:x},alpha:y}}function m(a,b,c,d,e,f,g,h,i){return null==i?u(a,b,c,d,e,f,g,h):l(a,b,c,d,e,f,g,h,v(a,b,c,d,e,f,g,h,i))}function n(a,b,c){a=p(a);for(var d,e,f,g,h,i="",j={},k=0,n=0,o=a.length;n<o;n++){if(f=a[n],"M"===f[0])d=+f[1],e=+f[2];else{if(g=m(d,e,f[1],f[2],f[3],f[4],f[5],f[6]),k+g>b&&!c)return h=m(d,e,f[1],f[2],f[3],f[4],f[5],f[6],b-k),{x:h.x,y:h.y,alpha:h.alpha};k+=g,d=+f[5],e=+f[6]}i+=f.shift()+f}return j.end=i,h=c?k:l(d,e,f[0],f[1],f[2],f[3],f[4],f[5],1),h.alpha&&(h={x:h.x,y:h.y,alpha:h.alpha}),h}function o(a){var b=[],c=0,d=0,e=0,f=0,g=0;if(!a)return b;"M"===a[0][0]&&(c=+a[0][1],d=+a[0][2],e=c,f=d,g++,b[0]=["M",c,d]);for(var h,i,j,k=3===a.length&&"M"===a[0][0]&&"R"===a[1][0].toUpperCase()&&"Z"===a[2][0].toUpperCase(),l=g,m=a.length;l<m;l++){if(b.push(i=[]),j=a[l],j[0]!==String.prototype.toUpperCase.call(j[0]))switch(i[0]=String.prototype.toUpperCase.call(j[0]),i[0]){case"A":i[1]=j[1],i[2]=j[2],i[3]=j[3],i[4]=j[4],i[5]=j[5],i[6]=+(j[6]+c),i[7]=+(j[7]+d);break;case"V":i[1]=+j[1]+d;break;case"H":i[1]=+j[1]+c;break;case"R":h=[c,d].concat(j.slice(1));for(var n=2,o=h.length;n<o;n++)h[n]=+h[n]+c,h[++n]=+h[n]+d;b.pop(),b=b.concat(r(h,k));break;case"M":e=+j[1]+c,f=+j[2]+d;break;default:for(n=1,o=j.length;n<o;n++)i[n]=+j[n]+(n%2?c:d)}else if("R"===j[0])h=[c,d].concat(j.slice(1)),b.pop(),b=b.concat(r(h,k)),i=["R"].concat(j.slice(-2));else for(var p=0,q=j.length;p<q;p++)i[p]=j[p];switch(i[0]){case"Z":c=e,d=f;break;case"H":c=i[1];break;case"V":d=i[1];break;case"M":e=i[i.length-2],f=i[i.length-1];break;default:c=i[i.length-2],d=i[i.length-1]}}return b}function p(a,b){for(var c=o(a),d=b&&o(b),e={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},f={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},g=(function(a,b,c){var d,e,f={T:1,Q:1};if(!a)return["C",b.x,b.y,b.x,b.y,b.x,b.y];switch(a[0]in f||(b.qx=b.qy=null),a[0]){case"M":b.X=a[1],b.Y=a[2];break;case"A":a=["C"].concat(q.apply(0,[b.x,b.y].concat(a.slice(1))));break;case"S":"C"===c||"S"===c?(d=2*b.x-b.bx,e=2*b.y-b.by):(d=b.x,e=b.y),a=["C",d,e].concat(a.slice(1));break;case"T":"Q"===c||"T"===c?(b.qx=2*b.x-b.qx,b.qy=2*b.y-b.qy):(b.qx=b.x,b.qy=b.y),a=["C"].concat(t(b.x,b.y,b.qx,b.qy,a[1],a[2]));break;case"Q":b.qx=a[1],b.qy=a[2],a=["C"].concat(t(b.x,b.y,a[1],a[2],a[3],a[4]));break;case"L":a=["C"].concat(s(b.x,b.y,a[1],a[2]));break;case"H":a=["C"].concat(s(b.x,b.y,a[1],b.y));break;case"V":a=["C"].concat(s(b.x,b.y,b.x,a[1]));break;case"Z":a=["C"].concat(s(b.x,b.y,b.X,b.Y))}return a}),h=function(a,b){if(a[b].length>7){a[b].shift();for(var e=a[b];e.length;)j[b]="A",d&&(k[b]="A"),a.splice(b++,0,["C"].concat(e.splice(0,6)));a.splice(b,1),p=Math.max(c.length,d&&d.length||0)}},i=function(a,b,e,f,g){a&&b&&"M"===a[g][0]&&"M"!==b[g][0]&&(b.splice(g,0,["M",f.x,f.y]),e.bx=0,e.by=0,e.x=a[g][1],e.y=a[g][2],p=Math.max(c.length,d&&d.length||0))},j=[],k=[],l="",m="",n=0,p=Math.max(c.length,d&&d.length||0);n<p;n++){c[n]&&(l=c[n][0]),"C"!==l&&(j[n]=l,n&&(m=j[n-1])),c[n]=g(c[n],e,m),"A"!==j[n]&&"C"===l&&(j[n]="C"),h(c,n),d&&(d[n]&&(l=d[n][0]),"C"!==l&&(k[n]=l,n&&(m=k[n-1])),d[n]=g(d[n],f,m),"A"!==k[n]&&"C"===l&&(k[n]="C"),h(d,n)),i(c,d,e,f,n),i(d,c,f,e,n);var r=c[n],u=d&&d[n],v=r.length,w=d&&u.length;e.x=r[v-2],e.y=r[v-1],e.bx=parseFloat(r[v-4])||e.x,e.by=parseFloat(r[v-3])||e.y,f.bx=d&&(parseFloat(u[w-4])||f.x),f.by=d&&(parseFloat(u[w-3])||f.y),f.x=d&&u[w-2],f.y=d&&u[w-1]}return d?[c,d]:c}function q(a,b,c,d,e,f,g,h,i,j){var k,l,m,n,o,p=Math.PI,r=120*p/180,s=p/180*(+e||0),t=[],u=function(a,b,c){return{x:a*Math.cos(c)-b*Math.sin(c),y:a*Math.sin(c)+b*Math.cos(c)}};if(j)k=j[0],l=j[1],m=j[2],n=j[3];else{o=u(a,b,-s),a=o.x,b=o.y,o=u(h,i,-s),h=o.x,i=o.y;var v=(a-h)/2,w=(b-i)/2,x=v*v/(c*c)+w*w/(d*d);x>1&&(x=Math.sqrt(x),c*=x,d*=x);var y=c*c,z=d*d,A=(f===g?-1:1)*Math.sqrt(Math.abs((y*z-y*w*w-z*v*v)/(y*w*w+z*v*v)));m=A*c*w/d+(a+h)/2,n=A*-d*v/c+(b+i)/2,k=Math.asin(((b-n)/d).toFixed(9)),l=Math.asin(((i-n)/d).toFixed(9)),k=a<m?p-k:k,l=h<m?p-l:l,k<0&&(k=2*p+k),l<0&&(l=2*p+l),g&&k>l&&(k-=2*p),!g&&l>k&&(l-=2*p)}var B=l-k;if(Math.abs(B)>r){var C=l,D=h,E=i;l=k+r*(g&&l>k?1:-1),h=m+c*Math.cos(l),i=n+d*Math.sin(l),t=q(h,i,c,d,e,0,g,D,E,[l,C,m,n])}B=l-k;var F=Math.cos(k),G=Math.sin(k),H=Math.cos(l),I=Math.sin(l),J=Math.tan(B/4),K=4/3*c*J,L=4/3*d*J,M=[a,b],N=[a+K*G,b-L*F],O=[h+K*I,i-L*H],P=[h,i];if(N[0]=2*M[0]-N[0],N[1]=2*M[1]-N[1],j)return[N,O,P].concat(t);t=[N,O,P].concat(t).join().split(",");for(var Q=[],R=0,S=t.length;R<S;R++)Q[R]=R%2?u(t[R-1],t[R],s).y:u(t[R],t[R+1],s).x;return Q}function r(a,b){for(var c=[],d=0,e=a.length;e-2*!b>d;d+=2){var f=[{x:+a[d-2],y:+a[d-1]},{x:+a[d],y:+a[d+1]},{x:+a[d+2],y:+a[d+3]},{x:+a[d+4],y:+a[d+5]}];b?d?e-4===d?f[3]={x:+a[0],y:+a[1]}:e-2===d&&(f[2]={x:+a[0],y:+a[1]},f[3]={x:+a[2],y:+a[3]}):f[0]={x:+a[e-2],y:+a[e-1]}:e-4===d?f[3]=f[2]:d||(f[0]={x:+a[d],y:+a[d+1]}),c.push(["C",(-f[0].x+6*f[1].x+f[2].x)/6,(-f[0].y+6*f[1].y+f[2].y)/6,(f[1].x+6*f[2].x-f[3].x)/6,(f[1].y+6*f[2].y-f[3].y)/6,f[2].x,f[2].y])}return c}function s(a,b,c,d){return[a,b,c,d,c,d]}function t(a,b,c,d,e,f){var g=1/3,h=2/3;return[g*a+h*c,g*b+h*d,g*e+h*c,g*f+h*d,e,f]}function u(a,b,c,d,e,f,g,h,i){null==i&&(i=1),i=i>1?1:i<0?0:i;for(var j=i/2,k=12,l=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],m=0,n=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],o=0;o<k;o++){var p=j*l[o]+j,q=w(p,a,c,e,g),r=w(p,b,d,f,h),s=q*q+r*r;m+=n[o]*Math.sqrt(s)}return j*m}function v(a,b,c,d,e,f,g,h,i){if(!(i<0||u(a,b,c,d,e,f,g,h)<i)){var j,k=1,l=k/2,m=k-l,n=.01;for(j=u(a,b,c,d,e,f,g,h,m);Math.abs(j-i)>n;)l/=2,m+=(j<i?1:-1)*l,j=u(a,b,c,d,e,f,g,h,m);return m}}function w(a,b,c,d,e){return a*(a*(-3*b+9*c-9*d+3*e)+6*b-12*c+6*d)-3*b+3*c}function x(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];b=a.length;for(var c="";b--;)c+=a[b]===Object(a[b])?JSON.stringify(a[b]):a[b];return c}var y=a("../core/core"),z=a("../core/constants");y.Font=function(a){this.parent=a,this.cache={},this.font=void 0,this.name="p5.Font"},y.Font.prototype.list=function(){throw"not yet implemented"},y.Font.prototype.textBounds=function(a,b,c,d,e){b=void 0!==b?b:0,c=void 0!==c?c:0,d=d||this.parent._renderer._textSize;var f=e&&e.renderer&&e.renderer._pInst||this.parent,g=f._renderer.drawingContext,h=g.textAlign||z.LEFT,i=g.textBaseline||z.BASELINE,j=x("textBounds",a,b,c,d,h,i),k=this.cache[j];if(!k){var l,m,n,o,p,q=[],r=[],s=this._scale(d);this.font.forEachGlyph(a,b,c,d,e,function(a,b,c,d){var e=a.getMetrics();q.push(b+e.xMin*s),q.push(b+e.xMax*s),r.push(c+-e.yMin*s),r.push(c+-e.yMax*s)}),l=Math.min.apply(null,q),m=Math.min.apply(null,r),n=Math.max.apply(null,q),o=Math.max.apply(null,r),k={x:l,y:m,h:o-m,w:n-l,advance:l-b},p=this._handleAlignment(f,g,a,k.x,k.y,k.w+k.advance),k.x=p.x,k.y=p.y,this.cache[x("textBounds",a,b,c,d,h,i)]=k}return k},y.Font.prototype.textToPoints=function(a,b,c,e,g){function h(b){return k[b].name&&"space"===k[b].name||a.length===k.length&&" "===a[b]||k[b].index&&3===k[b].index}var i=0,j=[],k=this._getGlyphs(a);e=e||this.parent._renderer._textSize;for(var l=0;l<k.length;l++){if(!h(l))for(var m=k[l].getPath(b,c,e),n=f(m.commands),o=0;o<n.length;o++)for(var p=d(n[o],g),q=0;q<p.length;q++)p[q].x+=i,j.push(p[q]);i+=k[l].advanceWidth*this._scale(e)}return j},y.Font.prototype._getGlyphs=function(a){return this.font.stringToGlyphs(a)},y.Font.prototype._getPath=function(a,b,c,d){var e=d&&d.renderer&&d.renderer._pInst||this.parent,f=e._renderer.drawingContext,g=this._handleAlignment(e,f,a,b,c);return this.font.getPath(a,g.x,g.y,e._renderer._textSize,d)},y.Font.prototype._getPathData=function(a,b,c,d){var e=3;return"string"==typeof a&&arguments.length>2?a=this._getPath(a,b,c,d):"object"==typeof b&&(d=b),d&&"number"==typeof d.decimals&&(e=d.decimals),a.toPathData(e)},y.Font.prototype._getSVG=function(a,b,c,d){var e=3
;return"string"==typeof a&&arguments.length>2?a=this._getPath(a,b,c,d):"object"==typeof b&&(d=b),d&&("number"==typeof d.decimals&&(e=d.decimals),"number"==typeof d.strokeWidth&&(a.strokeWidth=d.strokeWidth),void 0!==d.fill&&(a.fill=d.fill),void 0!==d.stroke&&(a.stroke=d.stroke)),a.toSVG(e)},y.Font.prototype._renderPath=function(a,b,c,d){var e,f=d&&d.renderer||this.parent._renderer,g=f.drawingContext;e="object"==typeof a&&a.commands?a.commands:this._getPath(a,b,c,d).commands,g.beginPath();for(var h=0;h<e.length;h+=1){var i=e[h];"M"===i.type?g.moveTo(i.x,i.y):"L"===i.type?g.lineTo(i.x,i.y):"C"===i.type?g.bezierCurveTo(i.x1,i.y1,i.x2,i.y2,i.x,i.y):"Q"===i.type?g.quadraticCurveTo(i.x1,i.y1,i.x,i.y):"Z"===i.type&&g.closePath()}return f._doStroke&&f._strokeSet&&g.stroke(),f._doFill&&(f._fillSet||f._setFill(z._DEFAULT_TEXT_FILL),g.fill()),this},y.Font.prototype._textWidth=function(a,b){return this.font.getAdvanceWidth(a,b)},y.Font.prototype._textAscent=function(a){return this.font.ascender*this._scale(a)},y.Font.prototype._textDescent=function(a){return-this.font.descender*this._scale(a)},y.Font.prototype._scale=function(a){return 1/this.font.unitsPerEm*(a||this.parent._renderer._textSize)},y.Font.prototype._handleAlignment=function(a,b,c,d,e,f){var g=a._renderer._textSize,h=this._textAscent(g),i=this._textDescent(g);return f=void 0!==f?f:this._textWidth(c,g),b.textAlign===z.CENTER?d-=f/2:b.textAlign===z.RIGHT&&(d-=f),b.textBaseline===z.TOP?e+=h:b.textBaseline===z._CTX_MIDDLE?e+=h/2:b.textBaseline===z.BOTTOM&&(e-=i),{x:d,y:e}},b.exports=y},{"../core/constants":54,"../core/core":55}],93:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.append=function(a,b){return a.push(b),a},d.prototype.arrayCopy=function(a,b,c,d,e){var f,g;void 0!==e?(g=Math.min(e,a.length),f=d,a=a.slice(b,g+b)):(void 0!==c?(g=c,g=Math.min(g,a.length)):g=a.length,f=0,c=b,a=a.slice(0,g)),Array.prototype.splice.apply(c,[f,g].concat(a))},d.prototype.concat=function(a,b){return a.concat(b)},d.prototype.reverse=function(a){return a.reverse()},d.prototype.shorten=function(a){return a.pop(),a},d.prototype.shuffle=function(a,b){var c=ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(a);a=b||c?a:a.slice();for(var d,e,f=a.length;f>1;)d=Math.random()*f|0,e=a[--f],a[f]=a[d],a[d]=e;return a},d.prototype.sort=function(a,b){var c=b?a.slice(0,Math.min(b,a.length)):a,d=b?a.slice(Math.min(b,a.length)):[];return c="string"==typeof c[0]?c.sort():c.sort(function(a,b){return a-b}),c.concat(d)},d.prototype.splice=function(a,b,c){return Array.prototype.splice.apply(a,[c,0].concat(b)),a},d.prototype.subset=function(a,b,c){return void 0!==c?a.slice(b,b+c):a.slice(b,a.length)},b.exports=d},{"../core/core":55}],94:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.float=function(a){return a instanceof Array?a.map(parseFloat):parseFloat(a)},d.prototype.int=function(a,b){return b=b||10,"string"==typeof a?parseInt(a,b):"number"==typeof a?0|a:"boolean"==typeof a?a?1:0:a instanceof Array?a.map(function(a){return d.prototype.int(a,b)}):void 0},d.prototype.str=function(a){return a instanceof Array?a.map(d.prototype.str):String(a)},d.prototype.boolean=function(a){return"number"==typeof a?0!==a:"string"==typeof a?"true"===a.toLowerCase():"boolean"==typeof a?a:a instanceof Array?a.map(d.prototype.boolean):void 0},d.prototype.byte=function(a){var b=d.prototype.int(a,10);return"number"==typeof b?(b+128)%256-128:b instanceof Array?b.map(d.prototype.byte):void 0},d.prototype.char=function(a){return"number"!=typeof a||isNaN(a)?a instanceof Array?a.map(d.prototype.char):"string"==typeof a?d.prototype.char(parseInt(a,10)):void 0:String.fromCharCode(a)},d.prototype.unchar=function(a){return"string"==typeof a&&1===a.length?a.charCodeAt(0):a instanceof Array?a.map(d.prototype.unchar):void 0},d.prototype.hex=function(a,b){if(b=void 0===b||null===b?b=8:b,a instanceof Array)return a.map(function(a){return d.prototype.hex(a,b)});if("number"==typeof a){a<0&&(a=4294967295+a+1);for(var c=Number(a).toString(16).toUpperCase();c.length<b;)c="0"+c;return c.length>=b&&(c=c.substring(c.length-b,c.length)),c}},d.prototype.unhex=function(a){return a instanceof Array?a.map(d.prototype.unhex):parseInt("0x"+a,16)},b.exports=d},{"../core/core":55}],95:[function(a,b,c){"use strict";function d(){var a=arguments[0],b=a<0,c=b?a.toString().substring(1):a.toString(),d=c.indexOf("."),e=d!==-1?c.substring(0,d):c,f=d!==-1?c.substring(d+1):"",g=b?"-":"";if(3===arguments.length){var h="";(d!==-1||arguments[2]-f.length>0)&&(h="."),f.length>arguments[2]&&(f=f.substring(0,arguments[2]));for(var i=0;i<arguments[1]-e.length;i++)g+="0";g+=e,g+=h,g+=f;for(var j=0;j<arguments[2]-f.length;j++)g+="0";return g}for(var k=0;k<Math.max(arguments[1]-e.length,0);k++)g+="0";return g+=c}function e(){var a=arguments[0].toString(),b=a.indexOf("."),c=b!==-1?a.substring(b):"",d=b!==-1?a.substring(0,b):a;if(d=d.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),0===arguments[1])c="";else if(void 0!==arguments[1])if(arguments[1]>c.length){c+=b===-1?".":"";for(var e=arguments[1]-c.length+1,f=0;f<e;f++)c+="0"}else c=c.substring(0,arguments[1]+1);return d+c}function f(){return parseFloat(arguments[0])>0?"+"+arguments[0].toString():arguments[0].toString()}function g(){return parseFloat(arguments[0])>0?" "+arguments[0].toString():arguments[0].toString()}var h=a("../core/core");a("../core/error_helpers"),h.prototype.join=function(a,b){return h._validateParameters("join",arguments),a.join(b)},h.prototype.match=function(a,b){return h._validateParameters("match",arguments),a.match(b)},h.prototype.matchAll=function(a,b){h._validateParameters("matchAll",arguments);for(var c=new RegExp(b,"g"),d=c.exec(a),e=[];null!==d;)e.push(d),d=c.exec(a);return e},h.prototype.nf=function(){if(h._validateParameters("nf",arguments),arguments[0]instanceof Array){var a=arguments[1],b=arguments[2];return arguments[0].map(function(c){return d(c,a,b)})}return"[object Arguments]"===Object.prototype.toString.call(arguments[0])?3===arguments[0].length?this.nf(arguments[0][0],arguments[0][1],arguments[0][2]):2===arguments[0].length?this.nf(arguments[0][0],arguments[0][1]):this.nf(arguments[0][0]):d.apply(this,arguments)},h.prototype.nfc=function(){if(h._validateParameters("nfc",arguments),arguments[0]instanceof Array){var a=arguments[1];return arguments[0].map(function(b){return e(b,a)})}return e.apply(this,arguments)},h.prototype.nfp=function(){h._validateParameters("nfp",arguments);var a=h.prototype.nf.apply(this,arguments);return a instanceof Array?a.map(f):f(a)},h.prototype.nfs=function(){h._validateParameters("nfs",arguments);var a=h.prototype.nf.apply(this,arguments);return a instanceof Array?a.map(g):g(a)},h.prototype.split=function(a,b){return h._validateParameters("split",arguments),a.split(b)},h.prototype.splitTokens=function(){h._validateParameters("splitTokens",arguments);var a,b,c,d;return d=arguments[1],arguments.length>1?(c=/\]/g.exec(d),b=/\[/g.exec(d),b&&c?(d=d.slice(0,c.index)+d.slice(c.index+1),b=/\[/g.exec(d),d=d.slice(0,b.index)+d.slice(b.index+1),a=new RegExp("[\\["+d+"\\]]","g")):c?(d=d.slice(0,c.index)+d.slice(c.index+1),a=new RegExp("["+d+"\\]]","g")):b?(d=d.slice(0,b.index)+d.slice(b.index+1),a=new RegExp("["+d+"\\[]","g")):a=new RegExp("["+d+"]","g")):a=/\s/g,arguments[0].split(a).filter(function(a){return a})},h.prototype.trim=function(a){return h._validateParameters("trim",arguments),a instanceof Array?a.map(this.trim):a.trim()},b.exports=h},{"../core/core":55,"../core/error_helpers":58}],96:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.day=function(){return(new Date).getDate()},d.prototype.hour=function(){return(new Date).getHours()},d.prototype.minute=function(){return(new Date).getMinutes()},d.prototype.millis=function(){return window.performance.now()},d.prototype.month=function(){return(new Date).getMonth()+1},d.prototype.second=function(){return(new Date).getSeconds()},d.prototype.year=function(){return(new Date).getFullYear()},b.exports=d},{"../core/core":55}],97:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.camera=function(){return this._renderer.camera.apply(this._renderer,arguments),this},d.RendererGL.prototype.camera=function(){var a,b,c,d,e,f,g,h,i;0===arguments.length?(a=this.defaultCameraX,b=this.defaultCameraY,c=this.defaultCameraZ,d=a,e=b,f=0,g=0,h=1,i=0):(a=arguments[0],b=arguments[1],c=arguments[2],d=arguments[3],e=arguments[4],f=arguments[5],g=arguments[6],h=arguments[7],i=arguments[8]),this.cameraX=a,this.cameraY=b,this.cameraZ=c;var j=a-d,k=b-e,l=c-f;this.eyeDist=Math.sqrt(j*j+k*k+l*l),0!==this.eyeDist&&(j/=this.eyeDist,k/=this.eyeDist,l/=this.eyeDist);var m=g,n=h,o=i,p=n*l-o*k,q=-m*l+o*j,r=m*k-n*j;m=k*r-l*q,n=-j*r+l*p,o=j*q-k*p;var s=Math.sqrt(p*p+q*q+r*r);0!==s&&(p/=s,q/=s,r/=s);var t=Math.sqrt(m*m+n*n+o*o);0!==t&&(m/=t,n/=t,o/=t),this.cameraMatrix.set(p,m,j,0,q,n,k,0,r,o,l,0,0,0,0,1);var u=-a,v=-b,w=-c;return this.cameraMatrix.translate([u,v,w]),this.uMVMatrix.set(this.cameraMatrix.mat4[0],this.cameraMatrix.mat4[1],this.cameraMatrix.mat4[2],this.cameraMatrix.mat4[3],this.cameraMatrix.mat4[4],this.cameraMatrix.mat4[5],this.cameraMatrix.mat4[6],this.cameraMatrix.mat4[7],this.cameraMatrix.mat4[8],this.cameraMatrix.mat4[9],this.cameraMatrix.mat4[10],this.cameraMatrix.mat4[11],this.cameraMatrix.mat4[12],this.cameraMatrix.mat4[13],this.cameraMatrix.mat4[14],this.cameraMatrix.mat4[15]),this},d.prototype.perspective=function(){return this._renderer.perspective.apply(this._renderer,arguments),this},d.RendererGL.prototype.perspective=function(){var a=arguments[0]||this.defaultCameraFOV,b=arguments[1]||this.defaultCameraAspect,c=arguments[2]||this.defaultCameraNear,e=arguments[3]||this.defaultCameraFar;this.cameraFOV=a,this.cameraAspect=b,this.cameraNear=c,this.cameraFar=e,this.uPMatrix=d.Matrix.identity();var f=1/Math.tan(this.cameraFOV/2),g=1/(this.cameraNear-this.cameraFar);this.uPMatrix.set(f/b,0,0,0,0,-f,0,0,0,0,(e+c)*g,-1,0,0,2*e*c*g,0),this._curCamera="custom"},d.prototype.ortho=function(a,b,c,e,f,g){a=a||-this.width/2,b=b||this.width/2,c=c||-this.height/2,e=e||this.height/2,f=f||0,g=g||Math.max(this.width,this.height),this._renderer.uPMatrix=d.Matrix.identity();var h=b-a,i=e-c,j=g-f,k=2/h,l=2/i,m=-2/j,n=-(b+a)/h,o=-(e+c)/i,p=-(g+f)/j;this._renderer.uPMatrix.set(k,0,0,0,0,-l,0,0,0,0,m,0,n,o,p,1),this._renderer._curCamera="custom"},b.exports=d},{"../core/core":55}],98:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.orbitControl=function(){return this.mouseIsPressed&&(this.rotateY((this.mouseX-this.width/2)/(this.width/2)),this.rotateX((this.mouseY-this.height/2)/(this.width/2))),this},b.exports=d},{"../core/core":55}],99:[function(a,b,c){"use strict";var d=a("../core/core");d.prototype.ambientLight=function(a,b,c,d){this._renderer.curFillShader.isLightShader()||this._renderer.setFillShader(this._renderer._getLightShader());var e=this._renderer._pInst.color.apply(this._renderer._pInst,arguments),f=new Float32Array(e._array.slice(0,3));return this._renderer.curFillShader.setUniform("uAmbientColor",f),this._renderer.curFillShader.setUniform("uUseLighting",!0),this._renderer.ambientLightCount++,this._renderer.curFillShader.setUniform("uMaterialColor",this._renderer.curFillColor),this._renderer.curFillShader.setUniform("uAmbientLightCount",this._renderer.ambientLightCount),this},d.prototype.directionalLight=function(a,b,c,d,e,f){this._renderer.curFillShader.isLightShader()||this._renderer.setFillShader(this._renderer._getLightShader());var g=this._renderer._pInst.color.apply(this._renderer._pInst,[a,b,c]),h=new Float32Array(g._array.slice(0,3));this._renderer.curFillShader.setUniform("uDirectionalColor",h);for(var i,j,k,l=new Array(arguments.length),m=0;m<l.length;++m)l[m]=arguments[m];if("number"==typeof l[l.length-1])i=l[l.length-3],j=l[l.length-2],k=l[l.length-1];else try{i=l[l.length-1].x,j=l[l.length-1].y,k=l[l.length-1].z}catch(a){throw a}return this._renderer.curFillShader.setUniform("uUseLighting",!0),this._renderer.curFillShader.setUniform("uMaterialColor",this._renderer.curFillColor),this._renderer.curFillShader.setUniform("uLightingDirection",[i,j,k]),this._renderer.directionalLightCount++,this._renderer.curFillShader.setUniform("uDirectionalLightCount",this._renderer.directionalLightCount),this},d.prototype.pointLight=function(a,b,c,d,e,f,g){this._renderer.curFillShader.isLightShader()||this._renderer.setFillShader(this._renderer._getLightShader());var h=this._renderer._pInst.color.apply(this._renderer._pInst,[a,b,c]),i=new Float32Array(h._array.slice(0,3));this._renderer.curFillShader.setUniform("uPointLightColor",i);for(var j,k,l,m=new Array(arguments.length),n=0;n<m.length;++n)m[n]=arguments[n];if("number"==typeof m[m.length-1])j=m[m.length-3],k=m[m.length-2],l=m[m.length-1];else try{j=m[m.length-1].x,k=m[m.length-1].y,l=m[m.length-1].z}catch(a){throw a}return this._renderer.curFillShader.setUniform("uUseLighting",!0),this._renderer.curFillShader.setUniform("uMaterialColor",this._renderer.curFillColor),this._renderer.curFillShader.setUniform("uPointLightLocation",[j,k,l]),this._renderer.pointLightCount++,this._renderer.curFillShader.setUniform("uPointLightCount",this._renderer.pointLightCount),this},b.exports=d},{"../core/core":55}],100:[function(a,b,c){"use strict";function d(a,b){for(var c={v:[],vt:[],vn:[]},d={},f=0;f<b.length;++f){var g=b[f].trim().split(/\b\s+/);if(g.length>0)if("v"===g[0]||"vn"===g[0]){var h=new e.Vector(parseFloat(g[1]),parseFloat(g[2]),parseFloat(g[3]));c[g[0]].push(h)}else if("vt"===g[0]){var i=[parseFloat(g[1]),parseFloat(g[2])];c[g[0]].push(i)}else if("f"===g[0])for(var j=3;j<g.length;++j){for(var k=[],l=[1,j-1,j],m=0;m<l.length;++m){var n=g[l[m]],o=0;if(void 0!==d[n])o=d[n];else{for(var p=n.split("/"),q=0;q<p.length;q++)p[q]=parseInt(p[q])-1;o=d[n]=a.vertices.length,a.vertices.push(c.v[p[0]].copy()),c.vt[p[1]]?a.uvs.push(c.vt[p[1]].slice()):a.uvs.push([0,0]),c.vn[p[2]]&&a.vertexNormals.push(c.vn[p[2]].copy())}k.push(o)}a.faces.push(k)}}return 0===a.vertexNormals.length&&a.computeNormals(),a}var e=a("../core/core");a("./p5.Geometry"),e.prototype.loadModel=function(){var a,b,c,f=arguments[0];"boolean"==typeof arguments[1]?(a=arguments[1],b=arguments[2],c=arguments[3]):(a=!1,b=arguments[1],c=arguments[2]);var g=new e.Geometry;return g.gid=f+"|"+a,this.loadStrings(f,function(c){d(g,c),a&&g.normalize(),"function"==typeof b&&b(g)}.bind(this),c),g},e.prototype.model=function(a){a.vertices.length>0&&(this._renderer.geometryInHash(a.gid)||(a._makeTriangleEdges(),this._renderer._edgesToVertices(a),this._renderer.createBuffers(a.gid,a)),this._renderer.drawBuffers(a.gid))},b.exports=e},{"../core/core":55,"./p5.Geometry":102}],101:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("../core/constants");a("./p5.Texture"),d.prototype.loadShader=function(a,b){var c=new d.Shader,e=this,f=!1,g=!1;return this.loadStrings(b,function(a){c._fragSrc=a.join("\n"),f=!0,g||e._incrementPreload()}),this.loadStrings(a,function(a){c._vertSrc=a.join("\n"),g=!0,f||e._incrementPreload()}),c},d.prototype.shader=function(a){return void 0===a._renderer&&(a._renderer=this._renderer),a.isStrokeShader()?this._renderer.setStrokeShader(a):this._renderer.setFillShader(a),this},d.prototype.normalMaterial=function(){return this._renderer.drawMode=e.FILL,this._renderer.setFillShader(this._renderer._getNormalShader()),this._renderer.noStroke(),this},d.prototype.texture=function(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];return this._renderer.GL.depthMask(!0),this._renderer.GL.enable(this._renderer.GL.BLEND),this._renderer.GL.blendFunc(this._renderer.GL.SRC_ALPHA,this._renderer.GL.ONE_MINUS_SRC_ALPHA),this._renderer.drawMode=e.TEXTURE,this._renderer.curFillShader.isTextureShader()||this._renderer.setFillShader(this._renderer._getLightShader()),this._renderer.curFillShader.setUniform("uSpecular",!1),this._renderer.curFillShader.setUniform("isTexture",!0),this._renderer.curFillShader.setUniform("uSampler",a[0]),this._renderer.noStroke(),this},d.prototype.ambientMaterial=function(a,b,c,d){this._renderer.curFillShader.isLightShader()||this._renderer.setFillShader(this._renderer._getLightShader());var e=this._renderer._applyColorBlend.apply(this._renderer,arguments);return this._renderer.curFillShader.setUniform("uMaterialColor",e),this._renderer.curFillShader.setUniform("uSpecular",!1),this._renderer.curFillShader.setUniform("isTexture",!1),this},d.prototype.specularMaterial=function(a,b,c,d){this._renderer.curFillShader.isLightShader()||this._renderer.setFillShader(this._renderer._getLightShader());var e=this._renderer._applyColorBlend.apply(this._renderer,arguments);return this._renderer.curFillShader.setUniform("uMaterialColor",e),this._renderer.curFillShader.setUniform("uSpecular",!0),this._renderer.curFillShader.setUniform("isTexture",!1),this},d.RendererGL.prototype._applyColorBlend=function(a,b,c,d){var e=this.GL,f=this._pInst.color.apply(this._pInst,arguments),g=f._array;return g[g.length-1]<1?(e.depthMask(!1),e.enable(e.BLEND),e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA)):(e.depthMask(!0),e.disable(e.BLEND)),g},b.exports=d},{"../core/constants":54,"../core/core":55,"./p5.Texture":108}],102:[function(a,b,c){"use strict";var d=a("../core/core");d.Geometry=function(a,b,c){return this.vertices=[],this.lineVertices=[],this.lineNormals=[],this.vertexNormals=[],this.faces=[],this.uvs=[],this.edges=[],this.detailX=void 0!==a?a:1,this.detailY=void 0!==b?b:1,c instanceof Function&&c.call(this),this.name="p5.Geometry",this},d.Geometry.prototype.computeFaces=function(){for(var a,b,c,d,e=this.detailX+1,f=0;f<this.detailY;f++)for(var g=0;g<this.detailX;g++)a=f*e+g,b=f*e+g+1,c=(f+1)*e+g+1,d=(f+1)*e+g,this.faces.push([a,b,d]),this.faces.push([d,b,c]);return this},d.Geometry.prototype._getFaceNormal=function(a,b){var c=this.faces[a],e=this.vertices[c[b%3]],f=this.vertices[c[(b+1)%3]],g=this.vertices[c[(b+2)%3]],h=d.Vector.cross(d.Vector.sub(f,e),d.Vector.sub(g,e)),i=d.Vector.mag(h)/(d.Vector.mag(d.Vector.sub(f,e))*d.Vector.mag(d.Vector.sub(g,e)));return h=h.normalize(),h.mult(Math.asin(i))},d.Geometry.prototype.computeNormals=function(){for(var a=0;a<this.vertices.length;a++){for(var b=new d.Vector,c=0;c<this.faces.length;c++)this.faces[c][0]!==a&&this.faces[c][1]!==a&&this.faces[c][2]!==a||(b=b.add(this._getFaceNormal(c,a)));b=b.normalize(),this.vertexNormals.push(b)}return this},d.Geometry.prototype.averageNormals=function(){for(var a=0;a<=this.detailY;a++){var b=this.detailX+1,c=d.Vector.add(this.vertexNormals[a*b],this.vertexNormals[a*b+this.detailX]);c=d.Vector.div(c,2),this.vertexNormals[a*b]=c,this.vertexNormals[a*b+this.detailX]=c}return this},d.Geometry.prototype.averagePoleNormals=function(){for(var a=new d.Vector(0,0,0),b=0;b<this.detailX;b++)a.add(this.vertexNormals[b]);for(a=d.Vector.div(a,this.detailX),b=0;b<this.detailX;b++)this.vertexNormals[b]=a;for(a=new d.Vector(0,0,0),b=this.vertices.length-1;b>this.vertices.length-1-this.detailX;b--)a.add(this.vertexNormals[b]);for(a=d.Vector.div(a,this.detailX),b=this.vertices.length-1;b>this.vertices.length-1-this.detailX;b--)this.vertexNormals[b]=a;return this},d.Geometry.prototype._makeTriangleEdges=function(){if(Array.isArray(this.strokeIndices))for(var a=0,b=this.strokeIndices.length;a<b;a++)this.edges.push(this.strokeIndices[a]);else for(var c=0;c<this.faces.length;c++)this.edges.push([this.faces[c][0],this.faces[c][1]]),this.edges.push([this.faces[c][1],this.faces[c][2]]),this.edges.push([this.faces[c][2],this.faces[c][0]]);return this},d.RendererGL.prototype._edgesToVertices=function(a){a.lineVertices=[];for(var b=0;b<a.edges.length;b++){var c=a.vertices[a.edges[b][0]],d=a.vertices[a.edges[b][1]],e=d.copy().sub(c).normalize(),f=c.array(),g=c.array(),h=d.array(),i=d.array(),j=e.array(),k=e.array();j.push(1),k.push(-1),a.lineNormals.push(j,k,j,j,k,k),a.lineVertices.push(f,g,h,h,g,i)}},d.Geometry.prototype.normalize=function(){if(this.vertices.length>0){for(var a=this.vertices[0].copy(),b=this.vertices[0].copy(),c=0;c<this.vertices.length;c++)a.x=Math.max(a.x,this.vertices[c].x),b.x=Math.min(b.x,this.vertices[c].x),a.y=Math.max(a.y,this.vertices[c].y),b.y=Math.min(b.y,this.vertices[c].y),a.z=Math.max(a.z,this.vertices[c].z),b.z=Math.min(b.z,this.vertices[c].z);var e=d.Vector.lerp(a,b,.5),f=d.Vector.sub(a,b),g=Math.max(Math.max(f.x,f.y),f.z),h=200/g;for(c=0;c<this.vertices.length;c++)this.vertices[c].sub(e),this.vertices[c].mult(h)}return this},b.exports=d.Geometry},{"../core/core":55}],103:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("../math/polargeometry"),f=a("../core/constants"),g="undefined"!=typeof Float32Array?Float32Array:Array;d.Matrix=function(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];return a[0]instanceof d?(this.p5=a[0],"mat3"===a[1]?this.mat3=a[2]||new g([1,0,0,0,1,0,0,0,1]):this.mat4=a[1]||new g([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])):"mat3"===a[0]?this.mat3=a[1]||new g([1,0,0,0,1,0,0,0,1]):this.mat4=a[0]||new g([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this.name="p5.Matrix",this},d.Matrix.prototype.set=function(a){return a instanceof d.Matrix?(this.mat4=a.mat4,this):a instanceof g?(this.mat4=a,this):(16===arguments.length&&(this.mat4[0]=arguments[0],this.mat4[1]=arguments[1],this.mat4[2]=arguments[2],this.mat4[3]=arguments[3],this.mat4[4]=arguments[4],this.mat4[5]=arguments[5],this.mat4[6]=arguments[6],this.mat4[7]=arguments[7],this.mat4[8]=arguments[8],this.mat4[9]=arguments[9],this.mat4[10]=arguments[10],this.mat4[11]=arguments[11],this.mat4[12]=arguments[12],this.mat4[13]=arguments[13],this.mat4[14]=arguments[14],this.mat4[15]=arguments[15]),this)},d.Matrix.prototype.get=function(){return new d.Matrix(this.mat4)},d.Matrix.prototype.copy=function(){var a=new d.Matrix;return a.mat4[0]=this.mat4[0],a.mat4[1]=this.mat4[1],a.mat4[2]=this.mat4[2],a.mat4[3]=this.mat4[3],a.mat4[4]=this.mat4[4],a.mat4[5]=this.mat4[5],a.mat4[6]=this.mat4[6],a.mat4[7]=this.mat4[7],a.mat4[8]=this.mat4[8],a.mat4[9]=this.mat4[9],a.mat4[10]=this.mat4[10],a.mat4[11]=this.mat4[11],a.mat4[12]=this.mat4[12],a.mat4[13]=this.mat4[13],a.mat4[14]=this.mat4[14],a.mat4[15]=this.mat4[15],a},d.Matrix.identity=function(){return new d.Matrix},d.Matrix.prototype.transpose=function(a){var b,c,e,f,h,i;return a instanceof d.Matrix?(b=a.mat4[1],c=a.mat4[2],e=a.mat4[3],f=a.mat4[6],h=a.mat4[7],i=a.mat4[11],this.mat4[0]=a.mat4[0],this.mat4[1]=a.mat4[4],this.mat4[2]=a.mat4[8],this.mat4[3]=a.mat4[12],this.mat4[4]=b,this.mat4[5]=a.mat4[5],this.mat4[6]=a.mat4[9],this.mat4[7]=a.mat4[13],this.mat4[8]=c,this.mat4[9]=f,this.mat4[10]=a.mat4[10],this.mat4[11]=a.mat4[14],this.mat4[12]=e,this.mat4[13]=h,this.mat4[14]=i,this.mat4[15]=a.mat4[15]):a instanceof g&&(b=a[1],c=a[2],e=a[3],f=a[6],h=a[7],i=a[11],this.mat4[0]=a[0],this.mat4[1]=a[4],this.mat4[2]=a[8],this.mat4[3]=a[12],this.mat4[4]=b,this.mat4[5]=a[5],this.mat4[6]=a[9],this.mat4[7]=a[13],this.mat4[8]=c,this.mat4[9]=f,this.mat4[10]=a[10],this.mat4[11]=a[14],this.mat4[12]=e,this.mat4[13]=h,this.mat4[14]=i,this.mat4[15]=a[15]),this},d.Matrix.prototype.invert=function(a){var b,c,e,f,h,i,j,k,l,m,n,o,p,q,r,s;a instanceof d.Matrix?(b=a.mat4[0],c=a.mat4[1],e=a.mat4[2],f=a.mat4[3],h=a.mat4[4],i=a.mat4[5],j=a.mat4[6],k=a.mat4[7],l=a.mat4[8],m=a.mat4[9],n=a.mat4[10],o=a.mat4[11],p=a.mat4[12],q=a.mat4[13],r=a.mat4[14],s=a.mat4[15]):a instanceof g&&(b=a[0],c=a[1],e=a[2],f=a[3],h=a[4],i=a[5],j=a[6],k=a[7],l=a[8],m=a[9],n=a[10],o=a[11],p=a[12],q=a[13],r=a[14],s=a[15]);var t=b*i-c*h,u=b*j-e*h,v=b*k-f*h,w=c*j-e*i,x=c*k-f*i,y=e*k-f*j,z=l*q-m*p,A=l*r-n*p,B=l*s-o*p,C=m*r-n*q,D=m*s-o*q,E=n*s-o*r,F=t*E-u*D+v*C+w*B-x*A+y*z;return F?(F=1/F,this.mat4[0]=(i*E-j*D+k*C)*F,this.mat4[1]=(e*D-c*E-f*C)*F,this.mat4[2]=(q*y-r*x+s*w)*F,this.mat4[3]=(n*x-m*y-o*w)*F,this.mat4[4]=(j*B-h*E-k*A)*F,this.mat4[5]=(b*E-e*B+f*A)*F,this.mat4[6]=(r*v-p*y-s*u)*F,this.mat4[7]=(l*y-n*v+o*u)*F,this.mat4[8]=(h*D-i*B+k*z)*F,this.mat4[9]=(c*B-b*D-f*z)*F,this.mat4[10]=(p*x-q*v+s*t)*F,this.mat4[11]=(m*v-l*x-o*t)*F,this.mat4[12]=(i*A-h*C-j*z)*F,this.mat4[13]=(b*C-c*A+e*z)*F,this.mat4[14]=(q*u-p*w-r*t)*F,this.mat4[15]=(l*w-m*u+n*t)*F,this):null},d.Matrix.prototype.invert3x3=function(){var a=this.mat3[0],b=this.mat3[1],c=this.mat3[2],d=this.mat3[3],e=this.mat3[4],f=this.mat3[5],g=this.mat3[6],h=this.mat3[7],i=this.mat3[8],j=i*e-f*h,k=-i*d+f*g,l=h*d-e*g,m=a*j+b*k+c*l;return m?(m=1/m,this.mat3[0]=j*m,this.mat3[1]=(-i*b+c*h)*m,this.mat3[2]=(f*b-c*e)*m,this.mat3[3]=k*m,this.mat3[4]=(i*a-c*g)*m,this.mat3[5]=(-f*a+c*d)*m,this.mat3[6]=l*m,this.mat3[7]=(-h*a+b*g)*m,this.mat3[8]=(e*a-b*d)*m,this):null},d.Matrix.prototype.transpose3x3=function(a){var b=a[1],c=a[2],d=a[5];return this.mat3[1]=a[3],this.mat3[2]=a[6],this.mat3[3]=b,this.mat3[5]=a[7],this.mat3[6]=c,this.mat3[7]=d,this},d.Matrix.prototype.inverseTranspose=function(a){return void 0===this.mat3?console.error("sorry, this function only works with mat3"):(this.mat3[0]=a.mat4[0],this.mat3[1]=a.mat4[1],this.mat3[2]=a.mat4[2],this.mat3[3]=a.mat4[4],this.mat3[4]=a.mat4[5],this.mat3[5]=a.mat4[6],this.mat3[6]=a.mat4[8],this.mat3[7]=a.mat4[9],this.mat3[8]=a.mat4[10]),this.invert3x3().transpose3x3(this.mat3),this},d.Matrix.prototype.determinant=function(){var a=this.mat4[0]*this.mat4[5]-this.mat4[1]*this.mat4[4],b=this.mat4[0]*this.mat4[6]-this.mat4[2]*this.mat4[4],c=this.mat4[0]*this.mat4[7]-this.mat4[3]*this.mat4[4],d=this.mat4[1]*this.mat4[6]-this.mat4[2]*this.mat4[5],e=this.mat4[1]*this.mat4[7]-this.mat4[3]*this.mat4[5],f=this.mat4[2]*this.mat4[7]-this.mat4[3]*this.mat4[6],g=this.mat4[8]*this.mat4[13]-this.mat4[9]*this.mat4[12],h=this.mat4[8]*this.mat4[14]-this.mat4[10]*this.mat4[12],i=this.mat4[8]*this.mat4[15]-this.mat4[11]*this.mat4[12],j=this.mat4[9]*this.mat4[14]-this.mat4[10]*this.mat4[13],k=this.mat4[9]*this.mat4[15]-this.mat4[11]*this.mat4[13];return a*(this.mat4[10]*this.mat4[15]-this.mat4[11]*this.mat4[14])-b*k+c*j+d*i-e*h+f*g},d.Matrix.prototype.mult=function(a){var b=new g(16),c=new g(16);a instanceof d.Matrix?c=a.mat4:a instanceof g&&(c=a);var e=this.mat4[0],f=this.mat4[1],h=this.mat4[2],i=this.mat4[3];return b[0]=e*c[0]+f*c[4]+h*c[8]+i*c[12],b[1]=e*c[1]+f*c[5]+h*c[9]+i*c[13],b[2]=e*c[2]+f*c[6]+h*c[10]+i*c[14],b[3]=e*c[3]+f*c[7]+h*c[11]+i*c[15],e=this.mat4[4],f=this.mat4[5],h=this.mat4[6],i=this.mat4[7],b[4]=e*c[0]+f*c[4]+h*c[8]+i*c[12],b[5]=e*c[1]+f*c[5]+h*c[9]+i*c[13],b[6]=e*c[2]+f*c[6]+h*c[10]+i*c[14],b[7]=e*c[3]+f*c[7]+h*c[11]+i*c[15],e=this.mat4[8],f=this.mat4[9],h=this.mat4[10],i=this.mat4[11],b[8]=e*c[0]+f*c[4]+h*c[8]+i*c[12],b[9]=e*c[1]+f*c[5]+h*c[9]+i*c[13],b[10]=e*c[2]+f*c[6]+h*c[10]+i*c[14],b[11]=e*c[3]+f*c[7]+h*c[11]+i*c[15],e=this.mat4[12],f=this.mat4[13],h=this.mat4[14],i=this.mat4[15],b[12]=e*c[0]+f*c[4]+h*c[8]+i*c[12],b[13]=e*c[1]+f*c[5]+h*c[9]+i*c[13],b[14]=e*c[2]+f*c[6]+h*c[10]+i*c[14],b[15]=e*c[3]+f*c[7]+h*c[11]+i*c[15],this.mat4=b,this},d.Matrix.prototype.scale=function(){for(var a,b,c,e=new Array(arguments.length),f=0;f<e.length;++f)e[f]=arguments[f];e[0]instanceof d.Vector?(a=e[0].x,b=e[0].y,c=e[0].z):e[0]instanceof Array&&(a=e[0][0],b=e[0][1],c=e[0][2]);var h=new g(16);return h[0]=this.mat4[0]*a,h[1]=this.mat4[1]*a,h[2]=this.mat4[2]*a,h[3]=this.mat4[3]*a,h[4]=this.mat4[4]*b,h[5]=this.mat4[5]*b,h[6]=this.mat4[6]*b,h[7]=this.mat4[7]*b,h[8]=this.mat4[8]*c,h[9]=this.mat4[9]*c,h[10]=this.mat4[10]*c,h[11]=this.mat4[11]*c,h[12]=this.mat4[12],h[13]=this.mat4[13],h[14]=this.mat4[14],h[15]=this.mat4[15],this.mat4=h,this},d.Matrix.prototype.rotate=function(a,b){var c,g,h,i,j;this.p5?this.p5._angleMode===f.DEGREES&&(i=e.degreesToRadians(a)):i=a,b instanceof d.Vector?(c=b.x,g=b.y,h=b.z):b instanceof Array&&(c=b[0],g=b[1],h=b[2]),j=Math.sqrt(c*c+g*g+h*h),c*=1/j,g*=1/j,h*=1/j;var k=this.mat4[0],l=this.mat4[1],m=this.mat4[2],n=this.mat4[3],o=this.mat4[4],p=this.mat4[5],q=this.mat4[6],r=this.mat4[7],s=this.mat4[8],t=this.mat4[9],u=this.mat4[10],v=this.mat4[11],w=Math.sin(i),x=Math.cos(i),y=1-x,z=c*c*y+x,A=g*c*y+h*w,B=h*c*y-g*w,C=c*g*y-h*w,D=g*g*y+x,E=h*g*y+c*w,F=c*h*y+g*w,G=g*h*y-c*w,H=h*h*y+x;return this.mat4[0]=k*z+o*A+s*B,this.mat4[1]=l*z+p*A+t*B,this.mat4[2]=m*z+q*A+u*B,this.mat4[3]=n*z+r*A+v*B,this.mat4[4]=k*C+o*D+s*E,this.mat4[5]=l*C+p*D+t*E,this.mat4[6]=m*C+q*D+u*E,this.mat4[7]=n*C+r*D+v*E,this.mat4[8]=k*F+o*G+s*H,this.mat4[9]=l*F+p*G+t*H,this.mat4[10]=m*F+q*G+u*H,this.mat4[11]=n*F+r*G+v*H,this},d.Matrix.prototype.translate=function(a){var b=a[0],c=a[1],d=a[2]||0;this.mat4[12]+=this.mat4[0]*b+this.mat4[4]*c+this.mat4[8]*d,this.mat4[13]+=this.mat4[1]*b+this.mat4[5]*c+this.mat4[9]*d,this.mat4[14]+=this.mat4[2]*b+this.mat4[6]*c+this.mat4[10]*d,this.mat4[15]+=this.mat4[3]*b+this.mat4[7]*c+this.mat4[11]*d},d.Matrix.prototype.rotateX=function(a){this.rotate(a,[1,0,0])},d.Matrix.prototype.rotateY=function(a){this.rotate(a,[0,1,0])},d.Matrix.prototype.rotateZ=function(a){this.rotate(a,[0,0,1])},d.Matrix.prototype.perspective=function(a,b,c,d){var e=1/Math.tan(a/2),f=1/(c-d);return this.mat4[0]=e/b,this.mat4[1]=0,this.mat4[2]=0,this.mat4[3]=0,this.mat4[4]=0,this.mat4[5]=e,this.mat4[6]=0,this.mat4[7]=0,this.mat4[8]=0,this.mat4[9]=0,this.mat4[10]=(d+c)*f,this.mat4[11]=-1,this.mat4[12]=0,this.mat4[13]=0,this.mat4[14]=2*d*c*f,this.mat4[15]=0,this},d.Matrix.prototype.ortho=function(a,b,c,d,e,f){var g=1/(a-b),h=1/(c-d),i=1/(e-f);return this.mat4[0]=-2*g,this.mat4[1]=0,this.mat4[2]=0,this.mat4[3]=0,this.mat4[4]=0,this.mat4[5]=-2*h,this.mat4[6]=0,this.mat4[7]=0,this.mat4[8]=0,this.mat4[9]=0,this.mat4[10]=2*i,this.mat4[11]=0,this.mat4[12]=(a+b)*g,this.mat4[13]=(d+c)*h,this.mat4[14]=(f+e)*i,this.mat4[15]=1,this},b.exports=d.Matrix},{"../core/constants":54,"../core/core":55,"../math/polargeometry":87}],104:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("../core/constants");d.RendererGL.prototype.beginShape=function(a){return this.immediateMode.shapeMode=void 0!==a?a:e.LINE_STRIP,void 0===this.immediateMode.vertices?(this.immediateMode.vertices=[],this.immediateMode.edges=[],this.immediateMode.lineVertices=[],this.immediateMode.vertexColors=[],this.immediateMode.lineNormals=[],this.immediateMode.uvCoords=[],this.immediateMode.vertexBuffer=this.GL.createBuffer(),this.immediateMode.colorBuffer=this.GL.createBuffer(),this.immediateMode.uvBuffer=this.GL.createBuffer(),this.immediateMode.lineVertexBuffer=this.GL.createBuffer(),this.immediateMode.lineNormalBuffer=this.GL.createBuffer()):(this.immediateMode.vertices.length=0,this.immediateMode.edges.length=0,this.immediateMode.lineVertices.length=0,this.immediateMode.lineNormals.length=0,this.immediateMode.vertexColors.length=0,this.immediateMode.uvCoords.length=0),this.isImmediateDrawing=!0,this},d.RendererGL.prototype.vertex=function(){var a,b,c,e,f;a=arguments[0],b=arguments[1],c=e=f=0,3===arguments.length?c=arguments[2]:4===arguments.length?(e=arguments[2],f=arguments[3]):5===arguments.length&&(c=arguments[2],e=arguments[3],f=arguments[4]);var g=new d.Vector(a,b,c);this.immediateMode.vertices.push(g);var h=this.curFillColor||[.5,.5,.5,1];return this.immediateMode.vertexColors.push(h[0],h[1],h[2],h[3]),this.immediateMode.uvCoords.push(e,f),this},d.RendererGL.prototype.endShape=function(a,b,c,d,e,f){if(this.curFillShader===this._getColorShader()&&this.setFillShader(this._getImmediateModeShader()),this.curStrokeShader.active===!0){for(var g=0;g<this.immediateMode.vertices.length;g++)g+1<this.immediateMode.vertices.length?this.immediateMode.edges.push([g,g+1]):this.immediateMode.edges.push([g,0]);this._edgesToVertices(this.immediateMode),this._drawStrokeImmediateMode()}return this.curFillShader.active===!0&&this._drawFillImmediateMode(a,b,c,d,e,f),this.immediateMode.vertices.length=0,this.immediateMode.vertexColors.length=0,this.immediateMode.uvCoords.length=0,this.isImmediateDrawing=!1,this},d.RendererGL.prototype._drawFillImmediateMode=function(a,b,c,d,f,g){var h=this.GL;if(this.curFillShader.bindShader(),
this._bindBuffer(this.immediateMode.vertexBuffer,h.ARRAY_BUFFER,this._vToNArray(this.immediateMode.vertices),Float32Array,h.DYNAMIC_DRAW),this.curFillShader.enableAttrib(this.curFillShader.attributes.aPosition.location,3,h.FLOAT,!1,0,0),this.drawMode===e.FILL&&(this._bindBuffer(this.immediateMode.colorBuffer,h.ARRAY_BUFFER,this.immediateMode.vertexColors,Float32Array,h.DYNAMIC_DRAW),this.curFillShader.enableAttrib(this.curFillShader.attributes.aVertexColor.location,4,h.FLOAT,!1,0,0)),this.drawMode===e.TEXTURE&&(this._bindBuffer(this.immediateMode.uvBuffer,h.ARRAY_BUFFER,this.immediateMode.uvCoords,Float32Array,h.DYNAMIC_DRAW),this.curFillShader.enableAttrib(this.curFillShader.attributes.aTexCoord.location,2,h.FLOAT,!1,0,0)),a)if(this.drawMode===e.FILL||this.drawMode===e.TEXTURE)switch(this.immediateMode.shapeMode){case e.LINE_STRIP:this.immediateMode.shapeMode=e.TRIANGLE_FAN;break;case e.LINES:this.immediateMode.shapeMode=e.TRIANGLE_FAN;break;case e.TRIANGLES:this.immediateMode.shapeMode=e.TRIANGLE_FAN}else switch(this.immediateMode.shapeMode){case e.LINE_STRIP:this.immediateMode.shapeMode=e.LINE_LOOP;break;case e.LINES:this.immediateMode.shapeMode=e.LINE_LOOP}if(this.immediateMode.shapeMode===e.QUADS||this.immediateMode.shapeMode===e.QUAD_STRIP)throw new Error("sorry, "+this.immediateMode.shapeMode+" not yet implemented in webgl mode.");h.enable(h.BLEND),h.drawArrays(this.immediateMode.shapeMode,0,this.immediateMode.vertices.length),this.curFillShader.unbindShader()},d.RendererGL.prototype._drawStrokeImmediateMode=function(){var a=this.GL;this.curStrokeShader.bindShader(),this._bindBuffer(this.immediateMode.lineVertexBuffer,a.ARRAY_BUFFER,this._flatten(this.immediateMode.lineVertices),Float32Array,a.STATIC_DRAW),this.curStrokeShader.enableAttrib(this.curStrokeShader.attributes.aPosition.location,3,a.FLOAT,!1,0,0),this._bindBuffer(this.immediateMode.lineNormalBuffer,a.ARRAY_BUFFER,this._flatten(this.immediateMode.lineNormals),Float32Array,a.STATIC_DRAW),this.curStrokeShader.enableAttrib(this.curStrokeShader.attributes.aDirection.location,4,a.FLOAT,!1,0,0),a.drawArrays(a.TRIANGLES,0,this.immediateMode.lineVertices.length),this.curStrokeShader.unbindShader()},b.exports=d.RendererGL},{"../core/constants":54,"../core/core":55}],105:[function(a,b,c){"use strict";var d=a("../core/core"),e=0;d.RendererGL.prototype._initBufferDefaults=function(a){if(++e>1e3){var b=Object.keys(this.gHash)[0];delete this.gHash[b],e--}var c=this.GL;this.gHash[a]={},this.gHash[a].vertexBuffer=c.createBuffer(),this.gHash[a].normalBuffer=c.createBuffer(),this.gHash[a].lineNormalBuffer=c.createBuffer(),this.gHash[a].uvBuffer=c.createBuffer(),this.gHash[a].indexBuffer=c.createBuffer(),this.gHash[a].lineVertexBuffer=c.createBuffer()},d.RendererGL.prototype.createBuffers=function(a,b){var c=this.GL;this._setDefaultCamera(),this._initBufferDefaults(a),this.gHash[a].numberOfItems=3*b.faces.length,this.gHash[a].lineVertexCount=b.lineVertices.length,this.curFillShader===this._getImmediateModeShader()&&this.setFillShader(this._getColorShader()),this._bindBuffer(this.gHash[a].lineVertexBuffer,c.ARRAY_BUFFER,this._flatten(b.lineVertices),Float32Array,c.STATIC_DRAW),this.curStrokeShader.enableAttrib(this.curStrokeShader.attributes.aPosition.location,3,c.FLOAT,!1,0,0),this._bindBuffer(this.gHash[a].lineNormalBuffer,c.ARRAY_BUFFER,this._flatten(b.lineNormals),Float32Array,c.STATIC_DRAW),this.curStrokeShader.enableAttrib(this.curStrokeShader.attributes.aDirection.location,4,c.FLOAT,!1,0,0),this._bindBuffer(this.gHash[a].vertexBuffer,c.ARRAY_BUFFER,this._vToNArray(b.vertices),Float32Array,c.STATIC_DRAW),this.curFillShader.enableAttrib(this.curFillShader.attributes.aPosition.location,3,c.FLOAT,!1,0,0),this._bindBuffer(this.gHash[a].indexBuffer,c.ELEMENT_ARRAY_BUFFER,this._flatten(b.faces),Uint16Array,c.STATIC_DRAW),this._bindBuffer(this.gHash[a].normalBuffer,c.ARRAY_BUFFER,this._vToNArray(b.vertexNormals),Float32Array,c.STATIC_DRAW),this.curFillShader.enableAttrib(this.curFillShader.attributes.aNormal.location,3,c.FLOAT,!1,0,0),this._bindBuffer(this.gHash[a].uvBuffer,c.ARRAY_BUFFER,this._flatten(b.uvs),Float32Array,c.STATIC_DRAW),this.curFillShader.enableAttrib(this.curFillShader.attributes.aTexCoord.location,2,c.FLOAT,!1,0,0)},d.RendererGL.prototype.drawBuffers=function(a){this._setDefaultCamera();var b=this.GL;return this.curFillShader===this._getImmediateModeShader()&&this.setFillShader(this._getColorShader()),this.curStrokeShader.active!==!1&&this.gHash[a].lineVertexCount>0&&(this.curStrokeShader.bindShader(),this._bindBuffer(this.gHash[a].lineVertexBuffer,b.ARRAY_BUFFER),this.curStrokeShader.enableAttrib(this.curStrokeShader.attributes.aPosition.location,3,b.FLOAT,!1,0,0),this._bindBuffer(this.gHash[a].lineNormalBuffer,b.ARRAY_BUFFER),this.curStrokeShader.enableAttrib(this.curStrokeShader.attributes.aDirection.location,4,b.FLOAT,!1,0,0),this._drawArrays(b.TRIANGLES,a),this.curStrokeShader.unbindShader()),this.curFillShader.active!==!1&&(this.curFillShader.bindShader(),this._bindBuffer(this.gHash[a].vertexBuffer,b.ARRAY_BUFFER),this.curFillShader.enableAttrib(this.curFillShader.attributes.aPosition.location,3,b.FLOAT,!1,0,0),this._bindBuffer(this.gHash[a].indexBuffer,b.ELEMENT_ARRAY_BUFFER),this._bindBuffer(this.gHash[a].normalBuffer,b.ARRAY_BUFFER),this.curFillShader.enableAttrib(this.curFillShader.attributes.aNormal.location,3,b.FLOAT,!1,0,0),this._bindBuffer(this.gHash[a].uvBuffer,b.ARRAY_BUFFER),this.curFillShader.enableAttrib(this.curFillShader.attributes.aTexCoord.location,2,b.FLOAT,!1,0,0),this._drawElements(b.TRIANGLES,a),this.curFillShader.unbindShader()),this},d.RendererGL.prototype._drawArrays=function(a,b){return this.GL.drawArrays(a,0,this.gHash[b].lineVertexCount),this},d.RendererGL.prototype._drawElements=function(a,b){this.GL.drawElements(a,this.gHash[b].numberOfItems,this.GL.UNSIGNED_SHORT,0)},b.exports=d.RendererGL},{"../core/core":55}],106:[function(a,b,c){"use strict";var d=a("../core/core"),e=a("../core/constants");a("./p5.Shader"),a("../core/p5.Renderer"),a("./p5.Matrix");var f=[],g=[],h={immediateVert:"attribute vec3 aPosition;\nattribute vec4 aVertexColor;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform float uResolution;\nuniform float uPointSize;\n\nvarying vec4 vColor;\nvoid main(void) {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vColor = aVertexColor;\n gl_PointSize = uPointSize;\n}\n",vertexColorVert:"attribute vec3 aPosition;\nattribute vec4 aVertexColor;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vColor = aVertexColor;\n}\n",vertexColorFrag:"precision mediump float;\nvarying vec4 vColor;\nvoid main(void) {\n gl_FragColor = vColor;\n}",normalVert:"attribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\n\nvarying vec3 vVertexNormal;\nvarying highp vec2 vVertTexCoord;\n\nvoid main(void) {\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n vVertexNormal = vec3( uNormalMatrix * aNormal );\n vVertTexCoord = aTexCoord;\n}\n",normalFrag:"precision mediump float;\nvarying vec3 vVertexNormal;\nvoid main(void) {\n gl_FragColor = vec4(vVertexNormal, 1.0);\n}",basicFrag:"precision mediump float;\nvarying vec3 vVertexNormal;\nuniform vec4 uMaterialColor;\nvoid main(void) {\n gl_FragColor = uMaterialColor;\n}",lightVert:"attribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\nuniform int uAmbientLightCount;\nuniform int uDirectionalLightCount;\nuniform int uPointLightCount;\n\nuniform vec3 uAmbientColor[8];\nuniform vec3 uLightingDirection[8];\nuniform vec3 uDirectionalColor[8];\nuniform vec3 uPointLightLocation[8];\nuniform vec3 uPointLightColor[8];\nuniform bool uSpecular;\n\nvarying vec3 vVertexNormal;\nvarying vec2 vVertTexCoord;\nvarying vec3 vLightWeighting;\n\nvec3 ambientLightFactor = vec3(0.0, 0.0, 0.0);\nvec3 directionalLightFactor = vec3(0.0, 0.0, 0.0);\nvec3 pointLightFactor = vec3(0.0, 0.0, 0.0);\nvec3 pointLightFactor2 = vec3(0.0, 0.0, 0.0);\n\nvoid main(void){\n\n vec4 positionVec4 = vec4(aPosition, 1.0);\n gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n\n vec3 vertexNormal = vec3( uNormalMatrix * aNormal );\n vVertexNormal = vertexNormal;\n vVertTexCoord = aTexCoord;\n\n vec4 mvPosition = uModelViewMatrix * vec4(aPosition, 1.0);\n vec3 eyeDirection = normalize(-mvPosition.xyz);\n\n float shininess = 32.0;\n float specularFactor = 2.0;\n float diffuseFactor = 0.3;\n\n for(int i = 0; i < 8; i++){\n if(uAmbientLightCount == i) break;\n ambientLightFactor += uAmbientColor[i];\n }\n\n for(int j = 0; j < 8; j++){\n if(uDirectionalLightCount == j) break;\n vec3 dir = uLightingDirection[j];\n float directionalLightWeighting = max(dot(vertexNormal, dir), 0.0);\n directionalLightFactor += uDirectionalColor[j] * directionalLightWeighting;\n }\n\n for(int k = 0; k < 8; k++){\n if(uPointLightCount == k) break;\n vec3 loc = uPointLightLocation[k];\n vec3 lightDirection = normalize(loc - mvPosition.xyz);\n\n float directionalLightWeighting = max(dot(vertexNormal, lightDirection), 0.0);\n pointLightFactor += uPointLightColor[k] * directionalLightWeighting;\n\n //factor2 for specular\n vec3 reflectionDirection = reflect(-lightDirection, vertexNormal);\n float specularLightWeighting = pow(max(dot(reflectionDirection, eyeDirection), 0.0), shininess);\n\n pointLightFactor2 += uPointLightColor[k] * (specularFactor * specularLightWeighting\n + directionalLightWeighting * diffuseFactor);\n }\n\n if(!uSpecular){\n vLightWeighting = ambientLightFactor + directionalLightFactor + pointLightFactor;\n }else{\n vLightWeighting = ambientLightFactor + directionalLightFactor + pointLightFactor2;\n }\n\n}\n",lightTextureFrag:"precision mediump float;\n\nuniform vec4 uMaterialColor;\nuniform sampler2D uSampler;\nuniform bool isTexture;\nuniform bool uUseLighting;\n\nvarying vec3 vLightWeighting;\nvarying highp vec2 vVertTexCoord;\n\nvoid main(void) {\n if(!isTexture){\n gl_FragColor = vec4(vec3(uMaterialColor.rgb * vLightWeighting), uMaterialColor.a);\n }else{\n vec4 textureColor = texture2D(uSampler, vVertTexCoord);\n if(!uUseLighting){\n gl_FragColor = textureColor;\n }else{\n gl_FragColor = vec4(vec3(textureColor.rgb * vLightWeighting), textureColor.a);\n }\n }\n}",lineVert:"uniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nuniform vec4 uViewport;\n\nuniform float uStrokeWeight;\n\nattribute vec4 aPosition;\nattribute vec4 aDirection;\n\n\nvec3 clipToWindow(vec4 clip, vec4 viewport) {\n vec3 post_div = clip.xyz / clip.w;\n vec2 xypos = (post_div.xy + vec2(1.0, 1.0)) * 0.5 * viewport.zw;\n return vec3(xypos, post_div.z * 0.5 + 0.5);\n}\n\nvec4 windowToClipVector(vec2 window, vec4 viewport, float clip_w) {\n vec2 xypos = (window / viewport.zw) * 2.0;\n return vec4(xypos, 0.0, 0.0) * clip_w;\n}\n\nvoid main() {\n vec4 posMV = uModelViewMatrix * aPosition;\n posMV.xyz = posMV.xyz * vec3(0.999,0.999,0.999);\n vec4 clipp = uProjectionMatrix * posMV;\n float displace = aDirection.w;\n\n vec4 posq = uModelViewMatrix * vec4(aDirection.xyz, 0.0);\n posq.xyz = posq.xyz * vec3(0.999,0.999,0.999);\n vec4 clipq = uProjectionMatrix * posq;\n clipq.w = 1.0;\n\n vec3 window_p = clipToWindow(clipp, uViewport);\n vec3 window_q = clipToWindow(clipq, uViewport);\n vec3 tangent = window_q - window_p;\n vec2 perp = normalize(vec2(-tangent.y, tangent.x));\n float halfStroke = uStrokeWeight/2.0;\n vec2 offset = vec2(halfStroke,halfStroke) * displace * perp;\n gl_Position.xy = clipp.xy + offset.xy;\n gl_Position.zw = clipp.zw;\n}\n",lineFrag:"precision mediump float;\nprecision mediump int;\n\nuniform vec4 uMaterialColor;\n\nvoid main() {\n gl_FragColor = uMaterialColor;\n}"};d.RendererGL=function(a,b,c,e){return d.Renderer.call(this,a,b,c),this.attributes={},e=e||{},this.attributes.alpha=void 0===e.alpha||e.alpha,this.attributes.depth=void 0===e.depth||e.depth,this.attributes.stencil=void 0===e.stencil||e.stencil,this.attributes.antialias=void 0!==e.antialias&&e.antialias,this.attributes.premultipliedAlpha=void 0!==e.premultipliedAlpha&&e.premultipliedAlpha,this.attributes.preserveDrawingBuffer=void 0===e.preserveDrawingBuffer||e.preserveDrawingBuffer,this._initContext(),this.isP3D=!0,this.GL=this.drawingContext,this.ambientLightCount=0,this.directionalLightCount=0,this.pointLightCount=0,this.uMVMatrix=new d.Matrix,this.uPMatrix=new d.Matrix,this.uNMatrix=new d.Matrix("mat3"),this._curCamera=null,this._computeCameraDefaultSettings(),this.cameraFOV=this.defaultCameraFOV,this.cameraAspect=this.defaultAspect,this.cameraX=this.defaultCameraX,this.cameraY=this.defaultCameraY,this.cameraZ=this.defaultCameraZ,this.cameraNear=this.defaultCameraNear,this.cameraFar=this.defaultCameraFar,this.cameraMatrix=new d.Matrix,this.camera(),this.gHash={},this._defaultLightShader=void 0,this._defaultImmediateModeShader=void 0,this._defaultNormalShader=void 0,this._defaultColorShader=void 0,this.curFillShader={},this.curStrokeShader={},this.setFillShader(this._getColorShader()),this.setStrokeShader(this._getLineShader()),this.isImmediateDrawing=!1,this.immediateMode={},this.fill(255,255,255,255),this.pointSize=5,this.curStrokeWeight=2,this.curStrokeColor=[0,0,0,1],this._setStrokeWeight(),this._setStrokeColor(),this.textures=[],this.name="p5.RendererGL",this},d.RendererGL.prototype=Object.create(d.Renderer.prototype),d.RendererGL.prototype._initContext=function(){try{if(this.drawingContext=this.canvas.getContext("webgl",this.attributes)||this.canvas.getContext("experimental-webgl",this.attributes),null===this.drawingContext)throw new Error("Error creating webgl context");console.log("p5.RendererGL: enabled webgl context");var a=this.drawingContext;a.enable(a.DEPTH_TEST),a.depthFunc(a.LEQUAL),a.viewport(0,0,a.drawingBufferWidth,a.drawingBufferHeight)}catch(a){throw new Error(a)}},d.RendererGL.prototype._resetContext=function(a,b,c){var e=this.width,f=this.height,g=this.canvas.id,h=this.canvas;h&&h.parentNode.removeChild(h),h=document.createElement("canvas"),h.id=g,this._pInst._userNode?this._pInst._userNode.appendChild(h):document.body.appendChild(h),this._pInst.canvas=h,this._pInst._setProperty("_renderer",new d.RendererGL(this._pInst.canvas,this._pInst,!0,a)),this._pInst._renderer.resize(e,f),this._pInst._renderer._applyDefaults(),this._pInst._elements.push(this._renderer),"function"==typeof c&&setTimeout(function(){c.apply(window._renderer,b)},0)},d.prototype.setAttributes=function(){var a={};2===arguments.length?a[arguments[0]]=arguments[1]:1===arguments.length&&(a=arguments[0]),this._renderer._resetContext(a)},d.RendererGL.prototype._computeCameraDefaultSettings=function(){this.defaultCameraFOV=60/180*Math.PI,this.defaultCameraAspect=this.width/this.height,this.defaultCameraX=0,this.defaultCameraY=0,this.defaultCameraZ=this.height/2/Math.tan(this.defaultCameraFOV/2),this.defaultCameraNear=.1*this.defaultCameraZ,this.defaultCameraFar=10*this.defaultCameraZ},d.RendererGL.prototype._setDefaultCamera=function(){null===this._curCamera&&(this._computeCameraDefaultSettings(),this.cameraFOV=this.defaultCameraFOV,this.cameraAspect=this.defaultAspect,this.cameraX=this.defaultCameraX,this.cameraY=this.defaultCameraY,this.cameraZ=this.defaultCameraZ,this.cameraNear=this.defaultCameraNear,this.cameraFar=this.defaultCameraFar,this.perspective(),this.camera(),this._curCamera="default")},d.RendererGL.prototype._update=function(){this.uMVMatrix.set(this.cameraMatrix.mat4[0],this.cameraMatrix.mat4[1],this.cameraMatrix.mat4[2],this.cameraMatrix.mat4[3],this.cameraMatrix.mat4[4],this.cameraMatrix.mat4[5],this.cameraMatrix.mat4[6],this.cameraMatrix.mat4[7],this.cameraMatrix.mat4[8],this.cameraMatrix.mat4[9],this.cameraMatrix.mat4[10],this.cameraMatrix.mat4[11],this.cameraMatrix.mat4[12],this.cameraMatrix.mat4[13],this.cameraMatrix.mat4[14],this.cameraMatrix.mat4[15]),this.ambientLightCount=0,this.directionalLightCount=0,this.pointLightCount=0},d.RendererGL.prototype.background=function(){var a=this._pInst.color.apply(this._pInst,arguments),b=a.levels[0]/255,c=a.levels[1]/255,d=a.levels[2]/255,e=a.levels[3]/255;this.GL.clearColor(b,c,d,e),this.GL.clear(this.GL.COLOR_BUFFER_BIT|this.GL.DEPTH_BUFFER_BIT)},d.RendererGL.prototype.fill=function(a,b,c,d){var f=this._applyColorBlend.apply(this,arguments);this.curFillColor=f,this.curFillShader.active===!1&&(this.curFillShader.active=!0),this.isImmediateDrawing?this.setFillShader(this._getImmediateModeShader()):this.setFillShader(this._getColorShader()),this.drawMode=e.FILL,this.curFillShader.setUniform("uMaterialColor",f)},d.RendererGL.prototype.noFill=function(){this.curFillShader.active=!1},d.RendererGL.prototype.noStroke=function(){this.curStrokeShader.active=!1},d.RendererGL.prototype.stroke=function(a,b,c,d){this.curStrokeShader.active===!1&&(this.curStrokeShader.active=!0),arguments[3]=255;var e=this._applyColorBlend.apply(this,arguments);this.curStrokeColor!==e&&(this.curStrokeColor=e,this._setStrokeColor())},d.RendererGL.prototype.strokeWeight=function(a){this.curStrokeShader.active===!1&&(this.curStrokeShader.active=!0),this.curStrokeWeight!==a&&(this.pointSize=a,this.curStrokeWeight=a,this.curStrokeShader.setUniform("uStrokeWeight",a))},d.RendererGL.prototype._setStrokeWeight=function(){this.curStrokeShader.setUniform("uStrokeWeight",this.curStrokeWeight)},d.RendererGL.prototype._setStrokeColor=function(){this.curStrokeShader.setUniform("uMaterialColor",this.curStrokeColor)},d.RendererGL.prototype.get=function(a,b,c,e){return d.Renderer2D.prototype.get.apply(this,[a,b,c,e])},d.RendererGL.prototype.loadPixels=function(){if(this.attributes.preserveDrawingBuffer!==!0)return void console.log("loadPixels only works in WebGL when preserveDrawingBuffer is true.");var a=this._pInst._pixelDensity,b=arguments[0]||0,c=arguments[1]||0,d=arguments[2]||this.width,e=arguments[3]||this.height;d*=a,e*=a;var f=new Uint8Array(this.GL.drawingBufferWidth*this.GL.drawingBufferHeight*4);this.GL.readPixels(b,c,d,e,this.GL.RGBA,this.GL.UNSIGNED_BYTE,f),this._pInst._setProperty("pixels",f)},d.RendererGL.prototype.geometryInHash=function(a){return void 0!==this.gHash[a]},d.RendererGL.prototype.resize=function(a,b){d.Renderer.prototype.resize.call(this,a,b),this.GL.viewport(0,0,this.GL.drawingBufferWidth,this.GL.drawingBufferHeight),null!==this._curCamera&&"default"!==this._curCamera||(this._curCamera=null,this._setDefaultCamera())},d.RendererGL.prototype.clear=function(){this.GL.clearColor(arguments[0],arguments[1],arguments[2],arguments[3]),this.GL.clear(this.GL.COLOR_BUFFER_BIT|this.GL.DEPTH_BUFFER_BIT)},d.RendererGL.prototype.translate=function(a,b,c){return a instanceof d.Vector&&(c=a.z,b=a.y,a=a.x),this.uMVMatrix.translate([a,b,c]),this},d.RendererGL.prototype.scale=function(a,b,c){return this.uMVMatrix.scale([a,b,c]),this},d.RendererGL.prototype.rotate=function(a,b){return this.uMVMatrix.rotate(a,b),this},d.RendererGL.prototype.rotateX=function(a){return this.rotate(a,[1,0,0]),this},d.RendererGL.prototype.rotateY=function(a){return this.rotate(a,[0,1,0]),this},d.RendererGL.prototype.rotateZ=function(a){return this.rotate(a,[0,0,1]),this},d.RendererGL.prototype.push=function(){f.push(this.uMVMatrix.copy()),g.push(this.cameraMatrix.copy())},d.RendererGL.prototype.pop=function(){if(0===f.length)throw new Error("Invalid popMatrix!");if(this.uMVMatrix=f.pop(),0===g.length)throw new Error("Invalid popMatrix!");this.cameraMatrix=g.pop()},d.RendererGL.prototype.resetMatrix=function(){return this.uMVMatrix=d.Matrix.identity(),this},d.RendererGL.prototype._applyTextProperties=function(){console.error("text commands not yet implemented in webgl")},d.RendererGL.prototype.setFillShader=function(a){return this.curFillShader!==a&&(this.curFillShader=a,this.curFillShader.init(),this.curFillShader.useProgram(),this.curFillShader.active=!0),this.curFillShader},d.RendererGL.prototype.setStrokeShader=function(a){return this.curStrokeShader!==a&&(this.curStrokeShader=a,this.curStrokeShader.init(),this.curStrokeShader.useProgram(),this.curStrokeShader.active=!0),this.curStrokeShader},d.RendererGL.prototype._getLightShader=function(){return void 0===this._defaultLightShader&&(this._defaultLightShader=new d.Shader(this,h.lightVert,h.lightTextureFrag)),this._defaultLightShader},d.RendererGL.prototype._getImmediateModeShader=function(){return void 0===this._defaultImmediateModeShader&&(this._defaultImmediateModeShader=new d.Shader(this,h.immediateVert,h.vertexColorFrag)),this._defaultImmediateModeShader},d.RendererGL.prototype._getNormalShader=function(){return void 0===this._defaultNormalShader&&(this._defaultNormalShader=new d.Shader(this,h.normalVert,h.normalFrag)),this._defaultNormalShader},d.RendererGL.prototype._getColorShader=function(){return void 0===this._defaultColorShader&&(this._defaultColorShader=new d.Shader(this,h.normalVert,h.basicFrag)),this._defaultColorShader},d.RendererGL.prototype._getLineShader=function(){return void 0===this._defaultLineShader&&(this._defaultLineShader=new d.Shader(this,h.lineVert,h.lineFrag)),this._defaultLineShader},d.RendererGL.prototype._getEmptyTexture=function(){if(void 0===this._emptyTexture){var a=new d.Image(1,1);a.set(0,0,255),this._emptyTexture=new d.Texture(this,a)}return this._emptyTexture},d.RendererGL.prototype.getTexture=function(a){var b=function(b){return b.src===a},c=this.textures.find(b);return void 0===c&&(c=new d.Texture(this,a),this.textures.push(c)),c},d.RendererGL.prototype._bindBuffer=function(a,b,c,d,e){if(this.GL.bindBuffer(b,a),void 0!==c){var f=new d(c);this.GL.bufferData(b,f,e)}},d.RendererGL.prototype._flatten=function(a){return a.length>0?[].concat.apply([],a):[]},d.RendererGL.prototype._vToNArray=function(a){return this._flatten(a.map(function(a){return[a.x,a.y,a.z]}))},b.exports=d.RendererGL},{"../core/constants":54,"../core/core":55,"../core/p5.Renderer":62,"./p5.Matrix":103,"./p5.Shader":107}],107:[function(a,b,c){var d=a("../core/core");d.Shader=function(a,b,c){return this._renderer=a,this._vertSrc=b,this._fragSrc=c,this._vertShader=-1,this._fragShader=-1,this._glProgram=0,this._loadedAttributes=!1,this.attributes={},this._loadedUniforms=!1,this.uniforms={},this._bound=!1,this.samplers=[],this},d.Shader.prototype.init=function(){if(0===this._glProgram){var a=this._renderer.GL;if(this._vertShader=a.createShader(a.VERTEX_SHADER),a.shaderSource(this._vertShader,this._vertSrc),a.compileShader(this._vertShader),!a.getShaderParameter(this._vertShader,a.COMPILE_STATUS))return console.error("Yikes! An error occurred compiling the vertex shader:"+a.getShaderInfoLog(this._vertShader)),null;if(this._fragShader=a.createShader(a.FRAGMENT_SHADER),a.shaderSource(this._fragShader,this._fragSrc),a.compileShader(this._fragShader),!a.getShaderParameter(this._fragShader,a.COMPILE_STATUS))return console.error("Darn! An error occurred compiling the fragment shader:"+a.getShaderInfoLog(this._fragShader)),null;this._glProgram=a.createProgram(),a.attachShader(this._glProgram,this._vertShader),a.attachShader(this._glProgram,this._fragShader),a.linkProgram(this._glProgram),a.getProgramParameter(this._glProgram,a.LINK_STATUS)||console.error("Snap! Error linking shader program: "+a.getProgramInfoLog(this._glProgram)),this._loadAttributes(),this._loadUniforms()}return this},d.Shader.prototype._loadAttributes=function(){if(!this._loadedAttributes){this.attributes={};for(var a=this._renderer.GL,b=a.getProgramParameter(this._glProgram,a.ACTIVE_ATTRIBUTES),c=0;c<b;++c){var d=a.getActiveAttrib(this._glProgram,c),e=d.name,f=a.getAttribLocation(this._glProgram,e),g={};g.name=e,g.location=f,g.type=d.type,g.size=d.size,this.attributes[e]=g}this._loadedAttributes=!0}},d.Shader.prototype._loadUniforms=function(){if(!this._loadedUniforms){for(var a=this._renderer.GL,b=a.getProgramParameter(this._glProgram,a.ACTIVE_UNIFORMS),c=0,d=0;d<b;++d){var e=a.getActiveUniform(this._glProgram,d),f={};f.location=a.getUniformLocation(this._glProgram,e.name),f.size=e.size;var g=e.name;e.size>1&&(g=g.substring(0,g.indexOf("[0]"))),f.name=g,f.type=e.type,f.type===a.SAMPLER_2D&&(f.samplerIndex=c,c++,this.samplers.push(f)),this.uniforms[g]=f}this._loadedUniforms=!0}},d.Shader.prototype.compile=function(){},d.Shader.prototype.bindShader=function(){this.init(),this._bound||(this.useProgram(),this._bound=!0,this.bindTextures(),this._loadAttributes(),this._loadUniforms(),this._renderer._setDefaultCamera(),this._setMatrixUniforms(),this===this._renderer.curStrokeShader&&this._setViewportUniform())},d.Shader.prototype.unbindShader=function(){return this._bound&&(this.unbindTextures(),this._bound=!1),this},d.Shader.prototype.bindTextures=function(){for(var a=this._renderer.GL,b=0;b<this.samplers.length;b++){var c=this.samplers[b],d=c.texture;void 0===d&&(d=this._renderer._getEmptyTexture()),a.activeTexture(a.TEXTURE0+c.samplerIndex),d.bindTexture(),d.update(),a.uniform1i(c.location,c.samplerIndex)}},d.Shader.prototype.unbindTextures=function(){},d.Shader.prototype._setMatrixUniforms=function(){this.setUniform("uProjectionMatrix",this._renderer.uPMatrix.mat4),this.setUniform("uModelViewMatrix",this._renderer.uMVMatrix.mat4),this===this._renderer.curFillShader&&(this._renderer.uNMatrix.inverseTranspose(this._renderer.uMVMatrix),this.setUniform("uNormalMatrix",this._renderer.uNMatrix.mat3))},d.Shader.prototype._setViewportUniform=function(){this.setUniform("uViewport",this._renderer.GL.getParameter(this._renderer.GL.VIEWPORT))},d.Shader.prototype.useProgram=function(){return this._renderer.GL.useProgram(this._glProgram),this},d.Shader.prototype.setUniform=function(a,b){var c=this._renderer.GL;this.useProgram();var d=this.uniforms[a];if(d){var e=d.location;switch(d.type){case c.BOOL:b===!0?c.uniform1i(e,1):c.uniform1i(e,0);break;case c.INT:c.uniform1i(e,b);break;case c.FLOAT:d.size>1?c.uniform1fv(e,b):c.uniform1f(e,b);break;case c.FLOAT_MAT3:c.uniformMatrix3fv(e,!1,b);break;case c.FLOAT_MAT4:c.uniformMatrix4fv(e,!1,b);break;case c.FLOAT_VEC2:d.size>1?c.uniform2fv(e,b):c.uniform2f(e,b[0],b[1]);break;case c.FLOAT_VEC3:d.size>1?c.uniform3fv(e,b):c.uniform3f(e,b[0],b[1],b[2]);break;case c.FLOAT_VEC4:d.size>1?c.uniform4fv(e,b):c.uniform4f(e,b[0],b[1],b[2],b[3]);break;case c.SAMPLER_2D:c.activeTexture(c.TEXTURE0+d.samplerIndex),d.texture=this._renderer.getTexture(b),c.uniform1i(d.location,d.samplerIndex)}return this}},d.Shader.prototype.isLightShader=function(){return void 0!==this.uniforms.uUseLighting||void 0!==this.uniforms.uAmbientLightCount||void 0!==this.uniforms.uDirectionalLightCount||void 0!==this.uniforms.uPointLightCount||void 0!==this.uniforms.uAmbientColor||void 0!==this.uniforms.uDirectionalColor||void 0!==this.uniforms.uPointLightLocation||void 0!==this.uniforms.uPointLightColor||void 0!==this.uniforms.uLightingDirection||void 0!==this.uniforms.uSpecular},d.Shader.prototype.isTextureShader=function(){return this.samplerIndex>0},d.Shader.prototype.isColorShader=function(){return void 0!==this.attributes.aVertexColor||void 0!==this.uniforms.uMaterialColor},d.Shader.prototype.isTexLightShader=function(){return this.isLightShader()&&this.isTextureShader()},d.Shader.prototype.isStrokeShader=function(){return void 0!==this.uniforms.uStrokeWeight},d.Shader.prototype.enableAttrib=function(a,b,c,d,e,f){var g=this._renderer.GL;return a!==-1&&(g.enableVertexAttribArray(a),g.vertexAttribPointer(a,b,c,d,e,f)),this},b.exports=d.Shader},{"../core/core":55}],108:[function(a,b,c){var d=a("../core/core");d.Texture=function(a,b){this._renderer=a;var c=this._renderer.GL;this.src=b,this.glTex=void 0,this.glTarget=c.TEXTURE_2D,this.glFormat=c.RGBA,this.mipmaps=!1,this.glMinFilter=c.LINEAR,this.glMagFilter=c.LINEAR,this.glWrapS=c.CLAMP_TO_EDGE,this.glWrapT=c.CLAMP_TO_EDGE,this.isSrcMediaElement=void 0!==d.MediaElement&&b instanceof d.MediaElement,this._videoPrevUpdateTime=0,this.isSrcHTMLElement=void 0!==d.Element&&b instanceof d.Element,this.isSrcP5Image=b instanceof d.Image,this.isSrcP5Graphics=b instanceof d.Graphics;var e=this._getTextureDataFromSource();return this.height=e.width,this.width=e.height,this.init(e),this},d.Texture.prototype._getTextureDataFromSource=function(){var a;return this.isSrcP5Image?a=this.src.canvas:(this.isSrcMediaElement||this.isSrcP5Graphics||this.isSrcHTMLElement)&&(a=this.src.elt),a},d.Texture.prototype.init=function(a){var b=this._renderer.GL;if(this.glTex=b.createTexture(),this.bindTexture(),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MAG_FILTER,this.glMagFilter),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_MIN_FILTER,this.glMinFilter),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_S,this.glWrapS),b.texParameteri(b.TEXTURE_2D,b.TEXTURE_WRAP_T,this.glWrapT),0===this.width||0===this.height||this.isSrcMediaElement&&!this.src.loadedmetadata){var c=new Uint8Array([1,1,1,1]);b.texImage2D(this.glTarget,0,b.RGBA,1,1,0,this.glFormat,b.UNSIGNED_BYTE,c)}else b.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,b.UNSIGNED_BYTE,a)},d.Texture.prototype.update=function(){var a=this.src;if(0!==a.width&&0!==a.height){var b=this._getTextureDataFromSource(),c=this._renderer.GL;if(b.width!==this.width||b.height!==this.height)this.width=b.width,this.height=b.height,this.bindTexture(),c.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,c.UNSIGNED_BYTE,b),this.isSrcP5Image?a.setModified(!1):(this.isSrcMediaElement||this.isSrcHTMLElement)&&a.setModified(!0);else if(this.isSrcP5Image)a.isModified()&&(this.bindTexture(),c.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,c.UNSIGNED_BYTE,b),a.setModified(!1));else if(this.isSrcMediaElement){var d=!1;a.isModified()?(d=!0,a.setModified(!1)):a.loadedmetadata&&this._videoPrevUpdateTime!==a.time()&&(this._videoPrevUpdateTime=a.time(),d=!0),d&&(this.bindTexture(),c.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,c.UNSIGNED_BYTE,b))}else c.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,c.UNSIGNED_BYTE,b)}},d.Texture.prototype.bindTexture=function(){return this._renderer.GL.bindTexture(this.glTarget,this.glTex),this},d.Texture.prototype.unbindTexture=function(){this._renderer.GL.bindTexture(this.glTarget,null)},b.exports=d.Texture},{"../core/core":55}],109:[function(a,b,c){"use strict";var d=a("../core/core");a("./p5.Geometry"),d.prototype.plane=function(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];var c=a[0]||50,e=a[1]||c,f="number"==typeof a[2]?a[2]:1,g="number"==typeof a[3]?a[3]:1,h="plane|"+c+"|"+e+"|"+f+"|"+g;if(!this._renderer.geometryInHash(h)){var i=function(){for(var a,b,f,g=0;g<=this.detailY;g++){b=g/this.detailY;for(var h=0;h<=this.detailX;h++)a=h/this.detailX,f=new d.Vector(c*a-c/2,e*b-e/2,0),this.vertices.push(f),this.uvs.push([a,b])}},j=new d.Geometry(f,g,i);j.computeFaces().computeNormals(),f<=1&&g<=1?(j._makeTriangleEdges(),this._renderer._edgesToVertices(j)):console.log("Cannot draw stroke on plane objects with more than 1 detailX or 1 detailY"),this._renderer.createBuffers(h,j)}this._renderer.drawBuffers(h)},d.prototype.box=function(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];var c=a[0]||50,e=a[1]||c,f=a[2]||c,g="number"==typeof a[3]?a[3]:4,h="number"==typeof a[4]?a[4]:4,i="box|"+c+"|"+e+"|"+f+"|"+g+"|"+h;if(!this._renderer.geometryInHash(i)){var j=function(){var a=[[0,4,2,6],[1,3,5,7],[0,1,4,5],[2,6,3,7],[0,2,1,3],[4,5,6,7]];this.strokeIndices=[[0,1],[1,3],[3,2],[6,7],[8,9],[9,11],[14,15],[16,17],[17,19],[18,19],[20,21],[22,23]];for(var b=0,g=0;g<a.length;g++){
for(var h=a[g],i=4*g,j=0;j<4;j++){var k=h[j],l=new d.Vector((2*(1&k)-1)*c/2,((2&k)-1)*e/2,((4&k)/2-1)*f/2);this.vertices.push(l),this.uvs.push([1&j,(2&j)/2]),b++}this.faces.push([i,i+1,i+2]),this.faces.push([i+2,i+1,i+3])}},k=new d.Geometry(g,h,j);k.computeNormals(),g<=4&&h<=4?(k._makeTriangleEdges(),this._renderer._edgesToVertices(k)):console.log("Cannot draw stroke on box objects with more than 4 detailX or 4 detailY"),this._renderer.createBuffers(i,k)}return this._renderer.drawBuffers(i),this},d.prototype.sphere=function(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];var c=a[0]||50,e="number"==typeof a[1]?a[1]:24,f="number"==typeof a[2]?a[2]:16,g="sphere|"+c+"|"+e+"|"+f;if(!this._renderer.geometryInHash(g)){var h=function(){for(var a,b,e,f=0;f<=this.detailY;f++){b=f/this.detailY;for(var g=0;g<=this.detailX;g++){a=g/this.detailX;var h=2*Math.PI*a,i=Math.PI*b-Math.PI/2;e=new d.Vector(c*Math.cos(i)*Math.sin(h),c*Math.sin(i),c*Math.cos(i)*Math.cos(h)),this.vertices.push(e),this.uvs.push([a,b])}}},i=new d.Geometry(e,f,h);i.computeFaces().computeNormals().averageNormals().averagePoleNormals(),e<=24&&f<=16?(i._makeTriangleEdges(),this._renderer._edgesToVertices(i)):console.log("Cannot draw stroke on sphere objects with more than 24 detailX or 16 detailY"),this._renderer.createBuffers(g,i)}return this._renderer.drawBuffers(g),this};var e=function(a,b,c,e,f,g,h){e=e<3?3:e,f=f<1?1:f,g=void 0===g||g,h=void 0===h||h;var i,j,k=(g?2:0)+(h?2:0),l=e+1,m=Math.atan2(a-b,c),n=g?-2:0,o=f+(h?2:0);for(i=n;i<=o;++i){var p,q=i/f,r=c*q;for(i<0?(r=0,q=1,p=a):i>f?(r=c,q=1,p=b):p=a+i/f*(b-a),i!==-2&&i!==f+2||(p=0,q=0),r-=c/2,j=0;j<l;++j)this.vertices.push(new d.Vector(Math.sin(j*Math.PI*2/e)*p,r,Math.cos(j*Math.PI*2/e)*p)),this.vertexNormals.push(new d.Vector(i<0||i>f?0:Math.sin(j*Math.PI*2/e)*Math.cos(m),i<0?-1:i>f?1:Math.sin(m),i<0||i>f?0:Math.cos(j*Math.PI*2/e)*Math.cos(m))),this.uvs.push([j/e,q])}for(i=0;i<f+k;++i)for(j=0;j<e;++j)this.faces.push([l*(i+0)+0+j,l*(i+0)+1+j,l*(i+1)+1+j]),this.faces.push([l*(i+0)+0+j,l*(i+1)+1+j,l*(i+1)+0+j])};d.prototype.cylinder=function(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];var c=a[0]||50,f=a[1]||c,g="number"==typeof a[2]?a[2]:24,h="number"==typeof a[3]?a[3]:16,i="cylinder|"+c+"|"+f+"|"+g+"|"+h;if(!this._renderer.geometryInHash(i)){var j=new d.Geometry(g,h);e.call(j,c,c,f,g,h,!0,!0),j.computeNormals(),g<=24&&h<=16?(j._makeTriangleEdges(),this._renderer._edgesToVertices(j)):console.log("Cannot draw stroke on cylinder objects with more than 24 detailX or 16 detailY"),this._renderer.createBuffers(i,j)}return this._renderer.drawBuffers(i),this},d.prototype.cone=function(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];var c=a[0]||50,f=a[1]||c,g="number"==typeof a[2]?a[2]:24,h="number"==typeof a[3]?a[3]:16,i="cone|"+c+"|"+f+"|"+g+"|"+h;if(!this._renderer.geometryInHash(i)){var j=new d.Geometry(g,h);e.call(j,c,0,f,g,h,!0,!0),j.computeNormals(),g<=24&&h<=16?(j._makeTriangleEdges(),this._renderer._edgesToVertices(j)):console.log("Cannot draw stroke on cone objects with more than 24 detailX or 16 detailY"),this._renderer.createBuffers(i,j)}return this._renderer.drawBuffers(i),this},d.prototype.ellipsoid=function(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];var c="number"==typeof a[3]?a[3]:24,e="number"==typeof a[4]?a[4]:24,f=a[0]||50,g=a[1]||f,h=a[2]||f,i="ellipsoid|"+f+"|"+g+"|"+h+"|"+c+"|"+e;if(!this._renderer.geometryInHash(i)){var j=function(){for(var a,b,c,e=0;e<=this.detailY;e++){b=e/this.detailY;for(var i=0;i<=this.detailX;i++){a=i/this.detailX;var j=2*Math.PI*a,k=Math.PI*b-Math.PI/2;c=new d.Vector(f*Math.cos(k)*Math.sin(j),g*Math.sin(k),h*Math.cos(k)*Math.cos(j)),this.vertices.push(c),this.uvs.push([a,b])}}},k=new d.Geometry(c,e,j);k.computeFaces().computeNormals(),c<=24&&e<=24?(k._makeTriangleEdges(),this._renderer._edgesToVertices(k)):console.log("Cannot draw stroke on ellipsoids with more than 24 detailX or 24 detailY"),this._renderer.createBuffers(i,k)}return this._renderer.drawBuffers(i),this},d.prototype.torus=function(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];var c="number"==typeof a[2]?a[2]:24,e="number"==typeof a[3]?a[3]:16,f=a[0]||50,g=a[1]||10,h="torus|"+f+"|"+g+"|"+c+"|"+e;if(!this._renderer.geometryInHash(h)){var i=function(){for(var a,b,c,e=0;e<=this.detailY;e++){b=e/this.detailY;for(var h=0;h<=this.detailX;h++){a=h/this.detailX;var i=2*Math.PI*a,j=2*Math.PI*b;c=new d.Vector((f+g*Math.cos(j))*Math.cos(i),(f+g*Math.cos(j))*Math.sin(i),g*Math.sin(j)),this.vertices.push(c),this.uvs.push([a,b])}}},j=new d.Geometry(c,e,i);j.computeFaces().computeNormals().averageNormals(),c<=24&&e<=16?(j._makeTriangleEdges(),this._renderer._edgesToVertices(j)):console.log("Cannot draw strokes on torus object with more than 24 detailX or 16 detailY"),this._renderer.createBuffers(h,j)}return this._renderer.drawBuffers(h),this},d.RendererGL.prototype.point=function(a,b,c){return console.log("point not yet implemented in webgl"),this},d.RendererGL.prototype.triangle=function(a){var b=a[0],c=a[1],e=a[2],f=a[3],g=a[4],h=a[5],i="tri|"+b+"|"+c+"|"+e+"|"+f+"|"+g+"|"+h;if(!this.geometryInHash(i)){var j=function(){var a=[];a.push(new d.Vector(b,c,0)),a.push(new d.Vector(e,f,0)),a.push(new d.Vector(g,h,0)),this.strokeIndices=[[0,1],[1,2],[2,0]],this.vertices=a,this.faces=[[0,1,2]],this.uvs=[[0,0],[0,1],[1,1]]},k=new d.Geometry(1,1,j);k._makeTriangleEdges(),this._edgesToVertices(k),k.computeNormals(),this.createBuffers(i,k)}return this.drawBuffers(i),this},d.RendererGL.prototype.ellipse=function(a){var b=a[0],c=a[1],e=a[2],f=a[3],g=a[4]||24,h=a[5]||16,i="ellipse|"+a[0]+"|"+a[1]+"|"+a[2]+"|"+a[3];if(!this.geometryInHash(i)){var j=function(){for(var a,g,h,i=b+.5*e,j=c+.5*f,k=0;k<=this.detailY;k++){g=k/this.detailY;for(var l=0;l<=this.detailX;l++){a=l/this.detailX;var m=2*Math.PI*a;if(0===g)h=new d.Vector(i,j,0);else{var n=i+.5*e*Math.cos(m),o=j+.5*f*Math.sin(m);h=new d.Vector(n,o,0)}this.vertices.push(h),this.uvs.push([a,g])}}},k=new d.Geometry(g,h,j);k.computeFaces().computeNormals(),g<=24&&h<=16?(k._makeTriangleEdges(),this._edgesToVertices(k)):console.log("Cannot stroke ellipse with more than 24 detailX or 16 detailY"),this.createBuffers(i,k)}return this.drawBuffers(i),this},d.RendererGL.prototype.rect=function(a){var b="rect|"+a[0]+"|"+a[1]+"|"+a[2]+"|"+a[3],c=a[0],e=a[1],f=a[2],g=a[3],h=a[4]||24,i=a[5]||16;if(!this.geometryInHash(b)){var j=function(){for(var a,b,h,i=0;i<=this.detailY;i++){b=i/this.detailY;for(var j=0;j<=this.detailX;j++)a=j/this.detailX,h=new d.Vector(c+f*a,e+g*b,0),this.vertices.push(h),this.uvs.push([a,b])}},k=new d.Geometry(h,i,j);k.computeFaces().computeNormals()._makeTriangleEdges(),this._edgesToVertices(k),this.createBuffers(b,k)}return this.drawBuffers(b),this},d.RendererGL.prototype.quad=function(){for(var a=new Array(arguments.length),b=0;b<a.length;++b)a[b]=arguments[b];var c=a[0],e=a[1],f=a[2],g=a[3],h=a[4],i=a[5],j=a[6],k=a[7],l="quad|"+c+"|"+e+"|"+f+"|"+g+"|"+h+"|"+i+"|"+j+"|"+k;if(!this.geometryInHash(l)){var m=function(){this.vertices.push(new d.Vector(c,e,0)),this.vertices.push(new d.Vector(f,g,0)),this.vertices.push(new d.Vector(h,i,0)),this.vertices.push(new d.Vector(j,k,0)),this.uvs.push([0,0],[1,0],[1,1],[0,1]),this.strokeIndices=[[0,1],[1,2],[2,3],[3,0]]},n=new d.Geometry(2,2,m);n.computeNormals()._makeTriangleEdges(),this._edgesToVertices(n),n.faces=[[0,1,2],[2,3,0]],this.createBuffers(l,n)}return this.drawBuffers(l),this},d.RendererGL.prototype.bezier=function(a){var b=a[12]||20;this.beginShape();for(var c=[0,0,0,0],d=[0,0,0],e=0;e<=b;e++)c[0]=Math.pow(1-e/b,3),c[1]=e/b*3*Math.pow(1-e/b,2),c[2]=3*Math.pow(e/b,2)*(1-e/b),c[3]=Math.pow(e/b,3),d[0]=a[0]*c[0]+a[3]*c[1]+a[6]*c[2]+a[9]*c[3],d[1]=a[1]*c[0]+a[4]*c[1]+a[7]*c[2]+a[10]*c[3],d[2]=a[2]*c[0]+a[5]*c[1]+a[8]*c[2]+a[11]*c[3],this.vertex(d[0],d[1],d[2]);return this.endShape(),this},d.RendererGL.prototype.curve=function(a){var b=a[12];this.beginShape();for(var c=[0,0,0,0],d=[0,0,0],e=0;e<=b;e++)c[0]=.5*Math.pow(e/b,3),c[1]=.5*Math.pow(e/b,2),c[2]=e/b*.5,c[3]=.5,d[0]=c[0]*(-a[0]+3*a[3]-3*a[6]+a[9])+c[1]*(2*a[0]-5*a[3]+4*a[6]-a[9])+c[2]*(-a[0]+a[6])+c[3]*(2*a[3]),d[1]=c[0]*(-a[1]+3*a[4]-3*a[7]+a[10])+c[1]*(2*a[1]-5*a[4]+4*a[7]-a[10])+c[2]*(-a[1]+a[7])+c[3]*(2*a[4]),d[2]=c[0]*(-a[2]+3*a[5]-3*a[8]+a[11])+c[1]*(2*a[2]-5*a[5]+4*a[8]-a[11])+c[2]*(-a[2]+a[8])+c[3]*(2*a[5]),this.vertex(d[0],d[1],d[2]);return this.endShape(),this},d.RendererGL.prototype.line=function(a,b,c,d,e,f){return void 0===a&&void 0===b&&void 0===c&&void 0===d&&void 0===e&&void 0===f||(this.beginShape(),this.vertex(a,b,c),this.vertex(d,e,f),this.endShape()),this},b.exports=d},{"../core/core":55,"./p5.Geometry":102}]},{},[46])(46)});