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
JavaScript
38 lines
1.1 MiB
JavaScript
4 years ago
|
/*! 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:{Mo
|
||
|
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'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// <mammals>\n// <animal id="0" species="Capra hircus">Goat</animal>\n// <animal id="1" species="Panthera pardus">Leopard</animal>\n// <animal id="2" species="Equus zebra">Zebra</animal>\n// </mammals>\n\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\nposit
|
||
|
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('lowpass')</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('highpass')</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('bandpass')</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>
|
||
|
}],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,descripti
|
||
|
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'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's center point, but uses the third and fourth parameters to specify\nhalf of the shapes'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
|
||
|
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'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);
|
||
|
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}
|
||
|
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(
|
||
|
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
|
||
|
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 "return false" 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's primary button)\nis clicked twice on a single element. For more info on the\ndblclick event refer to mozilla'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 "natural" 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"return false" to the end of the method.<br><br>\nDue to the current support of the "wheel" event on Safari, the function\nmay only work as expected if "return false" is included while using Safari.</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
|
||
|
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 < d; i++) {\n for (var j = 0; j < 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.</
|
||
|
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>"json" or "jsonp"</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 ex
|
||
|
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
|
||
|
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// <mammals>\n// <animal id="0" species="Capra hircus">Goat</animal>\n// <animal id="1" species="Panthera pardus">Leopard</animal>\n// <animal id="2" species="Equus zebra">Zebra</animal>\n// </mammals>\n\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'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// <mammals>\n// <animal id="0" species="Capra hircus">Goat</animal>\n// <animal id="1" species="Panthera pardus">Leopard</animal>\n// <animal id="2" species="Equus zebra">Zebra</animal>\n// </mammals>\n\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'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// <mammals>\n// <animal id="0" species="Capra hircus">Goat</animal>\n// <animal id="1" species="Panthera pardus">Leopard</animal>\n// <animal id="2" species="Equus zebra">Zebra</animal>\n// </mammals>\n\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 // <mammals>\n // <animal id="0" species="Capra hircus">Goat</animal>\n // <animal id="1" species="Panthera pardus">Leopard</animal>\n // <animal id="2" species="Equus zebra">Zebra</animal>\n // </mammals>\n\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
|
||
|
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'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'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",d
|
||
|
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:
|
||
|
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("1234.56") evaluates to 1234.56, but float("giraffe")\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 "true" evaluates to\ntrue, while any other value evaluates to false. When an array of number or\nstring values is passed in, then a array of booleans of the same length is\nreturned.</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 o
|
||
|
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
|
||
|
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",descri
|
||
|
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 'vertical', 'horizontal' 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 ('text-align:center'), .style() sets the css\nappropriatly. .style() also handles 2d and 3d css transforms. If\nthe 1st arg is 'rotate', 'translate', or 'position', the following arguments\naccept Numbers as values. ('translate', 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.E
|
||
|
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'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. 'mp3', 'wav', 'ogg'</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. ['sound.ogg', 'sound.mp3'].\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",m
|
||
|
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 < smoothing < 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",submo
|
||
|
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's volume level. Accepts an\noptional smoothing value (0.0 < 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 inpu
|
||
|
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'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 "ratio" 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 "ratio" 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 "ratio" 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/ ti
|
||
|
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 ra
|
||
|
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
|
||
|
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","Thornsma
|
||
|
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.units
|
||
|
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:"la
|
||
|
;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
|
||
|
}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
|
||
|
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=[]
|
||
|
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):thi
|
||
|
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.NumberDi
|
||
|
;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=[
|
||
|
;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.
|
||
|
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
|
||
|
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.drawB
|