PageSourceSearch

https://edamame.netlify.app/app.f3d1a0e7.js

js edamame.netlify.app collected 2026-10-03 10:40:47 UTC 1,637,553 bytes, 45 lines download raw bytes

vendor: 3,641 bytes, lines 1-9
1parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"4A+K":[function(require,module,exports) {
2
3},{}],"FRly":[function(require,module,exports) {
4"use strict";exports.byteLength=u,exports.toByteArray=i,exports.fromByteArray=d;for(var r=[],t=[],e="undefined"!=typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,a=n.length;o<a;++o)r[o]=n[o],t[n.charCodeAt(o)]=o;function h(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return-1===e&&(e=t),[e,e===t?0:4-e%4]}function u(r){var t=h(r),e=t[0],n=t[1];return 3*(e+n)/4-n}function c(r,t,e){return 3*(t+e)/4-e}function i(r){for(var n,o=h(r),a=o[0],u=o[1],i=new e(c(r,a,u)),f=0,A=u>0?a-4:a,d=0;d<A;d+=4)n=t[r.charCodeAt(d)]<<18|t[r.charCodeAt(d+1)]<<12|t[r.charCodeAt(d+2)]<<6|t[r.charCodeAt(d+3)],i[f++]=n>>16&255,i[f++]=n>>8&255,i[f++]=255&n;return 2===u&&(n=t[r.charCodeAt(d)]<<2|t[r.charCodeAt(d+1)]>>4,i[f++]=255&n),1===u&&(n=t[r.charCodeAt(d)]<<10|t[r.charCodeAt(d+1)]<<4|t[r.charCodeAt(d+2)]>>2,i[f++]=n>>8&255,i[f++]=255&n),i}function f(t){return r[t>>18&63]+r[t>>12&63]+r[t>>6&63]+r[63&t]}function A(r,t,e){for(var n,o=[],a=t;a<e;a+=3)n=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(255&r[a+2]),o.push(f(n));return o.join("")}function d(t){for(var e,n=t.length,o=n%3,a=[],h=0,u=n-o;h<u;h+=16383)a.push(A(t,h,h+16383>u?u:h+16383));return 1===o?(e=t[n-1],a.push(r[e>>2]+r[e<<4&63]+"==")):2===o&&(e=(t[n-2]<<8)+t[n-1],a.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),a.join("")}t["-".charCodeAt(0)]=62,t["_".charCodeAt(0)]=63;
5},{}],"Quj6":[function(require,module,exports) {
6exports.read=function(a,o,t,r,h){var M,p,w=8*h-r-1,f=(1<<w)-1,e=f>>1,i=-7,N=t?h-1:0,n=t?-1:1,s=a[o+N];for(N+=n,M=s&(1<<-i)-1,s>>=-i,i+=w;i>0;M=256*M+a[o+N],N+=n,i-=8);for(p=M&(1<<-i)-1,M>>=-i,i+=r;i>0;p=256*p+a[o+N],N+=n,i-=8);if(0===M)M=1-e;else{if(M===f)return p?NaN:1/0*(s?-1:1);p+=Math.pow(2,r),M-=e}return(s?-1:1)*p*Math.pow(2,M-r)},exports.write=function(a,o,t,r,h,M){var p,w,f,e=8*M-h-1,i=(1<<e)-1,N=i>>1,n=23===h?Math.pow(2,-24)-Math.pow(2,-77):0,s=r?0:M-1,u=r?1:-1,l=o<0||0===o&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(w=isNaN(o)?1:0,p=i):(p=Math.floor(Math.log(o)/Math.LN2),o*(f=Math.pow(2,-p))<1&&(p--,f*=2),(o+=p+N>=1?n/f:n*Math.pow(2,1-N))*f>=2&&(p++,f/=2),p+N>=i?(w=0,p=i):p+N>=1?(w=(o*f-1)*Math.pow(2,h),p+=N):(w=o*Math.pow(2,N-1)*Math.pow(2,h),p=0));h>=8;a[t+s]=255&w,s+=u,w/=256,h-=8);for(p=p<<h|w,e+=h;e>0;a[t+s]=255&p,s+=u,p/=256,e-=8);a[t+s-u]|=128*l};
7},{}],"aq/z":[function(require,module,exports) {
8var r={}.toString;module.exports=Array.isArray||function(t){return"[object Array]"==r.call(t)};
9},{}],"aMB2
vendor: 19,947 bytes, lines 9-13
9":[function(require,module,exports) {
10
11var global = arguments[3];
12var t=arguments[3],r=require("base64-js"),e=require("ieee754"),n=require("isarray");function i(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(r){return!1}}function o(){return f.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(t,r){if(o()<r)throw new RangeError("Invalid typed array length");return f.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(r)).__proto__=f.prototype:(null===t&&(t=new f(r)),t.length=r),t}function f(t,r,e){if(!(f.TYPED_ARRAY_SUPPORT||this instanceof f))return new f(t,r,e);if("number"==typeof t){if("string"==typeof r)throw new Error("If encoding is specified then the first argument must be a string");return c(this,t)}return s(this,t,r,e)}function s(t,r,e,n){if("number"==typeof r)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&r instanceof ArrayBuffer?g(t,r,e,n):"string"==typeof r?l(t,r,e):y(t,r)}function h(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function a(t,r,e,n){return h(r),r<=0?u(t,r):void 0!==e?"string"==typeof n?u(t,r).fill(e,n):u(t,r).fill(e):u(t,r)}function c(t,r){if(h(r),t=u(t,r<0?0:0|w(r)),!f.TYPED_ARRAY_SUPPORT)for(var e=0;e<r;++e)t[e]=0;return t}function l(t,r,e){if("string"==typeof e&&""!==e||(e="utf8"),!f.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');var n=0|v(r,e),i=(t=u(t,n)).write(r,e);return i!==n&&(t=t.slice(0,i)),t}function p(t,r){var e=r.length<0?0:0|w(r.length);t=u(t,e);for(var n=0;n<e;n+=1)t[n]=255&r[n];return t}function g(t,r,e,n){if(r.byteLength,e<0||r.byteLength<e)throw new RangeError("'offset' is out of bounds");if(r.byteLength<e+(n||0))throw new RangeError("'length' is out of bounds");return r=void 0===e&&void 0===n?new Uint8Array(r):void 0===n?new Uint8Array(r,e):new Uint8Array(r,e,n),f.TYPED_ARRAY_SUPPORT?(t=r).__proto__=f.prototype:t=p(t,r),t}function y(t,r){if(f.isBuffer(r)){var e=0|w(r.length);return 0===(t=u(t,e)).length?t:(r.copy(t,0,0,e),t)}if(r){if("undefined"!=typeof ArrayBuffer&&r.buffer instanceof ArrayBuffer||"length"in r)return"number"!=typeof r.length||W(r.length)?u(t,0):p(t,r);if("Buffer"===r.type&&n(r.data))return p(t,r.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function w(t){if(t>=o())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+o().toString(16)+" bytes");return 0|t}function d(t){return+t!=t&&(t=0),f.alloc(+t)}function v(t,r){if(f.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var e=t.length;if(0===e)return 0;for(var n=!1;;)switch(r){case"ascii":case"latin1":case"binary":return e;case"utf8":case"utf-8":case void 0:return $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*e;case"hex":return e>>>1;case"base64":return K(t).length;default:if(n)return $(t).length;r=(""+r).toLowerCase(),n=!0}}function E(t,r,e){var n=!1;if((void 0===r||r<0)&&(r=0),r>this.length)return"";if((void 0===e||e>this.length)&&(e=this.length),e<=0)return"";if((e>>>=0)<=(r>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return x(this,r,e);case"utf8":case"utf-8":return Y(this,r,e);case"ascii":return L(this,r,e);case"latin1":case"binary":return D(this,r,e);case"base64":return S(this,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return C(this,r,e);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function b(t,r,e){var n=t[r];t[r]=t[e],t[e]=n}function R(t,r,e,n,i){if(0===t.length)return-1;if("string"==typeof e?(n=e,e=0):e>2147483647?e=2147483647:e<-2147483648&&(e=-2147483648),e=+e,isNaN(e)&&(e=i?0:t.length-1),e<0&&(e=t.length+e),e>=t.length){if(i)return-1;e=t.length-1}else if(e<0){if(!i)return-1;e=0}if("string"==typeof r&&(r=f.from(r,n)),f.isBuffer(r))return 0===r.length?-1:_(t,r,e,n,i);if("number"==typeof r)return r&=255,f.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,r,e):Uint8Array.prototype.lastIndexOf.call(t,r,e):_(t,[r],e,n,i);throw new TypeError("val must be string, number or Buffer")}function _(t,r,e,n,i){var o,u=1,f=t.length,s=r.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||r.length<2)return-1;u=2,f/=2,s/=2,e/=2}function h(t,r){return 1===u?t[r]:t.readUInt16BE(r*u)}if(i){var a=-1;for(o=e;o<f;o++)if(h(t,o)===h(r,-1===a?0:o-a)){if(-1===a&&(a=o),o-a+1===s)return a*u}else-1!==a&&(o-=o-a),a=-1}else for(e+s>f&&(e=f-s),o=e;o>=0;o--){for(var c=!0,l=0;l<s;l++)if(h(t,o+l)!==h(r,l)){c=!1;break}if(c)return o}return-1}function A(t,r,e,n){e=Number(e)||0;var i=t.length-e;n?(n=Number(n))>i&&(n=i):n=i;var o=r.length;if(o%2!=0)throw new TypeError("Invalid hex string");n>o/2&&(n=o/2);for(var u=0;u<n;++u){var f=parseInt(r.substr(2*u,2),16);if(isNaN(f))return u;t[e+u]=f}return u}function m(t,r,e,n){return Q($(r,t.length-e),t,e,n)}function P(t,r,e,n){return Q(G(r),t,e,n)}function T(t,r,e,n){return P(t,r,e,n)}function B(t,r,e,n){return Q(K(r),t,e,n)}function U(t,r,e,n){return Q(H(r,t.length-e),t,e,n)}function S(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function Y(t,r,e){e=Math.min(t.length,e);for(var n=[],i=r;i<e;){var o,u,f,s,h=t[i],a=null,c=h>239?4:h>223?3:h>191?2:1;if(i+c<=e)switch(c){case 1:h<128&&(a=h);break;case 2:128==(192&(o=t[i+1]))&&(s=(31&h)<<6|63&o)>127&&(a=s);break;case 3:o=t[i+1],u=t[i+2],128==(192&o)&&128==(192&u)&&(s=(15&h)<<12|(63&o)<<6|63&u)>2047&&(s<55296||s>57343)&&(a=s);break;case 4:o=t[i+1],u=t[i+2],f=t[i+3],128==(192&o)&&128==(192&u)&&128==(192&f)&&(s=(15&h)<<18|(63&o)<<12|(63&u)<<6|63&f)>65535&&s<1114112&&(a=s)}null===a?(a=65533,c=1):a>65535&&(a-=65536,n.push(a>>>10&1023|55296),a=56320|1023&a),n.push(a),i+=c}return O(n)}exports.Buffer=f,exports.SlowBuffer=d,exports.INSPECT_MAX_BYTES=50,f.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:i(),exports.kMaxLength=o(),f.poolSize=8192,f._augment=function(t){return t.__proto__=f.prototype,t},f.from=function(t,r,e){return s(null,t,r,e)},f.TYPED_ARRAY_SUPPORT&&(f.prototype.__proto__=Uint8Array.prototype,f.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&f[Symbol.species]===f&&Object.defineProperty(f,Symbol.species,{value:null,configurable:!0})),f.alloc=function(t,r,e){return a(null,t,r,e)},f.allocUnsafe=function(t){return c(null,t)},f.allocUnsafeSlow=function(t){return c(null,t)},f.isBuffer=function(t){return!(null==t||!t._isBuffer)},f.compare=function(t,r){if(!f.isBuffer(t)||!f.isBuffer(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var e=t.length,n=r.length,i=0,o=Math.min(e,n);i<o;++i)if(t[i]!==r[i]){e=t[i],n=r[i];break}return e<n?-1:n<e?1:0},f.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},f.concat=function(t,r){if(!n(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return f.alloc(0);var e;if(void 0===r)for(r=0,e=0;e<t.length;++e)r+=t[e].length;var i=f.allocUnsafe(r),o=0;for(e=0;e<t.length;++e){var u=t[e];if(!f.isBuffer(u))throw new TypeError('"list" argument must be an Array of Buffers');u.copy(i,o),o+=u.length}return i},f.byteLength=v,f.prototype._isBuffer=!0,f.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r<t;r+=2)b(this,r,r+1);return this},f.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var r=0;r<t;r+=4)b(this,r,r+3),b(this,r+1,r+2);return this},f.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var r=0;r<t;r+=8)b(this,r,r+7),b(this,r+1,r+6),b(this,r+2,r+5),b(this,r+3,r+4);return this},f.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?Y(this,0,t):E.apply(this,arguments)},f.prototype.equals=function(t){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===f.compare(this,t)},f.prototype.inspect=function(){var t="",r=exports.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),"<Buffer "+t+">"},f.prototype.compare=function(t,r,e,n,i){if(!f.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===r&&(r=0),void 0===e&&(e=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),r<0||e>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&r>=e)return 0;if(n>=i)return-1;if(r>=e)return 1;if(this===t)return 0;for(var o=(i>>>=0)-(n>>>=0),u=(e>>>=0)-(r>>>=0),s=Math.min(o,u),h=this.slice(n,i),a=t.slice(r,e),c=0;c<s;++c)if(h[c]!==a[c]){o=h[c],u=a[c];break}return o<u?-1:u<o?1:0},f.prototype.includes=function(t,r,e){return-1!==this.indexOf(t,r,e)},f.prototype.indexOf=function(t,r,e){return R(this,t,r,e,!0)},f.prototype.lastIndexOf=function(t,r,e){return R(this,t,r,e,!1)},f.prototype.write=function(t,r,e,n){if(void 0===r)n="utf8",e=this.length,r=0;else if(void 0===e&&"string"==typeof r)n=r,e=this.length,r=0;else{if(!isFinite(r))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");r|=0,isFinite(e)?(e|=0,void 0===n&&(n="utf8")):(n=e,e=void 0)}var i=this.length-r;if((void 0===e||e>i)&&(e=i),t.length>0&&(e<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");for(var o=!1;;)switch(n){case"hex":return A(this,t,r,e);case"utf8":case"utf-8":return m(this,t,r,e);case"ascii":return P(this,t,r,e);case"latin1":case"binary":return T(this,t,r,e);case"base64":return B(this,t,r,e);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return U(this,t,r,e);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var I=4096;function O(t){var r=t.length;if(r<=I)return String.fromCharCode.apply(String,t);for(var e="",n=0;n<r;)e+=String.fromCharCode.apply(String,t.slice(n,n+=I));return e}function L(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(127&t[i]);return n}function D(t,r,e){var n="";e=Math.min(t.length,e);for(var i=r;i<e;++i)n+=String.fromCharCode(t[i]);return n}function x(t,r,e){var n=t.length;(!r||r<0)&&(r=0),(!e||e<0||e>n)&&(e=n);for(var i="",o=r;o<e;++o)i+=Z(t[o]);return i}function C(t,r,e){for(var n=t.slice(r,e),i="",o=0;o<n.length;o+=2)i+=String.fromCharCode(n[o]+256*n[o+1]);return i}function M(t,r,e){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+r>e)throw new RangeError("Trying to access beyond buffer length")}function k(t,r,e,n,i,o){if(!f.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(r>i||r<o)throw new RangeError('"value" argument is out of bounds');if(e+n>t.length)throw new RangeError("Index out of range")}function N(t,r,e,n){r<0&&(r=65535+r+1);for(var i=0,o=Math.min(t.length-e,2);i<o;++i)t[e+i]=(r&255<<8*(n?i:1-i))>>>8*(n?i:1-i)}function z(t,r,e,n){r<0&&(r=4294967295+r+1);for(var i=0,o=Math.min(t.length-e,4);i<o;++i)t[e+i]=r>>>8*(n?i:3-i)&255}function F(t,r,e,n,i,o){if(e+n>t.length)throw new RangeError("Index out of range");if(e<0)throw new RangeError("Index out of range")}function j(t,r,n,i,o){return o||F(t,r,n,4,3.4028234663852886e38,-3.4028234663852886e38),e.write(t,r,n,i,23,4),n+4}function q(t,r,n,i,o){return o||F(t,r,n,8,1.7976931348623157e308,-1.7976931348623157e308),e.write(t,r,n,i,52,8),n+8}f.prototype.slice=function(t,r){var e,n=this.length;if((t=~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),(r=void 0===r?n:~~r)<0?(r+=n)<0&&(r=0):r>n&&(r=n),r<t&&(r=t),f.TYPED_ARRAY_SUPPORT)(e=this.subarray(t,r)).__proto__=f.prototype;else{var i=r-t;e=new f(i,void 0);for(var o=0;o<i;++o)e[o]=this[o+t]}return e},f.prototype.readUIntLE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n},f.prototype.readUIntBE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=this[t+--r],i=1;r>0&&(i*=256);)n+=this[t+--r]*i;return n},f.prototype.readUInt8=function(t,r){return r||M(t,1,this.length),this[t]},f.prototype.readUInt16LE=function(t,r){return r||M(t,2,this.length),this[t]|this[t+1]<<8},f.prototype.readUInt16BE=function(t,r){return r||M(t,2,this.length),this[t]<<8|this[t+1]},f.prototype.readUInt32LE=function(t,r){return r||M(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},f.prototype.readUInt32BE=function(t,r){return r||M(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},f.prototype.readIntLE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=this[t],i=1,o=0;++o<r&&(i*=256);)n+=this[t+o]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*r)),n},f.prototype.readIntBE=function(t,r,e){t|=0,r|=0,e||M(t,r,this.length);for(var n=r,i=1,o=this[t+--n];n>0&&(i*=256);)o+=this[t+--n]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*r)),o},f.prototype.readInt8=function(t,r){return r||M(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},f.prototype.readInt16LE=function(t,r){r||M(t,2,this.length);var e=this[t]|this[t+1]<<8;return 32768&e?4294901760|e:e},f.prototype.readInt16BE=function(t,r){r||M(t,2,this.length);var e=this[t+1]|this[t]<<8;return 32768&e?4294901760|e:e},f.prototype.readInt32LE=function(t,r){return r||M(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},f.prototype.readInt32BE=function(t,r){return r||M(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},f.prototype.readFloatLE=function(t,r){return r||M(t,4,this.length),e.read(this,t,!0,23,4)},f.prototype.readFloatBE=function(t,r){return r||M(t,4,this.length),e.read(this,t,!1,23,4)},f.prototype.readDoubleLE=function(t,r){return r||M(t,8,this.length),e.read(this,t,!0,52,8)},f.prototype.readDoubleBE=function(t,r){return r||M(t,8,this.length),e.read(this,t,!1,52,8)},f.prototype.writeUIntLE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||k(this,t,r,e,Math.pow(2,8*e)-1,0);var i=1,o=0;for(this[r]=255&t;++o<e&&(i*=256);)this[r+o]=t/i&255;return r+e},f.prototype.writeUIntBE=function(t,r,e,n){(t=+t,r|=0,e|=0,n)||k(this,t,r,e,Math.pow(2,8*e)-1,0);var i=e-1,o=1;for(this[r+i]=255&t;--i>=0&&(o*=256);)this[r+i]=t/o&255;return r+e},f.prototype.writeUInt8=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,1,255,0),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=255&t,r+1},f.prototype.writeUInt16LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):N(this,t,r,!0),r+2},f.prototype.writeUInt16BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,65535,0),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):N(this,t,r,!1),r+2},f.prototype.writeUInt32LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=255&t):z(this,t,r,!0),r+4},f.prototype.writeUInt32BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,4294967295,0),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):z(this,t,r,!1),r+4},f.prototype.writeIntLE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);k(this,t,r,e,i-1,-i)}var o=0,u=1,f=0;for(this[r]=255&t;++o<e&&(u*=256);)t<0&&0===f&&0!==this[r+o-1]&&(f=1),this[r+o]=(t/u>>0)-f&255;return r+e},f.prototype.writeIntBE=function(t,r,e,n){if(t=+t,r|=0,!n){var i=Math.pow(2,8*e-1);k(this,t,r,e,i-1,-i)}var o=e-1,u=1,f=0;for(this[r+o]=255&t;--o>=0&&(u*=256);)t<0&&0===f&&0!==this[r+o+1]&&(f=1),this[r+o]=(t/u>>0)-f&255;return r+e},f.prototype.writeInt8=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,1,127,-128),f.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=255&t,r+1},f.prototype.writeInt16LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8):N(this,t,r,!0),r+2},f.prototype.writeInt16BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,2,32767,-32768),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=255&t):N(this,t,r,!1),r+2},f.prototype.writeInt32LE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,2147483647,-2147483648),f.TYPED_ARRAY_SUPPORT?(this[r]=255&t,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):z(this,t,r,!0),r+4},f.prototype.writeInt32BE=function(t,r,e){return t=+t,r|=0,e||k(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),f.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=255&t):z(this,t,r,!1),r+4},f.prototype.writeFloatLE=function(t,r,e){return j(this,t,r,!0,e)},f.prototype.writeFloatBE=function(t,r,e){return j(this,t,r,!1,e)},f.prototype.writeDoubleLE=function(t,r,e){return q(this,t,r,!0,e)},f.prototype.writeDoubleBE=function(t,r,e){return q(this,t,r,!1,e)},f.prototype.copy=function(t,r,e,n){if(e||(e=0),n||0===n||(n=this.length),r>=t.length&&(r=t.length),r||(r=0),n>0&&n<e&&(n=e),n===e)return 0;if(0===t.length||0===this.length)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(e<0||e>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-r<n-e&&(n=t.length-r+e);var i,o=n-e;if(this===t&&e<r&&r<n)for(i=o-1;i>=0;--i)t[i+r]=this[i+e];else if(o<1e3||!f.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)t[i+r]=this[i+e];else Uint8Array.prototype.set.call(t,this.subarray(e,e+o),r);return o},f.prototype.fill=function(t,r,e,n){if("string"==typeof t){if("string"==typeof r?(n=r,r=0,e=this.length):"string"==typeof e&&(n=e,e=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!f.isEncoding(n))throw new TypeError("Unknown encoding: "+n)}else"number"==typeof t&&(t&=255);if(r<0||this.length<r||this.length<e)throw new RangeError("Out of range index");if(e<=r)return this;var o;if(r>>>=0,e=void 0===e?this.length:e>>>0,t||(t=0),"number"==typeof t)for(o=r;o<e;++o)this[o]=t;else{var u=f.isBuffer(t)?t:$(new f(t,n).toString()),s=u.length;for(o=0;o<e-r;++o)this[o+r]=u[o%s]}return this};var V=/[^+\/0-9A-Za-z-_]/g;function X(t){if((t=J(t).replace(V,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}function J(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function Z(t){return t<16?"0"+t.toString(16):t.toString(16)}function $(t,r){var e;r=r||1/0;for(var n=t.length,i=null,o=[],u=0;u<n;++u){if((e=t.charCodeAt(u))>55295&&e<57344){if(!i){if(e>56319){(r-=3)>-1&&o.push(239,191,189);continue}if(u+1===n){(r-=3)>-1&&o.push(239,191,189);continue}i=e;continue}if(e<56320){(r-=3)>-1&&o.push(239,191,189),i=e;continue}e=65536+(i-55296<<10|e-56320)}else i&&(r-=3)>-1&&o.push(239,191,189);if(i=null,e<128){if((r-=1)<0)break;o.push(e)}else if(e<2048){if((r-=2)<0)break;o.push(e>>6|192,63&e|128)}else if(e<65536){if((r-=3)<0)break;o.push(e>>12|224,e>>6&63|128,63&e|128)}else{if(!(e<1114112))throw new Error("Invalid code point");if((r-=4)<0)break;o.push(e>>18|240,e>>12&63|128,e>>6&63|128,63&e|128)}}return o}function G(t){for(var r=[],e=0;e<t.length;++e)r.push(255&t.charCodeAt(e));return r}function H(t,r){for(var e,n,i,o=[],u=0;u<t.length&&!((r-=2)<0);++u)n=(e=t.charCodeAt(u))>>8,i=e%256,o.push(i),o.push(n);return o}function K(t){return r.toByteArray(X(t))}function Q(t,r,e,n){for(var i=0;i<n&&!(i+e>=r.length||i>=t.length);++i)r[i+e]=t[i];return i}function W(t){return t!=t}
13},{"base64-js":"
13FRly","ieee754":"Quj6","isarray":"aq/z","buffer":"aMB2"}],"g5I+":[function(require,module,exports) {
14
15var t,e,n=module.exports={};function r(){throw new Error("setTimeout has not been defined")}function o(){throw new Error("clearTimeout has not been defined")}function i(e){if(t===setTimeout)return setTimeout(e,0);if((t===r||!t)&&setTimeout)return t=setTimeout,setTimeout(e,0);try{return t(e,0)}catch(n){try{return t.call(null,e,0)}catch(n){return t.call(this,e,0)}}}function u(t){if(e===clearTimeout)return clearTimeout(t);if((e===o||!e)&&clearTimeout)return e=clearTimeout,clearTimeout(t);try{return e(t)}catch(n){try{return e.call(null,t)}catch(n){return e.call(this,t)}}}!function(){try{t="function"==typeof setTimeout?setTimeout:r}catch(n){t=r}try{e="function"==typeof clearTimeout?clearTimeout:o}catch(n){e=o}}();var c,s=[],l=!1,a=-1;function f(){l&&c&&(l=!1,c.length?s=c.concat(s):a=-1,s.length&&h())}function h(){if(!l){var t=i(f);l=!0;for(var e=s.length;e;){for(c=s,s=[];++a<e;)c&&c[a].run();a=-1,e=s.length}c=null,l=!1,u(t)}}function m(t,e){this.fun=t,this.array=e}function p(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];s.push(new m(t,e)),1!==s.length||l||i(h)},m.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.env={},n.argv=[],n.version="",n.versions={},n.on=p,n.addListener=p,n.once=p,n.off=p,n.removeListener=p,n.removeAllListeners=p,n.emit=p,n.prependListener=p,n.prependOnceListener=p,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0};
16},{}],"8rnl":[function(require,module,exports) {
17var define;
18var global = arguments[3];
19var Buffer = require("buffer").Buffer;
20var process = require("process");
21var e,t=arguments[3],n=require("buffer").Buffer,a=require("process");!function(n){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=n();else if("function"==typeof e&&e.amd)e([],n);else{("undefined"!=typeof window?window:void 0!==t?t:"undefined"!=typeof self?self:this).p5=n()}}(function(){return function(){return function e(t,n,a){function o(r,s){if(!n[r]){if(!t[r]){var l="function"==typeof require&&require;if(!s&&l)return l(r,!0);if(i)return i(r,!0);var p=new Error("Cannot find module '"+r+"'");throw p.code="MODULE_NOT_FOUND",p}var d=n[r]={exports:{}};t[r][0].call(d.exports,function(e){return o(t[r][1][e]||e)},d,d.exports,e,t,n,a)}return n[r].exports}for(var i="function"==typeof require&&require,r=0;r<a.length;r++)o(a[r]);return o}}()({1:[function(e,t,n){t.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.9.0",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/shape/2d_primitives.js":{name:"src/core/shape/2d_primitives.js",modules:{"2D Primitives":1},classes:{},fors:{p5:1},namespaces:{}},"src/core/shape/attributes.js":{name:"src/core/shape/attributes.js",modules:{Attributes:1},classes:{},fors:{p5:1},namespaces:{}},"src/core/shape/curves.js":{name:"src/core/shape/curves.js",modules:{Curves:1},classes:{},fors:{p5:1},namespaces:{}},"src/core/shape/vertex.js":{name:"src/core/shape/vertex.js",modules:{Vertex:1},classes:{},fors:{p5:1},namespaces:{}},"src/core/constants.js":{name:"src/core/constants.js",modules:{Constants: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/helpers.js":{name:"src/core/helpers.js",modules:{},classes:{},fors:{},namespaces:{}},"src/core/init.js":{name:"src/core/init.js",modules:{},classes:{},fors:{},namespaces:{}},"src/core/legacy.js":{name:"src/core/legacy.js",modules:{},classes:{},fors:{p5:1},namespaces:{}},"src/core/main.js":{name:"src/core/main.js",modules:{Structure:1},classes:{p5:1},fors:{p5:1},namespaces:{}},"src/core/p5.Element.js":{name:"src/core/p5.Element.js",modules:{DOM:1},classes:{"p5.Element":1},fors:{"p5.Element":1},namespaces:{}},"src/core/p5.Graphics.js":{name:"src/core/p5.Graphics.js",modules:{Rendering:1},classes:{"p5.Graphics":1},fors:{p5:1},namespaces:{}},"src/core/p5.Renderer.js":{name:"src/core/p5.Renderer.js",modules:{},classes:{"p5.Renderer":1},fors:{p5:1},namespaces:{}},"src/core/p5.Renderer2D.js":{name:"src/core/p5.Renderer2D.js",modules:{},classes:{},fors:{},namespaces:{}},"src/core/rendering.js":{name:"src/core/rendering.js",modules:{},classes:{},fors:{p5:1},namespaces:{}},"src/core/shim.js":{name:"src/core/shim.js",modules:{},classes:{},fors:{},namespaces:{}},"src/core/structure.js":{name:"src/core/structure.js",modules:{},classes:{},fors:{p5:1},namespaces:{}},"src/core/transform.js":{name:"src/core/transform.js",modules:{Transform:1},classes:{},fors:{p5:1},namespaces:{}},"src/data/local_storage.js":{name:"src/data/local_storage.js",modules:{LocalStorage: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,p5:1},namespaces:{}},"src/events/acceleration.js":{name:"src/events/acceleration.js",modules:{Acceleration:1},classes:{},fors:{p5:1},namespaces:{}},"src/events/keyboard.js":{name:"src/events/keyboard.js",modules:{Keyboard:1},classes:{},fors:{p5:1},namespaces:{}},"src/events/mouse.js":{name:"src/events/mouse.js",modules:{Mouse:1},classes:{},fors:{p5:1},namespaces:{}},"src/events/touch.js":{name:"src/events/touch.js",modules:{Touch:1},classes:{},fors:{p5:1},namespaces:{}},"src/image/filters.js":{name:"src/image/filters.js",modules:{},classes:{},fors:{},namespaces:{}},"src/image/image.js":{name:"src/image/image.js",modules:{Image:1},classes:{},fors:{p5:1},namespaces:{}},"src/image/loading_displaying.js":{name:"src/image/loading_displaying.js",modules:{"Loading & Displaying":1},classes:{},fors:{p5:1},namespaces:{}},"src/image/p5.Image.js":{name:"src/image/p5.Image.js",modules:{},classes:{"p5.Image":1},fors:{},namespaces:{}},"src/image/pixels.js":{name:"src/image/pixels.js",modules:{Pixels:1},classes:{},fors:{p5:1},namespaces:{}},"src/io/files.js":{name:"src/io/files.js",modules:{Input:1,Output:1}
21,classes:{"p5.PrintWriter":1},fors:{p5:1},namespaces:{}},"src/io/p5.Table.js":{name:"src/io/p5.Table.js",modules:{Table:1},classes:{"p5.Table":1},fors:{},namespaces:{}},"src/io/p5.TableRow.js":{name:"src/io/p5.TableRow.js",modules:{},classes:{"p5.TableRow":1},fors:{},namespaces:{}},"src/io/p5.XML.js":{name:"src/io/p5.XML.js",modules:{XML:1},classes:{"p5.XML":1},fors:{},namespaces:{}},"src/math/calculation.js":{name:"src/math/calculation.js",modules:{Calculation:1},classes:{},fors:{p5:1},namespaces:{}},"src/math/math.js":{name:"src/math/math.js",modules:{Math:1},classes:{},fors:{p5:1},namespaces:{}},"src/math/noise.js":{name:"src/math/noise.js",modules:{Noise:1},classes:{},fors:{p5:1},namespaces:{}},"src/math/p5.Vector.js":{name:"src/math/p5.Vector.js",modules:{},classes:{"p5.Vector":1},fors:{},namespaces:{}},"src/math/random.js":{name:"src/math/random.js",modules:{Random:1},classes:{},fors:{p5:1},namespaces:{}},"src/math/trigonometry.js":{name:"src/math/trigonometry.js",modules:{Trigonometry:1},classes:{},fors:{p5:1},namespaces:{}},"src/typography/attributes.js":{name:"src/typography/attributes.js",modules:{},classes:{},fors:{p5:1},namespaces:{}},"src/typography/loading_displaying.js":{name:"src/typography/loading_displaying.js",modules:{},classes:{},fors:{p5:1},namespaces:{}},"src/typography/p5.Font.js":{name:"src/typography/p5.Font.js",modules:{Font:1},classes:{"p5.Font":1},fors:{},namespaces:{}},"src/utilities/array_functions.js":{name:"src/utilities/array_functions.js",modules:{"Array Functions":1},classes:{},fors:{p5:1},namespaces:{}},"src/utilities/conversion.js":{name:"src/utilities/conversion.js",modules:{Conversion:1},classes:{},fors:{p5:1},namespaces:{}},"src/utilities/string_functions.js":{name:"src/utilities/string_functions.js",modules:{"String Functions":1},classes:{},fors:{p5:1},namespaces:{}},"src/utilities/time_date.js":{name:"src/utilities/time_date.js",modules:{"Time & Date":1},classes:{},fors:{p5:1},namespaces:{}},"src/webgl/3d_primitives.js":{name:"src/webgl/3d_primitives.js",modules:{"3D Primitives":1},classes:{},fors:{p5:1},namespaces:{}},"src/webgl/interaction.js":{name:"src/webgl/interaction.js",modules:{Interaction:1},classes:{},fors:{p5:1},namespaces:{}},"src/webgl/light.js":{name:"src/webgl/light.js",modules:{Lights:1},classes:{},fors:{p5:1},namespaces:{}},"src/webgl/loading.js":{name:"src/webgl/loading.js",modules:{"3D Models":1},classes:{},fors:{p5:1},namespaces:{}},"src/webgl/material.js":{name:"src/webgl/material.js",modules:{Material:1},classes:{},fors:{p5:1},namespaces:{}},"src/webgl/p5.Camera.js":{name:"src/webgl/p5.Camera.js",modules:{Camera:1},classes:{"p5.Camera":1},fors:{p5:1,"p5.Camera":1},namespaces:{}},"src/webgl/p5.Geometry.js":{name:"src/webgl/p5.Geometry.js",modules:{},classes:{"p5.Geometry":1},fors:{},namespaces:{}},"src/webgl/p5.Matrix.js":{name:"src/webgl/p5.Matrix.js",modules:{},classes:{"p5.Matrix":1},fors:{},namespaces:{}},"src/webgl/p5.RendererGL.Immediate.js":{name:"src/webgl/p5.RendererGL.Immediate.js",modules:{},classes:{},fors:{},namespaces:{}},"src/webgl/p5.RendererGL.Retained.js":{name:"src/webgl/p5.RendererGL.Retained.js",modules:{},classes:{},fors:{},namespaces:{}},"src/webgl/p5.RendererGL.js":{name:"src/webgl/p5.RendererGL.js",modules:{},classes:{"p5.RendererGL":1},fors:{p5:1},namespaces:{}},"src/webgl/p5.Shader.js":{name:"src/webgl/p5.Shader.js",modules:{Shaders:1},classes:{"p5.Shader":1},fors:{p5:1},namespaces:{}},"src/webgl/p5.Texture.js":{name:"src/webgl/p5.Texture.js",modules:{},classes:{"p5.Texture":1},fors:{p5:1},namespaces:{}},"src/webgl/text.js":{name:"src/webgl/text.js",modules:{},classes:{ImageInfos:1,FontInfo:1,Cubic:1},fors:{},namespaces:{}},"lib/addons/p5.dom.js":{name:"lib/addons/p5.dom.js",modules:{"p5.dom":1},classes:{"p5.MediaElement":1,"p5.File":1},fors:{p5:1,"p5.Element":1},namespaces:{}},"lib/addons/p5.sound.js":{name:"lib/addons/p5.sound.js",modules:{"p5.sound":1},classes:{"p5.SoundFile":1,"p5.Amplitude":1,"p5.FFT":1,"p5.Signal":1,"p5.Oscillator":1,"p5.SinOsc":1,"p5.TriOsc":1,"p5.SawOsc":1,"p5.SqrOsc":1,"p5.Envelope":1,"p5.Pulse":1,"p5.Noise":1,"p5.AudioIn":1,"p5.Effe
21ct":1,"p5.Filter":1,"p5.LowPass":1,"p5.HighPass":1,"p5.BandPass":1,"p5.EQ":1,"p5.Panner3D":1,"p5.Delay":1,"p5.Reverb":1,"p5.Convolver":1,"p5.Phrase":1,"p5.Part":1,"p5.Score":1,"p5.SoundLoop":1,"p5.Compressor":1,"p5.SoundRecorder":1,"p5.PeakDetect":1,"p5.Gain":1,"p5.AudioVoice":1,"p5.MonoSynth":1,"p5.PolySynth":1,"p5.Distortion":1},fors:{"p5.sound":1,p5:1},namespaces:{}},"lib/addons/p5.sound.min.js":{name:"lib/addons/p5.sound.min.js",modules:{},classes:{},fors:{},namespaces:{}}},modules:{Color:{name:"Color",submodules:{"Color Conversion":1,"Creating & Reading":1,Setting:1},elements:{},classes:{"p5.Color":1},fors:{p5:1},namespaces:{},file:"src/color/p5.Color.js",line:16},"Color Conversion":{name:"Color Conversion",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Color",namespace:"",file:"src/color/color_conversion.js",line:1,requires:["core"]},"Creating & Reading":{name:"Creating & Reading",submodules:{},elements:{},classes:{"p5.Color":1},fors:{p5:1},is_submodule:1,namespaces:{},module:"Color",namespace:"",file:"src/color/p5.Color.js",line:16,requires:["core","constants"],description:'<p>Each color stores the color mode and level maxes that applied at the\ntime of its construction. These are used to interpret the input arguments\n(at construction and later for that instance of color) and to format the\noutput e.g. when <a href="#/p5/saturation">saturation()</a> is requested.</p>\n<p>Internally we store an array representing the ideal RGBA values in floating\npoint form, normalized from 0 to 1. From this we calculate the closest\nscreen color (RGBA levels from 0 to 255) and expose this to the renderer.</p>\n<p>We also cache normalized, floating point components of the color in various\nrepresentations as they are calculated. This is done to prevent repeating a\nconversion that has already been performed.</p>\n'},Setting:{name:"Setting",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Color",namespace:"",file:"src/color/setting.js",line:1,requires:["core","constants"]},Shape:{name:"Shape",submodules:{"2D Primitives":1,Curves:1,Vertex:1,"3D Primitives":1,"3D Models":1},elements:{},classes:{},fors:{p5:1},namespaces:{}},"2D Primitives":{name:"2D Primitives",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Shape",namespace:"",file:"src/core/shape/2d_primitives.js",line:1,requires:["core","constants"]},Attributes:{name:"Attributes",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Typography",namespace:"",file:"src/core/shape/attributes.js",line:1,requires:["core","constants"]},Curves:{name:"Curves",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Shape",namespace:"",file:"src/core/shape/curves.js",line:1,requires:["core"]},Vertex:{name:"Vertex",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Shape",namespace:"",file:"src/core/shape/vertex.js",line:1,requires:["core","constants"]},Constants:{name:"Constants",submodules:{},elements:{},classes:{},fors:{p5:1},namespaces:{},module:"Constants",file:"src/core/constants.js",line:1},Environment:{name:"Environment",submodules:{},elements:{},classes:{},fors:{p5:1},namespaces:{},module:"Environment",file:"src/core/environment.js",line:1,requires:["core","constants"]},Structure:{name:"Structure",submodules:{},elements:{},classes:{},fors:{p5:1},namespaces:{},module:"IO",file:"src/core/main.js",line:1,requires:["constants"]},DOM:{name:"DOM",submodules:{},elements:{},classes:{"p5.Element":1},fors:{"p5.Element":1},namespaces:{},module:"DOM",file:"src/core/p5.Element.js",line:11,description:'<p>Base class for all elements added to a sketch, including canvas,\ngraphics buffers, and other HTML elements. Methods in blue are\nincluded in the core functionality, methods in brown are added\nwith the <a href="http://p5js.org/reference/#/libraries/p5.dom">p5.dom\nlibrary</a>.\nIt is not called directly, but <a href="#/p5.Element">p5.Element</a>\nobjects are created by calling <a href="#/p5/createCanvas">createCanvas</a>, <a href="#/p5/createGraphics">createGraphics</a>,\nor in the p5.dom library, <a href="#/p5/createDiv">createDiv</a>, <a href="#/p5/createImg">createImg</a>, <a href="#/p5/createInput">createInput</a>, etc.</p>\n'},Rendering:{name:"Rendering",submodules:{undefined:1},elements:{},classes:{"p5.RendererGL":1,"p5.Graphics":1,"p5.Renderer":1},fors:{p5:1},namespaces:{},module:"Rendering",file:"src/webgl/p5.RendererGL.js",line:519,description:"<p>
21Thin wrapper around a renderer, to be used for creating a\ngraphics buffer object. Use this class if you need\nto draw into an off-screen graphics buffer. The two parameters define the\nwidth and height in pixels. The fields and methods for this class are\nextensive, but mirror the normal drawing API for p5.</p>\n"},Transform:{name:"Transform",submodules:{},elements:{},classes:{},fors:{p5:1},namespaces:{},module:"Transform",file:"src/core/transform.js",line:1,requires:["core","constants"]},Data:{name:"Data",submodules:{LocalStorage:1,Dictionary:1,"Array Functions":1,Conversion:1,"String Functions":1},elements:{},classes:{"p5.TypedDict":1,"p5.StringDict":1,"p5.NumberDict":1},fors:{p5:1,"p5.TypedDict":1},namespaces:{},file:"src/data/p5.TypedDict.js",line:422},LocalStorage:{name:"LocalStorage",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Data",namespace:"",file:"src/data/local_storage.js",line:1,requires:["core\n\nThis module defines the p5 methods for working with local storage"]},Dictionary:{name:"Dictionary",submodules:{},elements:{},classes:{"p5.TypedDict":1,"p5.StringDict":1,"p5.NumberDict":1},fors:{"p5.TypedDict":1,p5:1},is_submodule:1,namespaces:{},module:"Data",namespace:"",file:"src/data/p5.TypedDict.js",line:422,requires:["core\n\nThis module defines the p5 methods for the p5 Dictionary classes.\nThe classes StringDict and NumberDict are for storing and working\nwith key-value pairs."],description:"<p>Base class for all p5.Dictionary types. Specifically\n typed Dictionary classes inherit from this class.</p>\n"},Events:{name:"Events",submodules:{Acceleration:1,Keyboard:1,Mouse:1,Touch:1},elements:{},classes:{},fors:{p5:1},namespaces:{}},Acceleration:{name:"Acceleration",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Events",namespace:"",file:"src/events/acceleration.js",line:1,requires:["core"]},Keyboard:{name:"Keyboard",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Events",namespace:"",file:"src/events/keyboard.js",line:1,requires:["core"]},Mouse:{name:"Mouse",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Events",namespace:"",file:"src/events/mouse.js",line:1,requires:["core","constants"]},Touch:{name:"Touch",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Events",namespace:"",file:"src/events/touch.js",line:1,requires:["core"]},Image:{name:"Image",submodules:{Pixels:1},elements:{},classes:{"p5.Image":1},fors:{p5:1},namespaces:{},module:"Image",file:"src/image/p5.Image.js",line:23,requires:["core"],description:'<p>Creates a new <a href="#/p5.Image">p5.Image</a>. A <a href="#/p5.Image">p5.Image</a> 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\n<a href="#/p5/loadImage">loadImage()</a> function. The <a href="#/p5.Image">p5.Image</a> class contains fields for the width and\nheight of the image, as well as an array called <a href="#/p5.Image/pixels">pixels[]</a> that contains the\nvalues for every pixel in the image.\n<br><br>\nThe methods described below allow easy access to the image&#39;s pixels and\nalpha channel and simplify the process of compositing.\n<br><br>\nBefore using the <a href="#/p5.Image/pixels">pixels[]</a> array, be sure to use the <a href="#/p5.Image/loadPixels">loadPixels()</a> method on\nthe image to make sure that the pixel data is properly loaded.</p>\n'},"Loading & Displaying":{name:"Loading & Displaying",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Typography",namespace:"",file:"src/image/loading_displaying.js",line:1,requires:["core"]},Pixels:{name:"Pixels",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Image",namespace:"",file:"src/image/pixels.js",line:1,requires:["core"]},IO:{name:"IO",submodules:{Structure:1,Input:1,Output:1,Table:1,XML:1,"Time & Date":1},elements:{}
21,classes:{p5:1,"p5.PrintWriter":1,"p5.Table":1,"p5.TableRow":1,"p5.XML":1},fors:{p5:1},namespaces:{},file:"src/io/p5.XML.js",line:11},Input:{name:"Input",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"IO",namespace:"",file:"src/io/files.js",line:1,requires:["core"]},Output:{name:"Output",submodules:{},elements:{},classes:{p5:1,"p5.PrintWriter":1},fors:{p5:1},is_submodule:1,namespaces:{},module:"IO",namespace:"",file:"src/io/files.js",line:1238,description:'<p>This is the p5 instance constructor.</p>\n<p>A p5 instance holds all the properties and methods related to\na p5 sketch.  It expects an incoming sketch closure and it can also\ntake an optional node parameter for attaching the generated p5 canvas\nto a node.  The sketch closure takes the newly created p5 instance as\nits sole argument and may optionally set <a href="#/p5/preload">preload()</a>, <a href="#/p5/setup">setup()</a>, and/or\n<a href="#/p5/draw">draw()</a> properties on it for running a sketch.</p>\n<p>A p5 sketch can run in &quot;global&quot; or &quot;instance&quot; mode:\n&quot;global&quot;   - all properties and methods are attached to the window\n&quot;instance&quot; - all properties and methods are bound to this p5 object</p>\n'},Table:{name:"Table",submodules:{},elements:{},classes:{"p5.Table":1,"p5.TableRow":1},fors:{},is_submodule:1,namespaces:{},module:"IO",namespace:"",file:"src/io/p5.TableRow.js",line:11,requires:["core"],description:'<p><a href="#/p5.Table">Table</a> objects store data with multiple rows and columns, much\nlike in a traditional spreadsheet. Tables can be generated from\nscratch, dynamically, or using data from an existing file.</p>\n'},XML:{name:"XML",submodules:{},elements:{},classes:{"p5.XML":1},fors:{},is_submodule:1,namespaces:{},module:"IO",namespace:"",file:"src/io/p5.XML.js",line:11,requires:["core"],description:'<p>XML is a representation of an XML object, able to parse XML code. Use\n<a href="#/p5/loadXML">loadXML()</a> to load external XML files and create XML objects.</p>\n'},Math:{name:"Math",submodules:{Calculation:1,Noise:1,Random:1,Trigonometry:1},elements:{},classes:{"p5.Vector":1},fors:{p5:1},namespaces:{},module:"Math",file:"src/math/p5.Vector.js",line:12,requires:["core"],description:'<p>A class to describe a two or three dimensional vector, specifically\na Euclidean (also known as geometric) vector. A vector is an entity\nthat has both magnitude and direction. The datatype, however, stores\nthe components of the vector (x, y for 2D, and x, y, z for 3D). The magnitude\nand direction can be accessed via the methods <a href="#/p5/mag">mag()</a> and <a href="#/p5/heading">heading()</a>.\n<br><br>\nIn many of the p5.js examples, you will see <a href="#/p5.Vector">p5.Vector</a> used to describe a\nposition, velocity, or acceleration. For example, if you consider a rectangle\nmoving across the screen, at any given instant it has a position (a vector\nthat points from the origin to its location), a velocity (the rate at which\nthe object&#39;s position changes per time unit, expressed as a vector), and\nacceleration (the rate at which the object&#39;s velocity changes per time\nunit, expressed as a vector).\n<br><br>\nSince vectors represent groupings of values, we cannot simply use\ntraditional addition/multiplication/etc. Instead, we&#39;ll need to do some\n&quot;vector&quot; math, which is made easy by the methods inside the <a href="#/p5.Vector">p5.Vector</a> class.</p>\n'},Calculation:{name:"Calculation",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Math",namespace:"",file:"src/math/calculation.js",line:1,requires:["core"]},Noise:{name:"Noise",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Math",namespace:"",file:"src/math/noise.js",line:14,requires:["core"]},Random:{name:"Random",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Math",namespace:"",file:"src/math/random.js",line:1,requires:["core"]},Trigonometry:{name:"Trigonometry",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Math",namespace:"",file:"src/math/trigonometry.js",line:1,requires:["core","constants"]},Typography:{name:"Typography",submodules:{Attributes:1,"Loading & Displaying":1,Font:1},elements:{},classes:{"p5.Font":1},fors:{p5:1},namespaces:{},file:"src/typography/p5.Font.js",line:15},Font:{name:"Font",submodules:{},elements:{},classes:{"p5.Font":1},fors:{},is_submodule:1,namespaces:{},module:"Typography",namespace:"",file:"src/typography/p5.Font.js",line:15,description:'<p>This module defines the <a href="#/p5.Font">p5.Font</a> class and functions for\ndrawing text to the display canvas.</p>\n',requires:["core","constants"]},"Array Functions":{name:"Array Functions",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Data",namespace:"",file:"src/utilities/array_functions.js",line:1,requires:["core"]},Conversion:{name:"Conversion",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Data",namespace:"",file:"src/utilities/conversion.js",line:1,requires:["core"]},"String Functions":{name:"String Functions",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Data",namespace:"",file:"src/utilities/string_functions.js",line:1,requires:["core"]},"Time & Date":{name:"Time & Date",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"IO",namespace:"",file:"src/utilities/time_date.js",line:1,requires:["core"]},"3D Primitives":{name:"3D Primitives",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Shape",namespace:"",file:"src/webgl/3d_primitives.js",line:1,requires:["core","p5.Geometry"]},"Lights, Camera":{name:"Lights, Camera",submodules:{Interaction:1,Lights:1,Material:1,Camera:1,Shaders:1},elements:{},classes:{"p5.Camera":1,"p5.Geometry":1,"p5.Matrix":1,"p5.Shader":1,"p5.Texture":1,ImageInfos:1,FontInfo:1,Cubic:1},fors:{p5:1,"p5.Camera":1},namespaces:{},file:"src/webgl/text.js",line:259},Interaction:{name:"Interaction",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Lights, Camera",namespace:"",file:"src/webgl/interaction.js",line:1,requires:["core"]},Lights:{name:"Lights",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Lights, Camera",namespace:"",file:"src/webgl/light.js",line:1,requires:["core"]},"3D Models":{name:"3D Models",submodules:{},elements:{},classes:{},fors:{p5:1},is_submodule:1,namespaces:{},module:"Shape",namespace:"",file:"src/webgl/loading.js",line:1,requires:["core","p5.Geometry"]},Material:{name:"Material",submodules:{},elements:{},classes:{"p5.Texture":1},fors:{p5:1},is_submodule:1,namespaces:{},module:"Lights, Camera",namespace:"",file:"src/webgl/p5.Texture.js",line:14,requires:["core"],description:"<p>This module defines the p5.Texture class</p>\n"},Camera:{name:"Camera",submodules:{},elements:{},classes:{"p5.Camera":1},fors:{p5:1,"p5.Camera":1},is_submodule:1,namespaces:{},module:"Lights, Camera",namespace:"",file:"src/webgl/p5.Camera.js",line:209,requires:["core"],description:'<p>This class describes a camera for use in p5&#39;s\n<a href="https://github.com/processing/p5.js/wiki/Getting-started-with-WebGL-in-p5">\nWebGL mode</a>. It contains camera position, orientation, and projection\ninformation necessary for rendering a 3D scene.</p>\n<p>New p5.Camera objects can be made through the\n<a href="#/p5/createCamera">createCamera()</a> function and controlled through\nthe methods described below. A camera created in this way will use a default\nposition in the scene and a default perspective projection until these\nproperties are changed through the various methods available. It is possible\nto create multiple cameras, in which case the current camera\ncan be set through the <a href="#/p5/setCamera">setCamera()</a> method.</p>\n<p>Note:\nThe methods below operate in two coordinate systems: the &#39;world&#39; coordinate\nsystem describe positions in terms of their relationship to the origin along\nthe X, Y and Z axes whereas the camera&#39;s &#39;local&#39; coordinate system\ndescribes positions from the camera&#39;s point of view: left-right, up-down,\nand forward-backward. The <a href="#/p5.Camera/move">move()</a> method,\nfor instance, moves the camera along its own axes, whereas the\n<a href="#/p5.Camera/setPosition">setPosition()</a>\nmethod sets the camera&#39;s position in world-space.</p>\n'},Shaders:{name:"Shaders",submodules:{},elements:{},classes:{"p5.Shader":1},fors:{p5:1},is_submodule:1,namespaces:{},module:"Lights, Camera",namespace:"",file:"src/webgl/p5.Shader.js",line:13,description:"<p>This module defines the p5.Shader class</p>\n",requires:["core"]},"p5.dom":{name:"p5.dom",submodules:{},elements:{},classes:{"p5.MediaElement":1,"p5.File":1},fors:{p5:1,"p5.Element":1},namespaces:{},module:"p5.dom",file:"lib/addons/p5.dom.js",line:3323,description:"<p><p>The web is much more than just canvas and p5.dom makes it easy to interact\nwith other HTML5 objects, including text, hyperlink, image, input, video,\naudio, and webcam.</p></p>\n<p><p>There is a set of creation methods, DOM manipulation methods, and\nan extended <a href=\"#/p5.Element\">p5.Element</a> that supports a range of HTML elements. See the\n<a href='https://github.com/processing/p5.js/wiki/Beyond-the-canvas'>
21\nbeyond the canvas tutorial</a> for a full overview of how this addon works.</p>\n<p><p>Methods and properties shown in black are part of the p5.js core, items in\nblue are part of the p5.dom library. You will need to include an extra file\nin order to access the blue functions. See the\n<a href='http://p5js.org/libraries/#using-a-library'>using a library</a>\nsection for information on how to include this library. p5.dom comes with\n<a href='http://p5js.org/download'>p5 complete</a> or you can download the single file\n<a href='https://raw.githubusercontent.com/lmccart/p5.js/master/lib/addons/p5.dom.js'>\nhere</a>.</p></p>\n<p><p>See <a href='https://github.com/processing/p5.js/wiki/Beyond-the-canvas'>tutorial: beyond the canvas</a>\nfor more info on how to use this library.</a></p>\n",tag:"main",itemtype:"main"},"p5.sound":{name:"p5.sound",submodules:{},elements:{},classes:{"p5.sound":1,"p5.SoundFile":1,"p5.Amplitude":1,"p5.FFT":1,"p5.Signal":1,"p5.Oscillator":1,"p5.SinOsc":1,"p5.TriOsc":1,"p5.SawOsc":1,"p5.SqrOsc":1,"p5.Envelope":1,"p5.Pulse":1,"p5.Noise":1,"p5.AudioIn":1,"p5.Effect":1,"p5.Filter":1,"p5.LowPass":1,"p5.HighPass":1,"p5.BandPass":1,"p5.EQ":1,"p5.Panner3D":1,"p5.Delay":1,"p5.Reverb":1,"p5.Convolver":1,"p5.Phrase":1,"p5.Part":1,"p5.Score":1,"p5.SoundLoop":1,"p5.Compressor":1,"p5.SoundRecorder":1,"p5.PeakDetect":1,"p5.Gain":1,"p5.AudioVoice":1,"p5.MonoSynth":1,"p5.PolySynth":1,"p5.Distortion":1},fors:{"p5.sound":1,p5:1},namespaces:{},module:"p5.sound",file:"lib/addons/p5.sound.js",line:12767,description:'<p>p5.sound extends p5 with <a href="http://caniuse.com/audio-api"\ntarget="_blank">Web Audio</a> functionality including audio input,\nplayback, analysis and synthesis.\n<br/><br/>\n<a href="#/p5.SoundFile"><b>p5.SoundFile</b></a>: Load and play sound files.<br/>\n<a href="#/p5.Amplitude"><b>p5.Amplitude</b></a>: Get the current volume of a sound.<br/>\n<a href="#/p5.AudioIn"><b>p5.AudioIn</b></a>: Get sound from an input source, typically\n  a computer microphone.<br/>\n<a href="#/p5.FFT"><b>p5.FFT</b></a>: Analyze the frequency of sound. Returns\n  results from the frequency spectrum or time domain (waveform).<br/>\n<a href="#/p5.Oscillator"><b>p5.Oscillator</b></a>: Generate Sine,\n  Triangle, Square and Sawtooth waveforms. Base class of\n  <a href="#/p5.Noise">p5.Noise</a> and <a href="#/p5.Pulse">p5.Pulse</a>.\n  <br/>\n<a href="#/p5.Envelope"><b>p5.Envelope</b></a>: An Envelope is a series\n  of fades over time. Often used to control an object&#39;s\n  output gain level as an &quot;ADSR Envelope&quot; (Attack, Decay,\n  Sustain, Release). Can also modulate other parameters.<br/>\n<a href="#/p5.Delay"><b>p5.Delay</b></a>: A delay effect with\n  parameters for feedback, delayTime, and lowpass filter.<br/>\n<a href="#/p5.Filter"><b>p5.Filter</b></a>: Filter the frequency range of a\n  sound.\n<br/>\n<a href="#/p5.Reverb"><b>p5.Reverb</b></a>: Add reverb to a sound by specifying\n  duration and decay. <br/>\n<b><a href="#/p5.Convolver">p5.Convolver</a>:</b> Extends\n<a href="#/p5.Reverb">p5.Reverb</a> to simulate the sound of real\n  physical spaces through convolution.<br/>\n<b><a href="#/p5.SoundRecorder">p5.SoundRecorder</a></b>: Record sound for playback\n  / save the .wav file.\n<b><a href="#/p5.Phrase">p5.Phrase</a></b>, <b><a href="#/p5.Part">p5.Part</a></b> and\n<b><a href="#/p5.Score">p5.Score</a></b>: Compose musical sequences.\n<br/><br/>\np5.sound is on <a href="https://github.com/therewasaguy/p5.sound/">GitHub</a>.\nDownload the latest version\n<a href="https://github.com/therewasaguy/p5.sound/blob/master/lib/p5.sound.js">here</a>.</p>\n',tag:"main",itemtype:"main"}},classes:{p5:{name:"p5",shortname:"p5",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"IO",submodule:"Output",namespace:"",file:"src/core/main.js",line:15,description:'<p>This is the p5 instance constructor.</p>\n<p>A p5 instance holds all the properties and methods related to\na p5 sketch.  It expects an incoming sketch closure and it can also\ntake an optional node parameter for attaching the generated p5 canvas\nto a node.  The sketch closure takes the newly created p5 instance as\nits s
21ole argument and may optionally set <a href="#/p5/preload">preload()</a>, <a href="#/p5/setup">setup()</a>, and/or\n<a href="#/p5/draw">draw()</a> properties on it for running a sketch.</p>\n<p>A p5 sketch can run in &quot;global&quot; or &quot;instance&quot; mode:\n&quot;global&quot;   - all properties and methods are attached to the window\n&quot;instance&quot; - all properties and methods are bound to this p5 object</p>\n',is_constructor:1,params:[{name:"sketch",description:'<p>a closure that can set optional <a href="#/p5/preload">preload()</a>,\n                             <a href="#/p5/setup">setup()</a>, and/or <a href="#/p5/draw">draw()</a> properties on the\n                             given p5 instance</p>\n',type:"Function"},{name:"node",description:"<p>element to attach canvas to</p>\n",type:"HTMLElement",optional:!0}],return:{description:"a p5 instance",type:"P5"}},"p5.Color":{name:"p5.Color",shortname:"p5.Color",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Color",submodule:"Creating & Reading",namespace:"",file:"src/color/p5.Color.js",line:16,description:'<p>Each color stores the color mode and level maxes that applied at the\ntime of its construction. These are used to interpret the input arguments\n(at construction and later for that instance of color) and to format the\noutput e.g. when <a href="#/p5/saturation">saturation()</a> is requested.</p>\n<p>Internally we store an array representing the ideal RGBA values in floating\npoint form, normalized from 0 to 1. From this we calculate the closest\nscreen color (RGBA levels from 0 to 255) and expose this to the renderer.</p>\n<p>We also cache normalized, floating point components of the color in various\nrepresentations as they are calculated. This is done to prevent repeating a\nconversion that has already been performed.</p>\n'},"p5.Element":{name:"p5.Element",shortname:"p5.Element",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"DOM",submodule:"DOM",namespace:"",file:"src/core/p5.Element.js",line:11,description:'<p>Base class for all elements added to a sketch, including canvas,\ngraphics buffers, and other HTML elements. Methods in blue are\nincluded in the core functionality, methods in brown are added\nwith the <a href="http://p5js.org/reference/#/libraries/p5.dom">p5.dom\nlibrary</a>.\nIt is not called directly, but <a href="#/p5.Element">p5.Element</a>\nobjects are created by calling <a href="#/p5/createCanvas">createCanvas</a>, <a href="#/p5/createGraphics">createGraphics</a>,\nor in the p5.dom library, <a href="#/p5/createDiv">createDiv</a>, <a href="#/p5/createImg">createImg</a>, <a href="#/p5/createInput">createInput</a>, etc.</p>\n',params:[{name:"elt",description:"<p>DOM node that is wrapped</p>\n",type:"String"},{name:"pInst",description:"<p>pointer to p5 instance</p>\n",type:"P5",optional:!0}]},"p5.Graphics":{name:"p5.Graphics",shortname:"p5.Graphics",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Rendering",submodule:"Rendering",namespace:"",file:"src/core/p5.Graphics.js",line:12,description:"<p>Thin wrapper around a renderer, to be used for creating a\ngraphics buffer object. Use this class if you need\nto draw into an off-screen graphics buffer. The two parameters define the\nwidth and height in pixels. The fields and methods for this class are\nextensive, but mirror the normal drawing API for p5.</p>\n",extends:"p5.Element",params:[{name:"w",description:"<p>width</p>\n",type:"Number"},{name:"h",description:"<p>height</p>\n",type:"Number"},{name:"renderer",description:"<p>the renderer to use, either P2D or WEBGL</p>\n",type:"Constant"},{name:"pInst",description:"<p>pointer to p5 instance</p>\n",type:"P5",optional:!0}]},"p5.Renderer":{name:"p5.Renderer",shortname:"p5.Renderer",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Rendering",submodule:"Rendering",namespace:"",file:"src/core/p5.Renderer.js",line:12,description:"<p>Main graphics and rendering context, as well as the base API\nimplementation for p5.js &quot;core&quot;. To be used as the superclass for\nRenderer2D and Renderer3D classes, respecitvely.</p>\n",is_constructor:1,extends:"p5.Element",params:[{name:"elt",description:"<p>DOM node that is wrapped</p>\n",type:"String"},{name:"pInst",description:"<p>pointer to p5 instance</p>\n",type:"P5",optional:!0},{name:"isMainCanvas",description:"<p>whether we&#39;re using it as main canvas</p>\n",type:"Boolean",optional:!0}]},"p5.TypedDict":{name:"p5.TypedDict",shortname:"p5.TypedDict",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Data",submodule:"Dictionary",namespace:"",file:"src/data/p5.TypedDict.js",line:84,description:"<p>Base class for all p5.Dictionary types. Specifically\n typed Dictionary classes inherit from this class.</p>\n"},"p5.StringDict":{name:"p5.StringDict",shortname:"p5.StringDict",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Data",submodule:"Dictionary",namespace:"",file:"src/data/p5.TypedDict.js",line:403,description:"<p>A simple Dictionary class for Strings.</p>\n",extends:"p5.TypedDict"},"p5.NumberDict":{name:"p5.NumberDict",shortname:"p5.NumberDict",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Data",submodule:"Dictionary",namespace:"",file:"src/data/p5.TypedDict.js",line:422,description:"<p>A simple Dictionary class for Numbers.</p>\n",extends:"p5.TypedDict"},"p5.Image":{name:"p5.Image",shortname:"p5.Image",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Image",submodule:"Image",namespace:"",file:"src/image/p5.Image.js",line:23,description:'<p>Creates a new <a href="#/p5.Image">p5.Image</a>. A <a href="#/p5.Image">p5.Image</a> 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\n<a href="#/p5/loadImage">loadImage()</a> function. The <a href="#/p5.Image">p5.Image</a> class contains fields for the width and\nheight of the image, as well as an array called <a href="#/p5.Image/pixels">pixels[]</a> that contains the\nvalues for every pixel in the image.\n<br><br>\nThe methods described below allow easy access to the image&#39;s pixels and\nalpha channel and simplify the process of compositing.\n<br><br>\nBefore using the <a href="#/p5.Image/pixels">pixels[]</a> array, be sure to use the <a href="#/p5.Image/loadPixels">loadPixels()</a> method on\nthe image to make sure that the pixel data is properly loaded.</p>\n',example:["\n<div><code>\nfunction setup() {\n  let img = createImage(100, 100); // same as new p5.Image(100, 100);\n  img.loadPixels();\n  createCanvas(100, 100);\n  background(0);\n\n  // helper for writing color to array\n  function writeColor(image, x, y, red, green, blue, alpha) {\n    let index = (x + y * width) * 4;\n    image.pixels[index] = red;\n    image.pixels[index + 1] = green;\n    image.pixels[index + 2] = blue;\n    image.pixels[index + 3] = alpha;\n  }\n\n  let x, y;
21\n  // fill with random colors\n  for (y = 0; y < img.height; y++) {\n    for (x = 0; x < img.width; x++) {\n      let red = random(255);\n      let green = random(255);\n      let blue = random(255);\n      let alpha = 255;\n      writeColor(img, x, y, red, green, blue, alpha);\n    }\n  }\n\n  // draw a red line\n  y = 0;\n  for (x = 0; x < img.width; x++) {\n    writeColor(img, x, y, 255, 0, 0, 255);\n  }\n\n  // draw a green line\n  y = img.height - 1;\n  for (x = 0; x < img.width; x++) {\n    writeColor(img, x, y, 0, 255, 0, 255);\n  }\n\n  img.updatePixels();\n  image(img, 0, 0);\n}\n</code></div>"],params:[{name:"width",description:"",type:"Number"},{name:"height",description:"",type:"Number"}]},"p5.PrintWriter":{name:"p5.PrintWriter",shortname:"p5.PrintWriter",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"IO",submodule:"Output",namespace:"",file:"src/io/files.js",line:1238,params:[{name:"filename",description:"",type:"String"},{name:"extension",description:"",type:"String",optional:!0}]},"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:35,description:'<p><a href="#/p5.Table">Table</a> 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\n<a href="#/p5/loadXML">loadXML()</a> to load external XML files and create XML objects.</p>\n',is_constructor:1,example:['\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  let children = xml.getChildren(\'animal\');\n\n  for (let i = 0; i < children.length; i++) {\n    let id = children[i].getNum(\'id\');\n    let coloring = children[i].getString(\'species\');\n    let name = children[i].getContent();\n    print(id + \', \' + coloring + \', \' + name);\n  }\n}\n\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:12,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 <a href="#/p5/mag">mag()</a> and <a href="#/p5/heading">heading()</a>.\n<br><br>\nIn many of the p5.js examples, you will see <a href="#/p5.Vector">p5.Vector</a> used to describe a\nposition, velocity, or acceleration. For example, if you consider a rectangle\nmoving across the screen, at any given instant it has a position (a vector\nthat points from the origin to its location), a velocity (the rate at which\nthe object&#39;s position changes per time unit, expressed as a vector), and\nacceleration (the rate at which the object&#39;s velocity changes per time\nunit, expressed as a vector).\n<br><br>\nSince vectors represent groupings of values, we cannot simply use\ntraditional addition/multiplication/etc. Instead, we&#39;ll need to do some\n&quot;vector&quot; math, which is made easy by the methods inside the <a href="#/p5.Vector">p5.Vector</a> class.</p>\n',params:[{name:"x",description:"<p>x component of the vector</p>\n",type:"Number",optional:!0},{name:"y",description:"<p>y component of the vector</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>z component of the vector</p>\n",type:"Number",optional:!0}],example:["\n<div>\n<code>\nlet v1 = createVector(40, 50);\nlet v2 = createVector(40, 50);\n\nellipse(v1.x, v1.y, 50, 50);\nellipse(v2.x, v2.y, 50, 50);\nv1.add(v2);\nellipse(v1.x, v1.y, 50, 50);\n</code>\n</div>"],alt:"2 white ellipses. One center-left the other bottom right and off canvas"},"p5.Font":{name:"p5.Font",shortname:"p5.Font",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Typography",submodule:"Font",namespace:"",file:"src/typography/p5.Font.js",line:15,description:"<p>Base class for font handling</p>\n",params:[{name:"pInst",description:"<p>pointer to p5 instance</p>\n",type:"P5",optional:!0}]},"p5.Camera":{name:"p5.Camera",shortname:"p5.Camera",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Lights, Camera",submodule:"Camera",namespace:"",file:"src/webgl/p5.Camera.js",line:209,description:'<p>This class describes a camera for use in p5&#39;s\n<a href="https://github.com/processing/p5.js/wiki/Getting-started-with-WebGL-in-p5">\nWebGL mode</a>. It contains camera position, orientation, and projection\ninformation necessary for rendering a 3D scene.</p>\n<p>New p5.Camera objects can be made through the\n<a href="#/p5/createCamera">createCamera()</a> function and controlled through\nthe methods described below. A camera created in this way will use a default\nposition in the scene and a default perspective projection until these\nproperties are changed through the various methods available. It is possible\nto create multiple cameras, in which case the current camera\ncan be set through the <a href="#/p5/setCamera">setCamera()</a> method.</p>\n<p>Note:\nThe methods below operate in two coordinate systems: the &#39;world&#39; coordinate\nsystem describe positions in terms of their relationship to the origin along\nthe X, Y and Z axes whereas the camera&#39;s &#39;local&#39; coordinate system\ndescribes positions from the camera&#39;s point of view: left-right, up-down,\nand forward-backward. The <a href="#/p5.Camera/move">move()</a> method,\nfor instance, moves the camera along its own axes, whereas the\n<a href="#/p5.Camera/setPosition">setPosition()</a>\nmethod sets the camera&#39;s position in world-space.</p>\n',params:[{name:"rendererGL",description:"<p>instance of WebGL renderer</p>\n",type:"RendererGL"}],example:["\n<div>\n<code>\nlet cam;\nlet delta = 0.01;\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  normalMaterial();\n  cam = createCamera();\n  // set initial pan angle\n  cam.pan(-0.8);\n}\n\nfunction draw() {\n  background(200);\n\n  // pan camera according to angle 'delta'\n  cam.pan(delta);\n\n  // every 160 frames, switch direction\n  if (frameCount % 160 === 0) {\n    delta *= -1;\n  }\n\n  rotateX(frameCount * 0.01);\n  translate(-100, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n}\n</code>\n</div>"],alt:"camera view pans left and right across a series of rotating 3D boxes."},"p5.Geometry":{name:"p5.Geometry",shortname:"p5.Geometry",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Lights, Camera",namespace:"",file:"src/webgl/p5.Geometry.js",line:6,description:"<p>p5 Geometry class</p>\n",is_constructor:1,params:[{name:"detailX",description:"<p>number of vertices on horizontal surface</p>\n",type:"Integer",optional:!0},{name:"detailY",description:"<p>number of vertices on horizontal surface</p>\n",type:"Integer",optional:!0},{name:"callback",description:"<p>function to call upon object instantiation.</p>\n",type:"Function",optional:!0}]},"p5.Shader":{name:"p5.Shader",shortname:"p5.Shader",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"Lights, Camera",submodule:"Shaders",namespace:"",file:"src/webgl/p5.Shader.js",line:13,description:"<p>Shader class for WEBGL Mode</p>\n",params:[{name:"renderer",description:"<p>an instance of p5.RendererGL that\nwill provide the GL context for this new p5.Shader</p>\n",type:"p5.RendererGL"},{name:"vertSrc",description:"<p>source code for the vertex shader (as a string)</p>\n",type:"String"},{name:"fragSrc",description:"<p>source code for the fragment shader (as a string)</p>\n",type:"String"}]},"p5.MediaElement":{name:"p5.MediaElement",shortname:"p5.MediaElement",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.dom",submodule:"p5.dom",namespace:"",file:"lib/addons/p5.dom.js",line:2228,description:'<p>Extends <a href="#/p5.Element">p5.Element</a> to handle audio and video. In addition to the methods\nof <a href="#/p5.Element">p5.Element</a>, it also contains methods for controlling media. It is not\ncalled directly, but <a href="#/p5.MediaElement">p5.MediaElement</a>s are created by calling <a href="#/p5/createVideo">createVideo</a>,\n<a href="#/p5/createAudio">createAudio</a>, and <a href="#/p5/createCapture">createCapture</a>.</p>\n',is_constructor:1,params:[{name:"elt",description:"<p>DOM node that is wrapped</p>\n",type:"String"}]},"p5.File":{name:"p5.File",shortname:"p5.File",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.dom",submodule:"p5.dom",namespace:"",file:"lib/addons/p5.dom.js",line:3323,description:"<p>Base class for a file.\nUsed for Element.drop and createFileInput.</p>\n",is_constructor:1,params:[{name:"file",description:"<p>File that is wrapped</p>\n",type:"File"}]},"p5.sound":{name:"p5.sound",shortname:"p5.sound",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:""},"p5.SoundFile":{name:"p5.SoundFile",shortname:"p5.SoundFile",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:1645,description:"<p>SoundFile object with a path to a file.</p>\n\n<p>The p5.SoundFile may not be available immediately because\nit loads the file information asynchronously.</p>\n\n<p>To do something with the sound as soon as it loads\npass the name of a function as the second parameter.</p>\n\n<p>Only one file path is required. However, audio file formats\n(i.e. mp3, ogg, wav and m4a/aac) are not supported by all\nweb browsers. If you want to ensure compatability, instead of a single\nfile path, you may include an Array of filepaths, and the browser will\nchoose a format that works.</p>",is_constructor:1,params:[{name:"path",description:"<p>path to a sound file (String). Optionally,\n                             you may include multiple file formats in\n                             an array. Alternately, accepts an object\n                             from the HTML5 File API, or a p5.File.</p>\n",type:"String|Array"},{name:"successCallback",description:"<p>Name of a function to call once file loads</p>\n",type:"Function",optional:!0},{name:"errorCallback",description:"<p>Name of a function to call if file fails to\n                                    load. This function will receive an error or\n                                   XMLHttpRequest object with information\n                                   about what went wrong.</p>\n",type:"Function",optional:!0},{name:"whileLoadingCallback",description:"<p>Name of a function to call while file\n                                           is loading. That function will\n                                           receive progress of the request to\n                                           load the sound file\n                                           (between 0 and 1) as its first\n                                           parameter. This progress\n                                           does not account for the additional\n                                           time needed to decode the audio data.</p>\n",type:"Function",optional:!0}],example:["\n<div><code>\n\nfunction preload() {\n  soundFormats('mp3', 'ogg');\n  mySound = loadSound('assets/doorbell.mp3');\n}\n\nfunction setup() {\n  mySound.setVolume(0.1);\n  mySound.play();\n}\n\n </code></div>"]},"p5.Amplitude":{name:"p5.Amplitude",shortname:"p5.Amplitude",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:3179,description:"<p>Amplitude measures volume between 0.0 and 1.0.\nListens to all p5sound by default, or use setInput()\nto listen to a specific sound source. Accepts an optional\nsmoothing value, which defaults to 0.</p>\n",is_constructor:1,params:[{name:"smoothing",description:"<p>between 0.0 and .999 to smooth\n                           amplitude readings (defaults to 0)</p>\n",type:"Number",optional:!0}],example:["\n<div><code>\nvar sound, amplitude, cnv;\n\nfunction preload(){\n  sound = loadSound('assets/beat.mp3');\n}\nfunction setup() {\n  cnv = createCanvas(100,100);\n  amplitude = new p5.Amplitude();\n\n  // start / stop the sound when canvas is clicked\n  cnv.mouseClicked(function() {\
21n    if (sound.isPlaying() ){\n      sound.stop();\n    } else {\n      sound.play();\n    }\n  });\n}\nfunction draw() {\n  background(0);\n  fill(255);\n  var level = amplitude.getLevel();\n  var size = map(level, 0, 1, 0, 200);\n  ellipse(width/2, height/2, size, size);\n}\n\n</code></div>"]},"p5.FFT":{name:"p5.FFT",shortname:"p5.FFT",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:3458,description:'<p>FFT (Fast Fourier Transform) is an analysis algorithm that\nisolates individual\n<a href="https://en.wikipedia.org/wiki/Audio_frequency">\naudio frequencies</a> within a waveform.</p>\n\n<p>Once instantiated, a p5.FFT object can return an array based on\ntwo types of analyses: <br> • <code>FFT.waveform()</code> computes\namplitude values along the time domain. The array indices correspond\nto samples across a brief moment in time. Each value represents\namplitude of the waveform at that sample of time.<br>\n• <code>FFT.analyze() </code> computes amplitude values along the\nfrequency domain. The array indices correspond to frequencies (i.e.\npitches), from the lowest to the highest that humans can hear. Each\nvalue represents amplitude at that slice of the frequency spectrum.\nUse with <code>getEnergy()</code> to measure amplitude at specific\nfrequencies, or within a range of frequencies. </p>\n\n<p>FFT analyzes a very short snapshot of sound called a sample\nbuffer. It returns an array of amplitude measurements, referred\nto as <code>bins</code>. The array is 1024 bins long by default.\nYou can change the bin array length, but it must be a power of 2\nbetween 16 and 1024 in order for the FFT algorithm to function\ncorrectly. The actual size of the FFT buffer is twice the\nnumber of bins, so given a standard sample rate, the buffer is\n2048/44100 seconds long.</p>',is_constructor:1,params:[{name:"smoothing",description:"<p>Smooth results of Freq Spectrum.\n                              0.0 &lt; smoothing &lt; 1.0.\n                              Defaults to 0.8.</p>\n",type:"Number",optional:!0},{name:"bins",description:"<p>Length of resulting array.\n                          Must be a power of two between\n                          16 and 1024. Defaults to 1024.</p>\n",type:"Number",optional:!0}],example:["\n<div><code>\nfunction preload(){\n  sound = loadSound('assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup(){\n  var cnv = createCanvas(100,100);\n  cnv.mouseClicked(togglePlay);\n  fft = new p5.FFT();\n  sound.amp(0.2);\n}\n\nfunction draw(){\n  background(0);\n\n  var spectrum = fft.analyze();\n  noStroke();\n  fill(0,255,0); // spectrum is green\n  for (var i = 0; i< spectrum.length; i++){\n    var x = map(i, 0, spectrum.length, 0, width);\n    var h = -height + map(spectrum[i], 0, 255, height, 0);\n    rect(x, height, width / spectrum.length, h )\n  }\n\n  var waveform = fft.waveform();\n  noFill();\n  beginShape();\n  stroke(255,0,0); // waveform is red\n  strokeWeight(1);\n  for (var i = 0; i< waveform.length; i++){\n    var x = map(i, 0, waveform.length, 0, width);\n    var y = map( waveform[i], -1, 1, 0, height);\n    vertex(x,y);\n  }\n  endShape();\n\n  text('click to play/pause', 4, 10);\n}\n\n// fade sound if mouse is over canvas\nfunction togglePlay() {\n  if (sound.isPlaying()) {\n    sound.pause();\n  } else {\n    sound.loop();\n  }\n}\n</code></div>"]},"p5.Signal":{name:"p5.Signal",shortname:"p5.Signal",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:5223,description:"<p>p5.Signal is a constant audio-rate signal used by p5.Oscillator\nand p5.Envelope for modulation math.</p>\n\n<p>This is necessary because Web Audio is processed on a seprate clock.\nFor example, the p5 draw loop runs about 60 times per second. But\nthe audio clock must process samples 44100 times per second. If we\nwant to add a value to each of those samples, we can&#39;t do it in the\ndraw loop, but we can do it by adding a constant-rate audio signal.&lt;/p.\n\n<p>This class mostly functions behind the scenes in p5.sound, and returns\na Tone.Signal from the Tone.js library by Yotam Mann.\nIf you want to work directly with audio signals for modular\nsynthesis, check out\n<a href='http://bit.ly/1oIoEng' target=_'blank'>tone.js.</a></p>",is_constructor:1,return:{description:"A Signal object from the Tone.js library",type:"Tone.Signal"},example:["\n<div><code>\nfunction setup() {\n  carrier = new p5.Oscillator('sine');\n  carrier.amp(1); // set amplitude\n  carrier.freq(220); // set frequency\n  carrier.start(); // start oscillating\n\n  modulator = new p5.Oscillator('sawtooth');\n  modulator.disconnect();\n  modulator.amp(1);\n  modulator.freq(4);\n  modulator.start();\n\n  // Modulator's default amplitude range is -1 to 1.\n  // Multiply it by -200, so the range is -200 to 200\n  // then add 220 s
21o the range is 20 to 420\n  carrier.freq( modulator.mult(-200).add(220) );\n}\n</code></div>"]},"p5.Oscillator":{name:"p5.Oscillator",shortname:"p5.Oscillator",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:5369,description:'<p>Creates a signal that oscillates between -1.0 and 1.0.\nBy default, the oscillation takes the form of a sinusoidal\nshape (&#39;sine&#39;). Additional types include &#39;triangle&#39;,\n&#39;sawtooth&#39; and &#39;square&#39;. The frequency defaults to\n440 oscillations per second (440Hz, equal to the pitch of an\n&#39;A&#39; note).</p>\n\n<p>Set the type of oscillation with setType(), or by instantiating a\nspecific oscillator: <a href="/reference/#/p5.SinOsc">p5.SinOsc</a>, <a\nhref="/reference/#/p5.TriOsc">p5.TriOsc</a>, <a\nhref="/reference/#/p5.SqrOsc">p5.SqrOsc</a>, or <a\nhref="/reference/#/p5.SawOsc">p5.SawOsc</a>.\n</p>',is_constructor:1,params:[{name:"freq",description:"<p>frequency defaults to 440Hz</p>\n",type:"Number",optional:!0},{name:"type",description:"<p>type of oscillator. Options:\n                       &#39;sine&#39; (default), &#39;triangle&#39;,\n                       &#39;sawtooth&#39;, &#39;square&#39;</p>\n",type:"String",optional:!0}],example:["\n<div><code>\nvar osc;\nvar playing = false;\n\nfunction setup() {\n  backgroundColor = color(255,0,255);\n  textAlign(CENTER);\n\n  osc = new p5.Oscillator();\n  osc.setType('sine');\n  osc.freq(240);\n  osc.amp(0);\n  osc.start();\n}\n\nfunction draw() {\n  background(backgroundColor)\n  text('click to play', width/2, height/2);\n}\n\nfunction mouseClicked() {\n  if (mouseX > 0 && mouseX < width && mouseY < height && mouseY > 0) {\n    if (!playing) {\n      // ramp amplitude to 0.5 over 0.05 seconds\n      osc.amp(0.5, 0.05);\n      playing = true;\n      backgroundColor = color(0,255,255);\n    } else {\n      // ramp amplitude to 0 over 0.5 seconds\n      osc.amp(0, 0.5);\n      playing = false;\n      backgroundColor = color(255,0,255);\n    }\n  }\n}\n</code> </div>"]},"p5.SinOsc":{name:"p5.SinOsc",shortname:"p5.SinOsc",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:5810,description:"<p>Constructor: <code>new p5.SinOsc()</code>.\nThis creates a Sine Wave Oscillator and is\nequivalent to <code> new p5.Oscillator(&#39;sine&#39;)\n</code> or creating a p5.Oscillator and then calling\nits method <code>setType(&#39;sine&#39;)</code>.\nSee p5.Oscillator for methods.</p>\n",is_constructor:1,extends:"p5.Oscillator",params:[{name:"freq",description:"<p>Set the frequency</p>\n",type:"Number",optional:!0}]},"p5.TriOsc":{name:"p5.TriOsc",shortname:"p5.TriOsc",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:5827,description:"<p>Constructor: <code>new p5.TriOsc()</code>.\nThis creates a Triangle Wave Oscillator and is\nequivalent to <code>new p5.Oscillator(&#39;triangle&#39;)\n</code> or creating a p5.Oscillator and then calling\nits method <code>setType(&#39;triangle&#39;)</code>.\nSee p5.Oscillator for methods.</p>\n",is_constructor:1,extends:"p5.Oscillator",params:[{name:"freq",description:"<p>Set the frequency</p>\n",type:"Number",optional:!0}]},"p5.SawOsc":{name:"p5.SawOsc",shortname:"p5.SawOsc",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:5844,description:"<p>Constructor: <code>new p5.SawOsc()</code>.\nThis creates a SawTooth Wave Oscillator and is\nequivalent to <code> new p5.Oscillator(&#39;sawtooth&#39;)\n</code> or creating a p5.Oscillator and then calling\nits method <code>setType(&#39;sawtooth&#39;)</code>.\nSee p5.Oscillator for methods.</p>\n",is_constructor:1,extends:"p5.Oscillator",params:[{name:"freq",description:"<p>Set the frequency</p>\n",type:"Number",optional:!0}]},"p5.SqrOsc":{name:"p5.SqrOsc",shortname:"p5.SqrOsc",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:5861,description:"<p>Constructor: <code>new p5.SqrOsc()</code>.\nThis creates a Square Wave Oscillator and is\nequivalent to <code> new p5.Oscillator(&#39;square&#39;)\n</code> or creating a p5.Oscillator and then calling\nits method <code>setType(&#39;square&#39;)</code>.\nSee p5.Oscillator for methods.</p>\n",is_constructor:1,extends:"p5.Oscillator",params:[{name:"freq",description:"<p>Set the frequency</p>\n",type:"Number",optional:!0}]},"p5.Envelope":{name:"p5.Envelope",shortname:"p5.Envelope",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:6316,description:'<p>Envelopes are pre-defined amplitude distribution over time.\nTypically, envelopes are used to control the output volume\nof an object, a series of fades referred to as Attack, Decay,\nSu
21stain and Release (\n<a href="https://upload.wikimedia.org/wikipedia/commons/e/ea/ADSR_parameter.svg">ADSR</a>\n). Envelopes can also control other Web Audio Parameters—for example, a p5.Envelope can\ncontrol an Oscillator&#39;s frequency like this: <code>osc.freq(env)</code>.</p>\n<p>Use <code><a href="#/p5.Envelope/setRange">setRange</a></code> to change the attack/release level.\nUse <code><a href="#/p5.Envelope/setADSR">setADSR</a></code> to change attackTime, decayTime, sustainPercent and releaseTime.</p>\n<p>Use the <code><a href="#/p5.Envelope/play">play</a></code> method to play the entire envelope,\nthe <code><a href="#/p5.Envelope/ramp">ramp</a></code> method for a pingable trigger,\nor <code><a href="#/p5.Envelope/triggerAttack">triggerAttack</a></code>/\n<code><a href="#/p5.Envelope/triggerRelease">triggerRelease</a></code> to trigger noteOn/noteOff.</p>',is_constructor:1,example:["\n<div><code>\nvar attackLevel = 1.0;\nvar releaseLevel = 0;\n\nvar attackTime = 0.001;\nvar decayTime = 0.2;\nvar susPercent = 0.2;\nvar releaseTime = 0.5;\n\nvar env, triOsc;\n\nfunction setup() {\n  var cnv = createCanvas(100, 100);\n\n  textAlign(CENTER);\n  text('click to play', width/2, height/2);\n\n  env = new p5.Envelope();\n  env.setADSR(attackTime, decayTime, susPercent, releaseTime);\n  env.setRange(attackLevel, releaseLevel);\n\n  triOsc = new p5.Oscillator('triangle');\n  triOsc.amp(env);\n  triOsc.start();\n  triOsc.freq(220);\n\n  cnv.mousePressed(playEnv);\n}\n\nfunction playEnv()  {\n  env.play();\n}\n</code></div>"]},"p5.Pulse":{name:"p5.Pulse",shortname:"p5.Pulse",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:7114,description:'<p>Creates a Pulse object, an oscillator that implements\nPulse Width Modulation.\nThe pulse is created with two oscillators.\nAccepts a parameter for frequency, and to set the\nwidth between the pulses. See <a href="\nhttp://p5js.org/reference/#/p5.Oscillator">\n<code>p5.Oscillator</code> for a full list of methods.</p>\n',extends:"p5.Oscillator",is_constructor:1,params:[{name:"freq",description:"<p>Frequency in oscillations per second (Hz)</p>\n",type:"Number",optional:!0},{name:"w",description:"<p>Width between the pulses (0 to 1.0,\n                       defaults to 0)</p>\n",type:"Number",optional:!0}],example:["\n<div><code>\nvar pulse;\nfunction setup() {\n  background(0);\n\n  // Create and start the pulse wave oscillator\n  pulse = new p5.Pulse();\n  pulse.amp(0.5);\n  pulse.freq(220);\n  pulse.start();\n}\n\nfunction draw() {\n  var w = map(mouseX, 0, width, 0, 1);\n  w = constrain(w, 0, 1);\n  pulse.width(w)\n}\n</code></div>"]},"p5.Noise":{name:"p5.Noise",shortname:"p5.Noise",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:7293,description:"<p>Noise is a type of oscillator that generates a buffer with random values.</p>\n",extends:"p5.Oscillator",is_constructor:1,params:[{name:"type",description:"<p>Type of noise can be &#39;white&#39; (default),\n                     &#39;brown&#39; or &#39;pink&#39;.</p>\n",type:"String"}]},"p5.AudioIn":{name:"p5.AudioIn",shortname:"p5.AudioIn",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:7441,description:'<p>Get audio from an input, i.e. your computer&#39;s microphone.</p>\n\n<p>Turn the mic on/off with the start() and stop() methods. When the mic\nis on, its volume can be measured with getLevel or by connecting an\nFFT object.</p>\n\n<p>If you want to hear the AudioIn, use the .connect() method.\nAudioIn does not connect to p5.sound output by default to prevent\nfeedback.</p>\n\n<p><em>Note: This uses the <a href="http://caniuse.com/stream">getUserMedia/\nStream</a> API, which is not supported by certain browsers. Access in Chrome browser\nis limited to localhost and https, but access over http may be limited.</em></p>',is_constructor:1,params:[{name:"errorCallback",description:"<p>A function to call if there is an error\n                                  accessing the AudioIn. For example,\n                                  Safari and iOS devices do not\n                                  currently allow microphone access.</p>\n",type:"Function",optional:!0}],example:["\n<div><code>\nvar mic;\nfunction setup(){\n  mic = new p5.AudioIn()\n  mic.start();\n}\nfunction draw(){\n  background(0);\n  micLevel = mic.getLevel();\n  ellipse(width/2, constrain(height-micLevel*height*5, 0, height), 10, 10);\n}\n</code></div>"]}
21,"p5.Effect":{name:"p5.Effect",shortname:"p5.Effect",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:8357,description:'<p>Effect is a base class for audio effects in p5. <br>\nThis module handles the nodes and methods that are \ncommon and useful for current and future effects.</p>\n<p>This class is extended by <a href="/reference/#/p5.Distortion">p5.Distortion</a>, \n<a href="/reference/#/p5.Compressor">p5.Compressor</a>,\n<a href="/reference/#/p5.Delay">p5.Delay</a>, \n<a href="/reference/#/p5.Filter">p5.Filter</a>, \n<a href="/reference/#/p5.Reverb">p5.Reverb</a>.</p>\n',is_constructor:1,params:[{name:"ac",description:"<p>Reference to the audio context of the p5 object</p>\n",type:"Object",optional:!0},{name:"input",description:"<p>Gain Node effect wrapper</p>\n",type:"AudioNode",optional:!0},{name:"output",description:"<p>Gain Node effect wrapper</p>\n",type:"AudioNode",optional:!0},{name:"_drywet",description:"<p>Tone.JS CrossFade node (defaults to value: 1)</p>\n",type:"Object",optional:!0},{name:"wet",description:"<p>Effects that extend this class should connect\n                             to the wet signal to this gain node, so that dry and wet \n                             signals are mixed properly.</p>\n",type:"AudioNode",optional:!0}]},"p5.Filter":{name:"p5.Filter",shortname:"p5.Filter",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:8499,description:'<p><p>A p5.Filter uses a Web Audio Biquad Filter to filter\nthe frequency response of an input source. Subclasses\ninclude:</p></p>\n<ul>\n<li><a href="/reference/#/p5.LowPass"><code>p5.LowPass</code></a>:\nAllows frequencies below the cutoff frequency to pass through,\nand attenuates frequencies above the cutoff.<br/></li>\n<li><a href="/reference/#/p5.HighPass"><code>p5.HighPass</code></a>:\nThe opposite of a lowpass filter. <br/></li>\n<li><a href="/reference/#/p5.BandPass"><code>p5.BandPass</code></a>:\nAllows a range of frequencies to pass through and attenuates\nthe frequencies below and above this frequency range.<br/></li>\n</ul>\n<p>The <code>.res()</code> method controls either width of the\nbandpass, or resonance of the low/highpass cutoff frequency.</p>\n<p>This class extends <a href = "/reference/#/p5.Effect">p5.Effect</a>.<br>Methods <a href = "/reference/#/p5.Effect/amp">amp()</a>, <a href = "/reference/#/p5.Effect/chain">chain()</a>, \n<a href = "/reference/#/p5.Effect/drywet">drywet()</a>, <a href = "/reference/#/p5.Effect/connect">connect()</a>, and \n<a href = "/reference/#/p5.Effect/disconnect">disconnect()</a> are available.</p>\n',extends:"p5.Effect",is_constructor:1,params:[{name:"type",description:"<p>&#39;lowpass&#39; (default), &#39;highpass&#39;, &#39;bandpass&#39;</p>\n",type:"String",optional:!0}],example:["\n<div><code>\nvar fft, noise, filter;\n\nfunction setup() {\n  fill(255, 40, 255);\n\n  filter = new p5.BandPass();\n\n  noise = new p5.Noise();\n  // disconnect unfiltered noise,\n  // and connect to filter\n  noise.disconnect();\n  noise.connect(filter);\n  noise.start();\n\n  fft = new p5.FFT();\n}\n\nfunction draw() {\n  background(30);\n\n  // set the BandPass frequency based on mouseX\n  var freq = map(mouseX, 0, width, 20, 10000);\n  filter.freq(freq);\n  // give the filter a narrow band (lower res = wider bandpass)\n  filter.res(50);\n\n  // draw filtered spectrum\n  var spectrum = fft.analyze();\n  noStroke();\n  for (var i = 0; i < spectrum.length; i++) {\n    var x = map(i, 0, spectrum.length, 0, width);\n    var h = -height + map(spectrum[i], 0, 255, height, 0);\n    rect(x, height, width/spectrum.length, h);\n  }\n\n  isMouseOverCanvas();\n}\n\nfunction isMouseOverCanvas() {\n  var mX = mouseX, mY = mouseY;\n  if (mX > 0 && mX < width && mY < height && mY > 0) {\n    noise.amp(0.5, 0.2);\n  } else {\n    noise.amp(0, 0.2);\n  }\n}\n</code></div>"]},"p5.LowPass":{name:"p5.LowPass",shortname:"p5.LowPass",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:8730,description:"<p>Constructor: <code>new p5.LowPass()</code> Filter.\nThis is the same as creating a p5.Filter and then calling\nits method <code>setType(&#39;lowpass&#39;)</code>.\nSee p5.Filter for methods.</p>\n",is_constructor:1,extends:"p5.Filter"},"p5.HighPass":{name:"p5.HighPass",shortname:"p5.HighPass",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:8744,description:"<p>Constructor: <code>new p5.HighPass()</code> Filter.\nThis is the same as creating a p5.Filter and then calling\nits method <code>setType(&#39;highpass&#39;)</code>.\nSee p5.Filter for methods.</p>\n",is_constructor:1,extends:"p5.Filter"},"p5.BandPass":{name:"p5.BandPass",shortname:"p5.BandPass",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:8758,description:"<p>Constructor: <code>new p5.BandPass()</code> Filter.\nThis is the same as creating a p5.Filter and then calling\nits method <code>setType(&#39;bandpass&#39;)</code>.\nSee p5.Filter for methods.</p>\n",is_constructor:1,extends:"p5.Filter"},"p5.EQ":{name:"p5.EQ",shortname:"p5.EQ",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:8829,description:'<p>p5.EQ is an audio effect that performs the function of a multiband\naudio equal
21izer. Equalization is used to adjust the balance of\nfrequency compoenents of an audio signal. This process is commonly used\nin sound production and recording to change the waveform before it reaches\na sound output device. EQ can also be used as an audio effect to create\ninteresting distortions by filtering out parts of the spectrum. p5.EQ is\nbuilt using a chain of Web Audio Biquad Filter Nodes and can be\ninstantiated with 3 or 8 bands. Bands can be added or removed from\nthe EQ by directly modifying p5.EQ.bands (the array that stores filters).</p>\n<p>This class extends <a href = "/reference/#/p5.Effect">p5.Effect</a>.\nMethods <a href = "/reference/#/p5.Effect/amp">amp()</a>, <a href = "/reference/#/p5.Effect/chain">chain()</a>,\n<a href = "/reference/#/p5.Effect/drywet">drywet()</a>, <a href = "/reference/#/p5.Effect/connect">connect()</a>, and\n<a href = "/reference/#/p5.Effect/disconnect">disconnect()</a> are available.</p>\n',is_constructor:1,extends:"p5.Effect",params:[{name:"_eqsize",description:"<p>Constructor will accept 3 or 8, defaults to 3</p>\n",type:"Number",optional:!0}],return:{description:"p5.EQ object",type:"Object"},example:["\n<div><code>\nvar eq;\nvar band_names;\nvar band_index;\n\nvar soundFile, play;\n\nfunction preload() {\n  soundFormats('mp3', 'ogg');\n  soundFile = loadSound('assets/beat');\n}\n\nfunction setup() {\n  eq = new p5.EQ(3);\n  soundFile.disconnect();\n  eq.process(soundFile);\n\n  band_names = ['lows','mids','highs'];\n  band_index = 0;\n  play = false;\n  textAlign(CENTER);\n}\n\nfunction draw() {\n  background(30);\n  noStroke();\n  fill(255);\n  text('click to kill',50,25);\n\n  fill(255, 40, 255);\n  textSize(26);\n  text(band_names[band_index],50,55);\n\n  fill(255);\n  textSize(9);\n  text('space = play/pause',50,80);\n}\n\n//If mouse is over canvas, cycle to the next band and kill the frequency\nfunction mouseClicked() {\n  for (var i = 0; i < eq.bands.length; i++) {\n    eq.bands[i].gain(0);\n  }\n  eq.bands[band_index].gain(-40);\n  if (mouseX > 0 && mouseX < width && mouseY < height && mouseY > 0) {\n    band_index === 2 ? band_index = 0 : band_index++;\n  }\n}\n\n//use space bar to trigger play / pause\nfunction keyPressed() {\n  if (key===' ') {\n    play = !play\n    play ? soundFile.loop() : soundFile.pause();\n  }\n}\n</code></div>"]},"p5.Panner3D":{name:"p5.Panner3D",shortname:"p5.Panner3D",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:9021,description:'<p>Panner3D is based on the <a title="Web Audio Panner docs"  href=\n"https://developer.mozilla.org/en-US/docs/Web/API/PannerNode">\nWeb Audio Spatial Panner Node</a>.\nThis panner is a spatial processing node that allows audio to be positioned\nand oriented in 3D space.</p>\n<p>The position is relative to an <a title="Web Audio Listener docs" href=\n"https://developer.mozilla.org/en-US/docs/Web/API/AudioListener">\nAudio Context Listener</a>, which can be accessed\nby <code>p5.soundOut.audiocontext.listener</code></p>\n',is_constructor:1},"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:9472,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.Envelope(.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>"]}
21,"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:9749,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>.\nMethods <a href = "/reference/#/p5.Effect/amp">amp()</a>, <a href = "/reference/#/p5.Effect/chain">chain()</a>,\n<a href = "/reference/#/p5.Effect/drywet">drywet()</a>, <a href = "/reference/#/p5.Effect/connect">connect()</a>, and\n<a href = "/reference/#/p5.Effect/disconnect">disconnect()</a> are available.</p>\n',extends:"p5.Effect",is_constructor:1,example:["\n<div><code>\nvar soundFile, reverb;\nfunction preload() {\n  soundFile = loadSound('assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup() {\n  reverb = new p5.Reverb();\n  soundFile.disconnect(); // so we'll only hear reverb...\n\n  // connect soundFile to reverb, process w/\n  // 3 second reverbTime, decayRate of 2%\n  reverb.process(soundFile, 3, 2);\n  soundFile.play();\n}\n</code></div>"]},"p5.Convolver":{name:"p5.Convolver",shortname:"p5.Convolver",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:9920,description:'<p>p5.Convolver extends p5.Reverb. It can emulate the sound of real\nphysical spaces through a process called <a href="\nhttps://en.wikipedia.org/wiki/Convolution_reverb#Real_space_simulation">\nconvolution</a>.</p>\n\n<p>Convolution multiplies any audio input by an &quot;impulse response&quot;\nto simulate the dispersion of sound over time. The impulse response is\ngenerated from an audio file that you provide. One way to\ngenerate an impulse response is to pop a balloon in a reverberant space\nand record the echo. Convolution can also be used to experiment with\nsound.</p>\n\n<p>Use the method <code>createConvolution(path)</code> to instantiate a\np5.Convolver with a path to your impulse response audio file.</p>',extends:"p5.Effect",is_constructor:1,params:[{name:"path",description:"<p>path to a sound file</p>\n",type:"String"},{name:"callback",description:"<p>function to call when loading succeeds</p>\n",type:"Function",optional:!0},{name:"errorCallback",description:"<p>function to call if loading fails.\n                                   This function will receive an error or\n                                   XMLHttpRequest object with information\n                                   about what went wrong.</p>\n",type:"Function",optional:!0}],example:["\n<div><code>\nvar cVerb, sound;\nfunction preload() {\n  // We have both MP3 and OGG versions of all sound assets\n  soundFormats('ogg', 'mp3');\n\n  // Try replacing 'bx-spring' with other soundfiles like\n  // 'concrete-tunnel' 'small-plate' 'drum' 'beatbox'\n  cVerb = createConvolver('assets/bx-spring.mp3');\n\n  // Try replacing 'Damscray_DancingTiger' with\n  // 'beat', 'doorbell', lucky_dragons_-_power_melody'\n  sound = loadSound('assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup() {\n  // disconnect from master output...\n  sound.disconnect();\n\n  // ...and process with cVerb\n  // so that we only hear the convolution\n  cVerb.process(sound);\n\n  sound.play();\n}\n</code></div>"]},"p5.Phrase":{name:"p5.Phrase",shortname:"p5.Phrase",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:10476,description:"<p>A phrase is a pattern of musical events over time, i.e.\na series of notes and rests.</p>\n\n<p>Phrases must be added to a p5.Part for playback, and\neach part can play multiple phrases at the same time.\nFor example, one Phrase might be a kick drum, another\ncould be a snare, and another could be the bassline.</p>\n\n<p>The first parameter is a name so that the phrase can be\nmodified or deleted later. The callback is a a function that\nthis phrase will call at every step—for example it might be\ncalled <code>playNote(value){}</code>. The array determines\nwhich value is passed into the callback at each step of the\nphrase. It can be numbers, an object with multiple numbers,\nor a zero (0) indicates a rest so the callback won&#39;t be called).</p>",is_constructor:1,params:[{name:"name",description:"<p>Name so that you can access the Phrase.</p>\n",type:"String"},{name:"callback",description:"<p>The name of a function that this phrase\n                           will call. Typically it will play a sound,\n                           and accept two parameters: a time at which\n                           to play the sound (in seconds from now),\n                           and a value from the sequence array. The\n                           time should be passed into the play() or\n                           start() method to ensure precision.</p>\n",type:"Function"},{name:"sequence",description:"<p>Array of values to pass into the callback\n                          at each step of the phrase.</p>\n",type:"Array"}],example:["\n<div><code>\nvar mySound, myPhrase, myPart;\nvar pattern = [1,0,0,2,0,2,0,0];\nvar msg = 'click to play';\n\nfunction preload() {\n  mySound = loadSound('assets/beatbox.mp3');\n}\n\nfunction setup() {\n  noStroke();\n  fill(255);\n  textAlign(CENTER);\n  masterVolume(0.1);
21\n\n  myPhrase = new p5.Phrase('bbox', makeSound, pattern);\n  myPart = new p5.Part();\n  myPart.addPhrase(myPhrase);\n  myPart.setBPM(60);\n}\n\nfunction draw() {\n  background(0);\n  text(msg, width/2, height/2);\n}\n\nfunction makeSound(time, playbackRate) {\n  mySound.rate(playbackRate);\n  mySound.play(time);\n}\n\nfunction mouseClicked() {\n  if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n    myPart.start();\n    msg = 'playing pattern';\n  }\n}\n\n</code></div>"]},"p5.Part":{name:"p5.Part",shortname:"p5.Part",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:10561,description:"<p>A p5.Part plays back one or more p5.Phrases. Instantiate a part\nwith steps and tatums. By default, each step represents a 1/16th note.</p>\n\n<p>See p5.Phrase for more about musical timing.</p>",is_constructor:1,params:[{name:"steps",description:"<p>Steps in the part</p>\n",type:"Number",optional:!0},{name:"tatums",description:"<p>Divisions of a beat, e.g. use 1/4, or 0.25 for a quater note (default is 1/16, a sixteenth note)</p>\n",type:"Number",optional:!0}],example:["\n<div><code>\nvar box, drum, myPart;\nvar boxPat = [1,0,0,2,0,2,0,0];\nvar drumPat = [0,1,1,0,2,0,1,0];\nvar msg = 'click to play';\n\nfunction preload() {\n  box = loadSound('assets/beatbox.mp3');\n  drum = loadSound('assets/drum.mp3');\n}\n\nfunction setup() {\n  noStroke();\n  fill(255);\n  textAlign(CENTER);\n  masterVolume(0.1);\n\n  var boxPhrase = new p5.Phrase('box', playBox, boxPat);\n  var drumPhrase = new p5.Phrase('drum', playDrum, drumPat);\n  myPart = new p5.Part();\n  myPart.addPhrase(boxPhrase);\n  myPart.addPhrase(drumPhrase);\n  myPart.setBPM(60);\n  masterVolume(0.1);\n}\n\nfunction draw() {\n  background(0);\n  text(msg, width/2, height/2);\n}\n\nfunction playBox(time, playbackRate) {\n  box.rate(playbackRate);\n  box.play(time);\n}\n\nfunction playDrum(time, playbackRate) {\n  drum.rate(playbackRate);\n  drum.play(time);\n}\n\nfunction mouseClicked() {\n  if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n    myPart.start();\n    msg = 'playing part';\n  }\n}\n</code></div>"]},"p5.Score":{name:"p5.Score",shortname:"p5.Score",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:10814,description:"<p>A Score consists of a series of Parts. The parts will\nbe played back in order. For example, you could have an\nA part, a B part, and a C part, and play them back in this order\n<code>new p5.Score(a, a, b, a, c)</code></p>\n",is_constructor:1,params:[{name:"parts",description:"<p>One or multiple parts, to be played in sequence.</p>\n",type:"p5.Part",optional:!0,multiple:!0}]},"p5.SoundLoop":{name:"p5.SoundLoop",shortname:"p5.SoundLoop",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:10945,description:"<p>SoundLoop</p>\n",is_constructor:1,params:[{name:"callback",description:"<p>this function will be called on each iteration of theloop</p>\n",type:"Function"},{name:"interval",description:"<p>amount of time or beats for each iteration of the loop\n                                      defaults to 1</p>\n",type:"Number|String",optional:!0}],example:["\n<div><code>\nvar click;\nvar looper1;\n\nfunction preload() {\n  click = loadSound('assets/drum.mp3');\n}\n\nfunction setup() {\n  //the looper's callback is passed the timeFromNow\n  //this value should be used as a reference point from \n  //which to schedule sounds \n  looper1 = new p5.SoundLoop(function(timeFromNow){\n    click.play(timeFromNow);\n    background(255 * (looper1.iterations % 2));\n    }, 2);\n\n  //stop after 10 iteratios;\n  looper1.maxIterations = 10;\n  //start the loop\n  looper1.start();\n}\n</code></div>"]},"p5.Compressor":{name:"p5.Compressor",shortname:"p5.Compressor",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:11205,description:'<p>Compressor is an audio effect class that performs dynamics compression\non an audio input source. This is a very commonly used technique in music\nand sound production. Compression creates an overall louder, richer, \nand fuller sound by lowering the volume of louds and raising that of softs.\nCompression can be used to avoid clipping (sound distortion due to \npeaks in volume) and is especially useful when many sounds are played \nat once. Compression can be used on indivudal sound sources in addition\nto the master output.  </p>\n<p>This class extends <a href = "/reference/#/p5.Effect">p5.Effect</a>.<br>Methods <a href = "/reference/#/p5.Effect/amp">amp()</a>, <a href = "/reference/#/p5.Effect/chain">chain()</a>, \n<a href = "/reference/#/p5.Effect/drywet">drywet()</a>, <a href = "/reference/#/p5.Effect/connect">connect()</a>, and \n<a href = "/reference/#/p5.Effect/disconnect">disconnect()</a> are available.</p>\n',is_constructor:1,extends:"p5.Effect"},"p5.SoundRecorder":{name:"p5.SoundRecorder",shortname:"p5.SoundRecorder",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:11417,description:"<p>
21Record sounds for playback and/or to save as a .wav file.\nThe p5.SoundRecorder records all sound output from your sketch,\nor can be assigned a specific source with setInput().</p>\n<p>The record() method accepts a p5.SoundFile as a parameter.\nWhen playback is stopped (either after the given amount of time,\nor with the stop() method), the p5.SoundRecorder will send its\nrecording to that p5.SoundFile for playback.</p>",is_constructor:1,example:["\n<div><code>\nvar mic, recorder, soundFile;\nvar state = 0;\n\nfunction setup() {\n  background(200);\n  // create an audio in\n  mic = new p5.AudioIn();\n\n  // prompts user to enable their browser mic\n  mic.start();\n\n  // create a sound recorder\n  recorder = new p5.SoundRecorder();\n\n  // connect the mic to the recorder\n  recorder.setInput(mic);\n\n  // this sound file will be used to\n  // playback & save the recording\n  soundFile = new p5.SoundFile();\n\n  text('keyPress to record', 20, 20);\n}\n\nfunction keyPressed() {\n  // make sure user enabled the mic\n  if (state === 0 && mic.enabled) {\n\n    // record to our p5.SoundFile\n    recorder.record(soundFile);\n\n    background(255,0,0);\n    text('Recording!', 20, 20);\n    state++;\n  }\n  else if (state === 1) {\n    background(0,255,0);\n\n    // stop recorder and\n    // send result to soundFile\n    recorder.stop();\n\n    text('Stopped', 20, 20);\n    state++;\n  }\n\n  else if (state === 2) {\n    soundFile.play(); // play the result!\n    save(soundFile, 'mySound.wav');\n    state++;\n  }\n}\n</div></code>"]},"p5.PeakDetect":{name:"p5.PeakDetect",shortname:"p5.PeakDetect",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:11655,description:'<p>PeakDetect works in conjunction with p5.FFT to\nlook for onsets in some or all of the frequency spectrum.\n</p>\n<p>\nTo use p5.PeakDetect, call <code>update</code> in the draw loop\nand pass in a p5.FFT object.\n</p>\n<p>\nYou can listen for a specific part of the frequency spectrum by\nsetting the range between <code>freq1</code> and <code>freq2</code>.\n</p>\n\n<p><code>threshold</code> is the threshold for detecting a peak,\nscaled between 0 and 1. It is logarithmic, so 0.1 is half as loud\nas 1.0.</p>\n\n<p>\nThe update method is meant to be run in the draw loop, and\n<b>frames</b> determines how many loops must pass before\nanother peak can be detected.\nFor example, if the frameRate() = 60, you could detect the beat of a\n120 beat-per-minute song with this equation:\n<code> framesPerPeak = 60 / (estimatedBPM / 60 );</code>\n</p>\n\n<p>\nBased on example contribtued by @b2renger, and a simple beat detection\nexplanation by <a\nhref="http://www.airtightinteractive.com/2013/10/making-audio-reactive-visuals/"\ntarget="_blank">Felix Turner</a>.\n</p>',is_constructor:1,params:[{name:"freq1",description:"<p>lowFrequency - defaults to 20Hz</p>\n",type:"Number",optional:!0},{name:"freq2",description:"<p>highFrequency - defaults to 20000 Hz</p>\n",type:"Number",optional:!0},{name:"threshold",description:"<p>Threshold for detecting a beat between 0 and 1\n                          scaled logarithmically where 0.1 is 1/2 the loudness\n                          of 1.0. Defaults to 0.35.</p>\n",type:"Number",optional:!0},{name:"framesPerPeak",description:"<p>Defaults to 20.</p>\n",type:"Number",optional:!0}],example:["\n<div><code>\n\nvar cnv, soundFile, fft, peakDetect;\nvar ellipseWidth = 10;\n\nfunction preload() {\n  soundFile = loadSound('assets/beat.mp3');\n}\n\nfunction setup() {\n  background(0);\n  noStroke();\n  fill(255);\n  textAlign(CENTER);\n\n  // p5.PeakDetect requires a p5.FFT\n  fft = new p5.FFT();\n  peakDetect = new p5.PeakDetect();\n}\n\nfunction draw() {\n  background(0);\n  text('click to play/pause', width/2, height/2);\n\n  // peakDetect accepts an fft post-analysis\n  fft.analyze();\n  peakDetect.update(fft);\n\n  if ( peakDetect.isDetected ) {\n    ellipseWidth = 50;\n  } else {\n    ellipseWidth *= 0.95;\n  }\n\n  ellipse(width/2, height/2, ellipseWidth, ellipseWidth);\n}\n\n// toggle play/stop when canvas is clicked\nfunction mouseClicked() {\n  if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n    if (soundFile.isPlaying() ) {\n      soundFile.stop();\n    } else {\n      soundFile.play();\n    }\n  }\n}\n</code></div>"]},"p5.Gain":{name:"p5.Gain",shortname:"p5.Gain",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:11879,description:"<p>A gain node is usefull to set the relative volume of sound.\nIt&#39;s typically used to build mixers.</p>\n",is_constructor:1,example:["\n<div><code>\n\n // load two soundfile and crossfade beetween them\n var sound1,sound2;\n var gain1, gain2, gain3;\n\n function preload(){\n soundFormats('ogg', 'mp3');\n sound1 = loadSound('assets/Damscray_-_Dancing_Tiger_01');\n sound2 = loadSound('assets/beat.mp3');\n }\n\n function setup() {\n createCanvas(400,200);
21\n\n // create a 'master' gain to which we will connect both soundfiles\n gain3 = new p5.Gain();\n gain3.connect();\n\n // setup first sound for playing\n sound1.rate(1);\n sound1.loop();\n sound1.disconnect(); // diconnect from p5 output\n\n gain1 = new p5.Gain(); // setup a gain node\n gain1.setInput(sound1); // connect the first sound to its input\n gain1.connect(gain3); // connect its output to the 'master'\n\n sound2.rate(1);\n sound2.disconnect();\n sound2.loop();\n\n gain2 = new p5.Gain();\n gain2.setInput(sound2);\n gain2.connect(gain3);\n\n }\n\n function draw(){\n background(180);\n\n // calculate the horizontal distance beetween the mouse and the right of the screen\n var d = dist(mouseX,0,width,0);\n\n // map the horizontal position of the mouse to values useable for volume control of sound1\n var vol1 = map(mouseX,0,width,0,1);\n var vol2 = 1-vol1; // when sound1 is loud, sound2 is quiet and vice versa\n\n gain1.amp(vol1,0.5,0);\n gain2.amp(vol2,0.5,0);\n\n // map the vertical position of the mouse to values useable for 'master volume control'\n var vol3 = map(mouseY,0,height,0,1);\n gain3.amp(vol3,0.5,0);\n }\n</code></div>\n"]},"p5.AudioVoice":{name:"p5.AudioVoice",shortname:"p5.AudioVoice",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:12020,description:"<p>Base class for monophonic synthesizers. Any extensions of this class\nshould follow the API and implement the methods below in order to \nremain compatible with p5.PolySynth();</p>\n",is_constructor:1},"p5.MonoSynth":{name:"p5.MonoSynth",shortname:"p5.MonoSynth",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:12073,description:"<p>A MonoSynth is used as a single voice for sound synthesis.\nThis is a class to be used in conjunction with the PolySynth\nclass. Custom synthetisers should be built inheriting from\nthis class.</p>\n",is_constructor:1,example:["\n<div><code>\nvar monoSynth;\n\nfunction setup() {\n  var cnv = createCanvas(100, 100);\n  cnv.mousePressed(playSynth);\n\n  monoSynth = new p5.MonoSynth();\n\n  textAlign(CENTER);\n  text('click to play', width/2, height/2);\n}\n\nfunction playSynth() {\n  // time from now (in seconds)\n  var time = 0;\n  // note duration (in seconds)\n  var dur = 0.25;\n  // velocity (volume, from 0 to 1)\n  var v = 0.2;\n\n  monoSynth.play(\"G3\", v, time, dur);\n  monoSynth.play(\"C4\", v, time += dur, dur);\n\n  background(random(255), random(255), 255);\n  text('click to play', width/2, height/2);\n}\n</code></div>"]},"p5.PolySynth":{name:"p5.PolySynth",shortname:"p5.PolySynth",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:12362,description:"<p>An AudioVoice is used as a single voice for sound synthesis.\nThe PolySynth class holds an array of AudioVoice, and deals\nwith voices allocations, with setting notes to be played, and\nparameters to be set.</p>\n",is_constructor:1,params:[{name:"synthVoice",description:"<p>A monophonic synth voice inheriting\n                               the AudioVoice class. Defaults to p5.MonoSynth</p>\n",type:"Number",optional:!0},{name:"maxVoices",description:"<p>Number of voices, defaults to 8;</p>\n",type:"Number",optional:!0}],example:['\n<div><code>\nvar polySynth;\n\nfunction setup() {\n  var cnv = createCanvas(100, 100);\n  cnv.mousePressed(playSynth);\n\n  polySynth = new p5.PolySynth();\n\n  textAlign(CENTER);\n  text(\'click to play\', width/2, height/2);\n}\n\nfunction playSynth() {\n  // note duration (in seconds)\n  var dur = 1.5;\n\n  // time from now (in seconds)\n  var time = 0;\n\n  // velocity (volume, from 0 to 1)\n  var vel = 0.1;\n\n  // notes can overlap with each other\n  polySynth.play("G2", vel, 0, dur);\n  polySynth.play("C3", vel, time += 1/3, dur);\n  polySynth.play("G3", vel, time += 1/3, dur);\n\n  background(random(255), random(255), 255);\n  text(\'click to play\', width/2, height/2);\n}\n</code></div>']},"p5.Distortion":{name:"p5.Distortion",shortname:"p5.Distortion",classitems:[],plugins:[],extensions:[],plugin_for:[],extension_for:[],module:"p5.sound",submodule:"p5.sound",namespace:"",file:"lib/addons/p5.sound.js",line:12767,description:'<p>A Distortion effect created with a Waveshaper Node,\nwith an approach adapted from\n<a href="http://stackoverflow.com/questions/22312841/waveshaper-node
21-in-webaudio-how-to-emulate-distortion">Kevin Ennis</a></p>\n<p>This class extends <a href = "/reference/#/p5.Effect">p5.Effect</a>.<br>Methods <a href = "/reference/#/p5.Effect/amp">amp()</a>, <a href = "/reference/#/p5.Effect/chain">chain()</a>, \n<a href = "/reference/#/p5.Effect/drywet">drywet()</a>, <a href = "/reference/#/p5.Effect/connect">connect()</a>, and \n<a href = "/reference/#/p5.Effect/disconnect">disconnect()</a> are available.</p>\n',extends:"p5.Effect",is_constructor:1,params:[{name:"amount",description:"<p>Unbounded distortion amount.\n                               Normal values range from 0-1.</p>\n",type:"Number",optional:!0,optdefault:"0.25"},{name:"oversample",description:"<p>&#39;none&#39;, &#39;2x&#39;, or &#39;4x&#39;.</p>\n",type:"String",optional:!0,optdefault:"'none'"}]}},elements:{},classitems:[{file:"src/color/color_conversion.js",line:10,description:'<p>Conversions adapted from <a href="http://www.easyrgb.com/en/math.php">http://www.easyrgb.com/en/math.php</a>.</p>\n<p>In these functions, hue is always in the range [0, 1], just like all other\ncomponents are in the range [0, 1]. &#39;Brightness&#39; and &#39;value&#39; are used\ninterchangeably.</p>\n',class:"p5",module:"Color",submodule:"Color Conversion"},{file:"src/color/color_conversion.js",line:21,description:"<p>Convert an HSBA array to HSLA.</p>\n",class:"p5",module:"Color",submodule:"Color Conversion"},{file:"src/color/color_conversion.js",line:47,description:"<p>Convert an HSBA array to RGBA.</p>\n",class:"p5",module:"Color",submodule:"Color Conversion"},{file:"src/color/color_conversion.js",line:102,description:"<p>Convert an HSLA array to HSBA.</p>\n",class:"p5",module:"Color",submodule:"Color Conversion"},{file:"src/color/color_conversion.js",line:125,description:"<p>Convert an HSLA array to RGBA.</p>\n<p>We need to change basis from HSLA to something that can be more easily be\nprojected onto RGBA. We will choose hue and brightness as our first two\ncomponents, and pick a convenient third one (&#39;zest&#39;) so that we don&#39;t need\nto calculate formal HSBA saturation.</p>\n",class:"p5",module:"Color",submodule:"Color Conversion"},{file:"src/color/color_conversion.js",line:189,description:"<p>Convert an RGBA array to HSBA.</p>\n",class:"p5",module:"Color",submodule:"Color Conversion"},{file:"src/color/color_conversion.js",line:228,description:"<p>Convert an RGBA array to HSLA.</p>\n",class:"p5",module:"Color",submodule:"Color Conversion"},{file:"src/color/creating_reading.js",line:16,description:"<p>Extracts the alpha value from a color or pixel array.</p>\n",itemtype:"method",name:"alpha",params:[{name:"color",description:'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n                                        or CSS color</p>\n',type:"p5.Color|Number[]|String"}],return:{description:"the alpha value",type:"Number"},example:["\n<div>\n<code>\nnoStroke();\nlet c = color(0, 126, 255, 102);\nfill(c);\nrect(15, 15, 35, 70);\nlet value = alpha(c); // Sets 'value' to 102\nfill(value);\nrect(50, 15, 35, 70);\n</code>\n</div>"],alt:"Left half of canvas light blue and right half light charcoal grey.\nLeft half of canvas light purple and right half a royal blue.\nLeft half of canvas salmon pink and the right half white.\nYellow rect in middle right of canvas, with 55 pixel width and height.\nYellow ellipse in top left canvas, black ellipse in bottom right,both 80x80.\nBright fuchsia rect in middle of canvas, 60 pixel width and height.\nTwo bright green rects on opposite sides of the canvas, both 45x80.\nFour blue rects in each corner of the canvas, each are 35x35.\nBright sea green rect on left and darker rect on right of canvas, both 45x80.\nDark green rect on left and light green rect on right of canvas, both 45x80.\nDark blue rect on left and light teal rect on right of canvas, both 45x80.\nblue rect on left and green on right, both with black outlines & 35x60.\nsalmon pink rect on left and black on right, both 35x60.\n4 rects, tan, brown, brownish purple and purple, with white outlines & 20x60.\nlight pastel green rect on left and dark grey rect on right, both 35x60.\nyellow rect on left and red rect on right, both with black outlines & 35x60.\ngrey canvas\ndeep pink rect on left and grey rect on right, both 35x60.",class:"p5",module:"Color",submodule:"Creating & Reading"},{file:"src/color/creating_reading.js",line:61,description:"<p>Extracts the blue value from a color or pixel array.</p>\n",itemtype:"method",name:"blue",params:[{name:"color",description:'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n                                        or CSS color</p>\n',type:"p5.Color|Number[]|String"}],return:{description:"the blue value",type:"Number"},example:["\n<div>\n<code>\nlet c = color(175, 100, 220); // Define color 'c'\nfill(c); // Use color variable 'c' as fill color\nrect(15, 20, 35, 60); // Draw left rectangle\n\nlet blueValue = blue(c); // Get blue in 'c'\nprint(blueValue); // Prints \"220.0\"\nfill(0, 0, blueValue); // Use 'blueValue' in new fill\nrect(50, 20, 35, 60); // Draw right rectangle\n</code>\n</div>"],alt:"Left half of canvas light purple and right half a royal blue.",class:"p5",module:"Color",submodule:"Creating & Reading"},{file:"src/color/creating_reading.js",line:91,description:"<p>Extracts the HSB brightness value from a color or pixel array.</p>\n",itemtype:"method",name:"brightness",params:[{name:"color",description:'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n                                        or CSS color</p>\n',type:"p5.Color|Number[]|String"}],return:{description:"the brightness value",type:"Number"},example:["\n<div>\n<code>\nnoStroke();\ncolorMode(HSB, 255);\nlet c = color(0, 126, 255);\nfill(c);\nrect(15, 20, 35, 60);\nlet value = brightness(c); // Sets 'value' to 255\nfill(value);\nrect(50, 20, 35, 60);\n</code>\n</div>\n<div>\n<code>\nnoStroke();\ncolorMode(HSB, 255);\nlet c = color('hsb(60, 100%, 50%)');\nfill(c);\nrect(15, 20, 35, 60);\nlet value = brightness(c); // A 'value' of 50% is 127.5\nfill(value);\nrect(50, 20, 35, 60);\n</code>\n</div>"],alt:"Left half of canvas salmon pink and the right half white.\nLeft half of canvas yellow at half brightness and the right gray .",class:"p5",module:"Color",submodule:"Creating & Reading"},{file:"src/color/creating_reading.js",line:134,description:'<p>Creates colors for storing in variables of the color datatype. The\nparameters are interpreted as RGB or HSB values depending on the\ncurrent <a href="#/p5/colorMode">colorMode()</a>. The default mode is RGB values from 0 to 255\nand, therefore, the function call color(255, 204, 0) will return a\nbright yellow color.\n<br><br>\nNote that if only one value is provided to <a href="#/p5/color">color()</a>, it will be interpreted\nas a grayscale value. Add a second value, and it will be used for alpha\ntransparency. When three values are specified, they are interpreted as\neither RGB or HSB values. Adding a fourth value applies alpha\ntransparency.\n<br><br>
21\nIf a single string argument is provided, RGB, RGBA and Hex CSS color\nstrings and all named color strings are supported. In this case, an alpha\nnumber value as a second argument is not supported, the RGBA form should be\nused.</p>\n',itemtype:"method",name:"color",return:{description:"resulting color",type:"p5.Color"},example:["\n<div>\n<code>\nlet c = color(255, 204, 0); // Define color 'c'\nfill(c); // Use color variable 'c' as fill color\nnoStroke(); // Don't draw a stroke around shapes\nrect(30, 20, 55, 55); // Draw rectangle\n</code>\n</div>\n\n<div>\n<code>\nlet c = color(255, 204, 0); // Define color 'c'\nfill(c); // Use color variable 'c' as fill color\nnoStroke(); // Don't draw a stroke around shapes\nellipse(25, 25, 80, 80); // Draw left circle\n\n// Using only one value with color()\n// generates a grayscale value.\nc = color(65); // Update 'c' with grayscale value\nfill(c); // Use updated 'c' as fill color\nellipse(75, 75, 80, 80); // Draw right circle\n</code>\n</div>\n\n<div>\n<code>\n// Named SVG & CSS colors may be used,\nlet c = color('magenta');\nfill(c); // Use 'c' as fill color\nnoStroke(); // Don't draw a stroke around shapes\nrect(20, 20, 60, 60); // Draw rectangle\n</code>\n</div>\n\n<div>\n<code>\n// as can hex color codes:\nnoStroke(); // Don't draw a stroke around shapes\nlet c = color('#0f0');\nfill(c); // Use 'c' as fill color\nrect(0, 10, 45, 80); // Draw rectangle\n\nc = color('#00ff00');\nfill(c); // Use updated 'c' as fill color\nrect(55, 10, 45, 80); // Draw rectangle\n</code>\n</div>\n\n<div>\n<code>\n// RGB and RGBA color strings are also supported:\n// these all set to the same color (solid blue)\nlet c;\nnoStroke(); // Don't draw a stroke around shapes\nc = color('rgb(0,0,255)');\nfill(c); // Use 'c' as fill color\nrect(10, 10, 35, 35); // Draw rectangle\n\nc = color('rgb(0%, 0%, 100%)');\nfill(c); // Use updated 'c' as fill color\nrect(55, 10, 35, 35); // Draw rectangle\n\nc = color('rgba(0, 0, 255, 1)');\nfill(c); // Use updated 'c' as fill color\nrect(10, 55, 35, 35); // Draw rectangle\n\nc = color('rgba(0%, 0%, 100%, 1)');\nfill(c); // Use updated 'c' as fill color\nrect(55, 55, 35, 35); // Draw rectangle\n</code>\n</div>\n\n<div>\n<code>\n// HSL color is also supported and can be specified\n// by value\nlet c;\nnoStroke(); // Don't draw a stroke around shapes\nc = color('hsl(160, 100%, 50%)');\nfill(c); // Use 'c' as fill color\nrect(0, 10, 45, 80); // Draw rectangle\n\nc = color('hsla(160, 100%, 50%, 0.5)');\nfill(c); // Use updated 'c' as fill color\nrect(55, 10, 45, 80); // Draw rectangle\n</code>\n</div>\n\n<div>\n<code>\n// HSB color is also supported and can be specified\n// by value\nlet c;\nnoStroke(); // Don't draw a stroke around shapes\nc = color('hsb(160, 100%, 50%)');\nfill(c); // Use 'c' as fill color\nrect(0, 10, 45, 80); // Draw rectangle\n\nc = color('hsba(160, 100%, 50%, 0.5)');\nfill(c); // Use updated 'c' as fill color\nrect(55, 10, 45, 80); // Draw rectangle\n</code>\n</div>\n\n<div>\n<code>\nlet c; // Declare color 'c'\nnoStroke(); // Don't draw a stroke around shapes\n\n// If no colorMode is specified, then the\n// default of RGB with scale of 0-255 is used.\nc = color(50, 55, 100); // Create a color for 'c'\nfill(c); // Use color variable 'c' as fill color\nrect(0, 10, 45, 80); // Draw left rect\n\ncolorMode(HSB, 100); // Use HSB with scale of 0-100\nc = color(50, 55, 100); // Update 'c' with new color\nfill(c); // Use updated 'c' as fill color\nrect(55, 10, 45, 80); // Draw right rect\n</code>\n</div>"],alt:"Yellow rect in middle right of canvas, with 55 pixel width and height.\nYellow ellipse in top left of canvas, black ellipse in bottom right,both 80x80.\nBright fuchsia rect in middle of canvas, 60 pixel width and height.\nTwo bright green rects on opposite sides of the canvas, both 45x80.\nFour blue rects in each corner of the canvas, each are 35x35.\nBright sea green rect on left and darker rect on right of canvas, both 45x80.\nDark green rect on left and lighter green rect on right of canvas, both 45x80.\nDark blue rect on left and light teal rect on right of canvas, both 45x80.",class:"p5",module:"Color",submodule:"Creating & Reading",overloads:[{line:134,params:[{name:"gray",de
21scription:"<p>number specifying value between white\n                                and black.</p>\n",type:"Number"},{name:"alpha",description:"<p>alpha value relative to current color range\n                                (default is 0-255)</p>\n",type:"Number",optional:!0}],return:{description:"resulting color",type:"p5.Color"}},{line:293,params:[{name:"v1",description:"<p>red or hue value relative to\n                                the current color range</p>\n",type:"Number"},{name:"v2",description:"<p>green or saturation value\n                                relative to the current color range</p>\n",type:"Number"},{name:"v3",description:"<p>blue or brightness value\n                                relative to the current color range</p>\n",type:"Number"},{name:"alpha",description:"",type:"Number",optional:!0}],return:{description:"",type:"p5.Color"}},{line:305,params:[{name:"value",description:"<p>a color string</p>\n",type:"String"}],return:{description:"",type:"p5.Color"}},{line:310,params:[{name:"values",description:"<p>an array containing the red,green,blue &amp;\n                                and alpha components of the color</p>\n",type:"Number[]"}],return:{description:"",type:"p5.Color"}},{line:316,params:[{name:"color",description:"",type:"p5.Color"}],return:{description:"",type:"p5.Color"}}]},{file:"src/color/creating_reading.js",line:332,description:"<p>Extracts the green value from a color or pixel array.</p>\n",itemtype:"method",name:"green",params:[{name:"color",description:'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n                                        or CSS color</p>\n',type:"p5.Color|Number[]|String"}],return:{description:"the green value",type:"Number"},example:["\n<div>\n<code>\nlet c = 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\nlet greenValue = 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:363,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><a href="#/p5.Color">p5.Color</a> object, color components,\n                                        or CSS color</p>\n',type:"p5.Color|Number[]|String"}],return:{description:"the hue",type:"Number"},example:["\n<div>\n<code>\nnoStroke();\ncolorMode(HSB, 255);\nlet c = color(0, 126, 255);\nfill(c);\nrect(15, 20, 35, 60);\nlet value = 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:400,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 <a href="#/p5/lerp">lerp()</a>,\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);
21\nstroke(255);\nbackground(51);\nlet from = color(218, 165, 32);\nlet to = color(72, 61, 139);\ncolorMode(RGB); // Try changing to HSB.\nlet interA = lerpColor(from, to, 0.33);\nlet interB = lerpColor(from, to, 0.66);\nfill(from);\nrect(10, 20, 20, 60);\nfill(interA);\nrect(30, 20, 20, 60);\nfill(interB);\nrect(50, 20, 20, 60);\nfill(to);\nrect(70, 20, 20, 60);\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:497,description:"<p>Extracts the HSL lightness value from a color or pixel array.</p>\n",itemtype:"method",name:"lightness",params:[{name:"color",description:'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n                                        or CSS color</p>\n',type:"p5.Color|Number[]|String"}],return:{description:"the lightness",type:"Number"},example:["\n<div>\n<code>\nnoStroke();\ncolorMode(HSL);\nlet c = color(156, 100, 50, 1);\nfill(c);\nrect(15, 20, 35, 60);\nlet value = 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:527,description:"<p>Extracts the red value from a color or pixel array.</p>\n",itemtype:"method",name:"red",params:[{name:"color",description:'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n                                        or CSS color</p>\n',type:"p5.Color|Number[]|String"}],return:{description:"the red value",type:"Number"},example:["\n<div>\n<code>\nlet c = color(255, 204, 0); // Define color 'c'\nfill(c); // Use color variable 'c' as fill color\nrect(15, 20, 35, 60); // Draw left rectangle\n\nlet redValue = red(c); // Get red in 'c'\nprint(redValue); // Print \"255.0\"\nfill(redValue, 0, 0); // Use 'redValue' in new fill\nrect(50, 20, 35, 60); // Draw right rectangle\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\ncolorMode(RGB, 255); // Sets the range for red, green, and blue to 255\nlet c = color(127, 255, 0);\ncolorMode(RGB, 1); // Sets the range for red, green, and blue to 1\nlet myColor = red(c);\nprint(myColor); // 0.4980392156862745\n</code>\n</div>"],alt:"yellow rect on left and red rect on right, both with black outlines and 35x60.\ngrey canvas",class:"p5",module:"Color",submodule:"Creating & Reading"},{file:"src/color/creating_reading.js",line:567,description:"<p>Extracts the saturation value from a color or pixel array.</p>\n<p>Saturation is scaled differently in HSB and HSL. This function will return\nthe HSB saturation when supplied with an HSB color object (or when supplied\nwith a pixel array while the color mode is HSB), but will default to the\nHSL saturation otherwise.</p>\n",itemtype:"method",name:"saturation",params:[{name:"color",description:'<p><a href="#/p5.Color">p5.Color</a> object, color components,\n                                        or CSS color</p>\n',type:"p5.Color|Number[]|String"}],return:{description:"the saturation value",type:"Number"},example:["\n<div>\n<code>\nnoStroke();\ncolorMode(HSB, 255);\nlet c = color(0, 126, 255);\nfill(c);\nrect(15, 20, 35, 60);\nlet value = saturation(c); // Sets 'value' to 126\nfill(value);\nrect(50, 20, 35, 60);\n</code>\n</div>"],alt:"deep pink rect on left and grey rect on right, both 35x60.",class:"p5",module:"Color",submodule:"Creating & Reading"},{file:"src/color/p5.Color.js",line:52,description:"<p>This function returns the color formatted as a string. This can be useful\nfor debugging, or for using p5.js with other libraries.</p>\n",itemtype:"method",name:"toString",params:[{name:"format",description:"<p>How the color string will be formatted.\nLeaving this empty formats the string as rgba(r, g, b, a).\n&#39;#rgb&#39; &#39;#rgba&#39; &#39;#rrggbb&#39; and &#39;#rrggbbaa&#39; format as hexadecimal color codes.\n&#39;rgb&#39; &#39;hsb&#39; and &#39;hsl&#39; return the color formatted in the specified color mode.\n&#39;rgba&#39; &#39;hsba&#39; and &#39;hsla&#39; are the same as above but with alpha channels.\n&#39;rgb%&#39; &#39;hsb%&#39; &#39;hsl%&#39; &#39;rgba%&#39; &#39;hsba%&#39; and &#39;hsla%&#39; format as percentages.</p>\n",type:"String",optional:!0}],return:{description:"the formatted string",type:"String"},example:["\n<div>\n<code>\nlet myColor;\nfunction setup() {\n  createCanvas(200, 200);
21\n  stroke(255);\n  myColor = color(100, 100, 250);\n  fill(myColor);\n}\n\nfunction draw() {\n  rotate(HALF_PI);\n  text(myColor.toString(), 0, -5);\n  text(myColor.toString('#rrggbb'), 0, -30);\n  text(myColor.toString('rgba%'), 0, -55);\n}\n</code>\n</div>"],alt:"canvas with text representation of color",class:"p5.Color",module:"Color",submodule:"Creating & Reading"},{file:"src/color/p5.Color.js",line:253,itemtype:"method",name:"setRed",params:[{name:"red",description:"<p>the new red value</p>\n",type:"Number"}],example:["\n<div>\n<code>\nlet backgroundColor;\n\nfunction setup() {\n  backgroundColor = color(100, 50, 150);\n}\n\nfunction draw() {\n  backgroundColor.setRed(128 + 128 * sin(millis() / 1000));\n  background(backgroundColor);\n}\n</code>\n</div>"],alt:"canvas with gradually changing background color",class:"p5.Color",module:"Color",submodule:"Creating & Reading"},{file:"src/color/p5.Color.js",line:280,itemtype:"method",name:"setGreen",params:[{name:"green",description:"<p>the new green value</p>\n",type:"Number"}],example:["\n<div>\n<code>\nlet backgroundColor;\n\nfunction setup() {\n  backgroundColor = color(100, 50, 150);\n}\n\nfunction draw() {\n  backgroundColor.setGreen(128 + 128 * sin(millis() / 1000));\n  background(backgroundColor);\n}\n</code>\n</div>"],alt:"canvas with gradually changing background color",class:"p5.Color",module:"Color",submodule:"Creating & Reading"},{file:"src/color/p5.Color.js",line:307,itemtype:"method",name:"setBlue",params:[{name:"blue",description:"<p>the new blue value</p>\n",type:"Number"}],example:["\n<div>\n<code>\nlet backgroundColor;\n\nfunction setup() {\n  backgroundColor = color(100, 50, 150);\n}\n\nfunction draw() {\n  backgroundColor.setBlue(128 + 128 * sin(millis() / 1000));\n  background(backgroundColor);\n}\n</code>\n</div>"],alt:"canvas with gradually changing background color",class:"p5.Color",module:"Color",submodule:"Creating & Reading"},{file:"src/color/p5.Color.js",line:334,itemtype:"method",name:"setAlpha",params:[{name:"alpha",description:"<p>the new alpha value</p>\n",type:"Number"}],example:["\n<div>\n<code>\nlet squareColor;\n\nfunction setup() {\n  ellipseMode(CORNERS);\n  strokeWeight(4);\n  squareColor = color(100, 50, 150);\n}\n\nfunction draw() {\n  background(255);\n\n  noFill();\n  stroke(0);\n  ellipse(10, 10, width - 10, height - 10);\n\n  squareColor.setAlpha(128 + 128 * sin(millis() / 1000));\n  fill(squareColor);\n  noStroke();\n  rect(13, 13, width - 26, height - 26);\n}\n</code>\n</div>"],alt:"circle behind a square with gradually changing opacity",class:"p5.Color",module:"Color",submodule:"Creating & Reading"},{file:"src/color/p5.Color.js",line:415,description:"<p>Hue is the same in HSB and HSL, but the maximum value may be different.\nThis function will return the HSB-normalized saturation when supplied with\nan HSB color object, but will default to the HSL-normalized saturation\notherwise.</p>\n",class:"p5.Color",module:"Color",submodule:"Creating & Reading"},{file:"src/color/p5.Color.js",line:446,description:"<p>Saturation is scaled differently in HSB and HSL. This function will return\nthe HSB saturation when supplied with an HSB color object, but will default\nto the HSL saturation otherwise.</p>\n",class:"p5.Color",module:"Color",submodule:"Creating & Reading"},{file:"src/color/p5.Color.js",line:465,description:"<p>CSS named colors.</p>\n",class:"p5.Color",module:"Color",submodule:"Creating & Reading"},{file:"src/color/p5.Color.js",line:618,description:"<p>These regular expressions are used to build up the patterns for matching\nviable CSS color strings: fragmenting the regexes in this way increases the\nlegibility and comprehensibility of the code.</p>\n<p>Note that RGB values of .9 are not parsed by IE, but are supported here for\ncolor string consistency.</p>\n",class:"p5.Color",module:"Color",submodule:"Creating & Reading"},{file:"src/color/p5.Color.js",line:631,description:"<p>Full color string patterns. The capture groups are necessary.</p>\n",class:"p5.Color",module:"Color",submodule:"Creating & Reading"},{file:"src/color/p5.Color.js",line:994,description:"<p>For HSB and HSL, interpret the gray level as a brightness/lightness\nvalue (they are equivalent when chroma is zero). For RGB, normalize the\ngray level according to the blue maximum.</p>\n",class:"p5.Color",module:"Color",submodule:"Creating & Reading"},{file:"src/color/setting.js",line:15,description:'<p>The <a href="#/p5/background">background()</a> function sets the color used for the background of the\np5.js canvas. The default background is transparent. This function is\ntypically used within <a href="#/p5/draw">draw()</a> to clear the display window at the beginning\nof each frame, but it can be used inside <a href="#/p5/setup">setup()</a> to set the background on\nthe first frame of animation or if the background need only be set once.\n<br><br>\nThe color is either specified in terms of the RGB, HSB, or HSL color\ndepending on the current <a href="#/p5/colorMode">
21colorMode</a>. (The default color space is RGB, with\neach value in the range from 0 to 255). The alpha range by default is also 0 to 255.\n<br><br>\nIf a single string argument is provided, RGB, RGBA and Hex CSS color strings\nand all named color strings are supported. In this case, an alpha number\nvalue as a second argument is not supported, the RGBA form should be used.\n<br><br>\nA <a href="#/p5.Color">p5.Color</a> object can also be provided to set the background color.\n<br><br>\nA <a href="#/p5.Image">p5.Image</a> can also be provided to set the background image.</p>\n',itemtype:"method",name:"background",chainable:1,example:["\n<div>\n<code>\n// Grayscale integer value\nbackground(51);\n</code>\n</div>\n\n<div>\n<code>\n// R, G & B integer values\nbackground(255, 204, 0);\n</code>\n</div>\n\n<div>\n<code>\n// H, S & B integer values\ncolorMode(HSB);\nbackground(255, 204, 100);\n</code>\n</div>\n\n<div>\n<code>\n// Named SVG/CSS color string\nbackground('red');\n</code>\n</div>\n\n<div>\n<code>\n// three-digit hexadecimal RGB notation\nbackground('#fae');\n</code>\n</div>\n\n<div>\n<code>\n// six-digit hexadecimal RGB notation\nbackground('#222222');\n</code>\n</div>\n\n<div>\n<code>\n// integer RGB notation\nbackground('rgb(0,255,0)');\n</code>\n</div>\n\n<div>\n<code>\n// integer RGBA notation\nbackground('rgba(0,255,0, 0.25)');\n</code>\n</div>\n\n<div>\n<code>\n// percentage RGB notation\nbackground('rgb(100%,0%,10%)');\n</code>\n</div>\n\n<div>\n<code>\n// percentage RGBA notation\nbackground('rgba(100%,0%,100%,0.5)');\n</code>\n</div>\n\n<div>\n<code>\n// p5 Color object\nbackground(color(0, 0, 255));\n</code>\n</div>"],alt:"canvas with darkest charcoal grey background.\ncanvas with yellow background.\ncanvas with royal blue background.\ncanvas with red background.\ncanvas with pink background.\ncanvas with black background.\ncanvas with bright green background.\ncanvas with soft green background.\ncanvas with red background.\ncanvas with light purple background.\ncanvas with blue background.",class:"p5",module:"Color",submodule:"Setting",overloads:[{line:15,params:[{name:"color",description:'<p>any value created by the <a href="#/p5/color">color()</a> function</p>\n',type:"p5.Color"}],chainable:1},{line:131,params:[{name:"colorstring",description:"<p>color string, possible formats include: integer\n                        rgb() or rgba(), percentage rgb() or rgba(),\n                        3-digit hex, 6-digit hex</p>\n",type:"String"},{name:"a",description:"<p>opacity of the background relative to current\n                            color range (default is 0-255)</p>\n",type:"Number",optional:!0}],chainable:1},{line:141,params:[{name:"gray",description:"<p>specifies a value between white and black</p>\n",type:"Number"},{name:"a",description:"",type:"Number",optional:!0}],chainable:1},{line:148,params:[{name:"v1",description:"<p>red or hue value (depending on the current color\n                       mode)</p>\n",type:"Number"},{name:"v2",description:"<p>green or saturation value (depending on the current\n                       color mode)</p>\n",type:"Number"},{name:"v3",description:"<p>blue or brightness value (depending on the current\n                       color mode)</p>\n",type:"Number"},{name:"a",description:"",type:"Number",optional:!0}],chainable:1},{line:160,params:[{name:"values",description:"<p>an array containing the red, green, blue\n                                and alpha components of the color</p>\n",type:"Number[]"}],chainable:1},{line:167,params:[{name:"image",description:'<p>image created with <a href="#/p5/loadImage">loadImage()</a> or <a href="#/p5/createImage">createImage()</a>,\n                            to set as background\n                            (must be same size as the sketch window)</p>\n',type:"p5.Image"},{name:"a",description:"",type:"Number",optional:!0}],chainable:1}]},{file:"src/color/setting.js",line:181,description:'<p>Clears the pixels within a buffer. This function only clears the canvas.\nIt will not clear objects created by createX() methods such as\n<a href="#/p5/createVideo">createVideo()</a> or <a href="#/p5/createDiv">createDiv()</a>.\nUnlike the main graphics context, pixels in additional graphics areas created\nwith <a href="#/p5/createGraphics">createGraphics()</a> can be entirely\nor partially transparent. This function clears everything to make all of\nthe pixels 100% transparent.</p>\n',itemtype:"method",name:"clear",chainable:1,example:["\n<div>\n<code>\n// Clear the screen on mouse press.\nfunction setup() {\n  createCanvas(100, 100);\n}\n\nfunction draw() {\n  ellipse(mouseX, mouseY, 20, 20);\n}\n\nfunction mousePressed() {\n  clear();\n}\n</code>\n</div>"],alt:"20x20 white ellipses are continually drawn at mouse x and y coordinates.",class:"p5",module:"Color",submodule:"Setting"},{file:"src/color/setting.js",line:220,description:'<p><a href="#/p5/colorMode">colorMode()</a> changes the way p5.js interprets color data. By default, the\nparameters for <a href="#/p5/fill">fill()</a>, <a href="#/p5/stroke">stroke()</a>, <a href="#/p5/background">background()</a>, and <a href="#/p5/color">color()</a> are defined by\nvalues between 0 and 255 using the RGB color model. This is equivalent to\nsetting colorMode(RGB, 255). Setting colorMode(HSB) lets you use the HSB\nsystem instead. By default, this is colorMode(HSB, 360, 100, 100, 1). You\ncan also use HSL.\n<br><br>\nNote: existing color objects remember the mode that they were created in,\nso you can change modes as you like without affecting their appearance.</p>\n',itemtype:"method",name:"colorMode",chainable:1,example:["\n<div>\n<code>\nnoStroke();\ncolorMode(RGB, 100);\nfor (let i = 0; i < 100;
21 i++) {\n  for (let j = 0; j < 100; j++) {\n    stroke(i, j, 0);\n    point(i, j);\n  }\n}\n</code>\n</div>\n\n<div>\n<code>\nnoStroke();\ncolorMode(HSB, 100);\nfor (let i = 0; i < 100; i++) {\n  for (let j = 0; j < 100; j++) {\n    stroke(i, j, 100);\n    point(i, j);\n  }\n}\n</code>\n</div>\n\n<div>\n<code>\ncolorMode(RGB, 255);\nlet c = color(127, 255, 0);\n\ncolorMode(RGB, 1);\nlet myColor = c._getRed();\ntext(myColor, 10, 10, 80, 80);\n</code>\n</div>\n\n<div>\n<code>\nnoFill();\ncolorMode(RGB, 255, 255, 255, 1);\nbackground(255);\n\nstrokeWeight(4);\nstroke(255, 0, 10, 0.3);\nellipse(40, 40, 50, 50);\nellipse(50, 50, 40, 40);\n</code>\n</div>"],alt:"Green to red gradient from bottom L to top R. shading originates from top left.\nRainbow gradient from left to right. Brightness increasing to white at top.\nunknown image.\n50x50 ellipse at middle L & 40x40 ellipse at center. Translucent pink outlines.",class:"p5",module:"Color",submodule:"Setting",overloads:[{line:220,params:[{name:"mode",description:"<p>either RGB, HSB or HSL, corresponding to\n                         Red/Green/Blue and Hue/Saturation/Brightness\n                         (or Lightness)</p>\n",type:"Constant"},{name:"max",description:"<p>range for all values</p>\n",type:"Number",optional:!0}],chainable:1},{line:297,params:[{name:"mode",description:"",type:"Constant"},{name:"max1",description:"<p>range for the red or hue depending on the\n                             current color mode</p>\n",type:"Number"},{name:"max2",description:"<p>range for the green or saturation depending\n                             on the current color mode</p>\n",type:"Number"},{name:"max3",description:"<p>range for the blue or brightness/lightness\n                             depending on the current color mode</p>\n",type:"Number"},{name:"maxA",description:"<p>range for the alpha</p>\n",type:"Number",optional:!0}],chainable:1}]},{file:"src/color/setting.js",line:341,description:'<p>Sets the color used to fill shapes. For example, if you run\nfill(204, 102, 0), all shapes drawn after the fill command will be filled with the color orange. This\ncolor is either specified in terms of the RGB or HSB color depending on\nthe current <a href="#/p5/colorMode">colorMode()</a>. (The default color space is RGB, with each value\nin the range from 0 to 255). The alpha range by default is also 0 to 255.\n<br><br>\nIf a single string argument is provided, RGB, RGBA and Hex CSS color strings\nand all named color strings are supported. In this case, an alpha number\nvalue as a second argument is not supported, the RGBA form should be used.\n<br><br>\nA p5 <a href="#/p5.Color">Color</a> object can also be provided to set the fill color.</p>\n',itemtype:"method",name:"fill",chainable:1,example:["\n<div>\n<code>\n// Grayscale integer value\nfill(51);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// R, G & B integer values\nfill(255, 204, 0);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// H, S & B integer values\ncolorMode(HSB);\nfill(255, 204, 100);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// Named SVG/CSS color string\nfill('red');\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// three-digit hexadecimal RGB notation\nfill('#fae');\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// six-digit hexadecimal RGB notation\nfill('#222222');\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// integer RGB notation\nfill('rgb(0,255,0)');\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// integer RGBA notation\nfill('rgba(0,255,0, 0.25)');\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// percentage RGB notation\nfill('rgb(100%,0%,10%)');\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// percentage RGBA notation\nfill('rgba(100%,0%,100%,0.5)');\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// p5 Color object\nfill(color(0, 0, 255));\nrect(20, 20, 60, 60);\n</code>\n</div>"],alt:"60x60 dark charcoal grey rect with black outline in center of canvas.\n60x60 yellow rect with black outline in center of canvas.\n60x60 royal blue rect with black outline in center of canvas.\n60x60 red rect with black outline in center of canvas.\n60x60 pink rect with black outline in center of canvas.\n60x60 black rect with black outline in center of canvas.\n60x60 light green rect with black outline in center of canvas.\n60x60 soft green rect with black outline in center of canvas.\n60x60 red rect with black outline in center of canvas.\n60x60 dark fuchsia rect with black outline in center of canvas.\n60x60 blue rect with black outline in center of canvas.",class:"p5",module:"Color",submodule:"Setting",overloads:[{line:341,params:[{name:"v1",description:"<p>red or hue value relative to\n                                the current color range</p>\n",type:"Number"},{name:"v2",description:"<p>
21green or saturation value\n                                relative to the current color range</p>\n",type:"Number"},{name:"v3",description:"<p>blue or brightness value\n                                relative to the current color range</p>\n",type:"Number"},{name:"alpha",description:"",type:"Number",optional:!0}],chainable:1},{line:466,params:[{name:"value",description:"<p>a color string</p>\n",type:"String"}],chainable:1},{line:472,params:[{name:"gray",description:"<p>a gray value</p>\n",type:"Number"},{name:"alpha",description:"",type:"Number",optional:!0}],chainable:1},{line:479,params:[{name:"values",description:"<p>an array containing the red,green,blue &amp;\n                                and alpha components of the color</p>\n",type:"Number[]"}],chainable:1},{line:486,params:[{name:"color",description:"<p>the fill color</p>\n",type:"p5.Color"}],chainable:1}]},{file:"src/color/setting.js",line:498,description:'<p>Disables filling geometry. If both <a href="#/p5/noStroke">noStroke()</a> and <a href="#/p5/noFill">noFill()</a> are called,\nnothing will be drawn to the screen.</p>\n',itemtype:"method",name:"noFill",chainable:1,example:["\n<div>\n<code>\nrect(15, 10, 55, 55);\nnoFill();\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div modernizr='webgl'>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n  background(0);\n  noFill();\n  stroke(100, 100, 240);\n  rotateX(frameCount * 0.01);\n  rotateY(frameCount * 0.01);\n  box(45, 45, 45);\n}\n</code>\n</div>"],alt:"white rect top middle and noFill rect center. Both 60x60 with black outlines.\nblack canvas with purple cube wireframe spinning",class:"p5",module:"Color",submodule:"Setting"},{file:"src/color/setting.js",line:539,description:'<p>Disables drawing the stroke (outline). If both <a href="#/p5/noStroke">noStroke()</a> and <a href="#/p5/noFill">noFill()</a>\nare called, nothing will be drawn to the screen.</p>\n',itemtype:"method",name:"noStroke",chainable:1,example:["\n<div>\n<code>\nnoStroke();\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div modernizr='webgl'>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n  background(0);\n  noStroke();\n  fill(240, 150, 150);\n  rotateX(frameCount * 0.01);\n  rotateY(frameCount * 0.01);\n  box(45, 45, 45);\n}\n</code>\n</div>"],alt:"60x60 white rect at center. no outline.\nblack canvas with pink cube spinning",class:"p5",module:"Color",submodule:"Setting"},{file:"src/color/setting.js",line:579,description:'<p>Sets the color used to draw lines and borders around shapes. This color\nis either specified in terms of the RGB or HSB color depending on the\ncurrent <a href="#/p5/colorMode">colorMode()</a> (the default color space is RGB, with each value in\nthe range from 0 to 255). The alpha range by default is also 0 to 255.\n<br><br>\nIf a single string argument is provided, RGB, RGBA and Hex CSS color\nstrings and all named color strings are supported. In this case, an alpha\nnumber value as a second argument is not supported, the RGBA form should be\nused.\n<br><br>\nA p5 <a href="#/p5.Color">Color</a> object can also be provided to set the stroke color.</p>\n',itemtype:"method",name:"stroke",chainable:1,example:["\n<div>\n<code>\n// Grayscale integer value\nstrokeWeight(4);\nstroke(51);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// R, G & B integer values\nstroke(255, 204, 0);\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// H, S & B integer values\ncolorMode(HSB);\nstrokeWeight(4);\nstroke(255, 204, 100);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// Named SVG/CSS color string\nstroke('red');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// three-digit hexadecimal RGB notation\nstroke('#fae');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// six-digit hexadecimal RGB notation\nstroke('#222222');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// integer RGB notation\nstroke('rgb(0,255,0)');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// integer RGBA notation\nstroke('rgba(0,255,0,0.25)');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// percentage RGB notation\nstroke('rgb(100%,0%,10%)');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>\n// percentage RGBA notation\nstroke('rgba(100%,0%,100%,0.5)');\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>\n\n<div>\n<code>
21\n// p5 Color object\nstroke(color(0, 0, 255));\nstrokeWeight(4);\nrect(20, 20, 60, 60);\n</code>\n</div>"],alt:"60x60 white rect at center. Dark charcoal grey outline.\n60x60 white rect at center. Yellow outline.\n60x60 white rect at center. Royal blue outline.\n60x60 white rect at center. Red outline.\n60x60 white rect at center. Pink outline.\n60x60 white rect at center. Black outline.\n60x60 white rect at center. Bright green outline.\n60x60 white rect at center. Soft green outline.\n60x60 white rect at center. Red outline.\n60x60 white rect at center. Dark fuchsia outline.\n60x60 white rect at center. Blue outline.",class:"p5",module:"Color",submodule:"Setting",overloads:[{line:579,params:[{name:"v1",description:"<p>red or hue value relative to\n                                the current color range</p>\n",type:"Number"},{name:"v2",description:"<p>green or saturation value\n                                relative to the current color range</p>\n",type:"Number"},{name:"v3",description:"<p>blue or brightness value\n                                relative to the current color range</p>\n",type:"Number"},{name:"alpha",description:"",type:"Number",optional:!0}],chainable:1},{line:718,params:[{name:"value",description:"<p>a color string</p>\n",type:"String"}],chainable:1},{line:724,params:[{name:"gray",description:"<p>a gray value</p>\n",type:"Number"},{name:"alpha",description:"",type:"Number",optional:!0}],chainable:1},{line:731,params:[{name:"values",description:"<p>an array containing the red,green,blue &amp;\n                                and alpha components of the color</p>\n",type:"Number[]"}],chainable:1},{line:738,params:[{name:"color",description:"<p>the stroke color</p>\n",type:"p5.Color"}],chainable:1}]},{file:"src/core/shape/2d_primitives.js",line:16,description:"<p>This function does 3 things:</p>\n<ol>\n<li><p>Bounds the desired start/stop angles for an arc (in radians) so that:</p>\n<pre><code>0 &lt;= start &lt; TWO_PI ;    start &lt;= stop &lt; start + TWO_PI\n</code></pre><p>This means that the arc rendering functions don&#39;t have to be concerned\nwith what happens if stop is smaller than start, or if the arc &#39;goes\nround more than once&#39;, etc.: they can just start at start and increase\nuntil stop and the correct arc will be drawn.</p>\n</li>\n<li><p>Optionally adjusts the angles within each quadrant to counter the naive\nscaling of the underlying ellipse up from the unit circle.  Without\nthis, the angles become arbitrary when width != height: 45 degrees\nmight be drawn at 5 degrees on a &#39;wide&#39; ellipse, or at 85 degrees on\na &#39;tall&#39; ellipse.</p>\n</li>\n<li><p>Flags up when start and stop correspond to the same place on the\nunderlying ellipse.  This is useful if you want to do something special\nthere (like rendering a whole ellipse instead).</p>\n</li>\n</ol>\n",class:"p5",module:"Shape",submodule:"2D Primitives"},{file:"src/core/shape/2d_primitives.js",line:102,description:'<p>Draw an arc to the screen. If called with only x, y, w, h, start, and\nstop, the arc will be drawn and filled as an open pie segment. If a mode parameter is provided, the arc\nwill be filled like an open semi-circle (OPEN) , a closed semi-circle (CHORD), or as a closed pie segment (PIE). The\norigin may be changed with the <a href="#/p5/ellipseMode">ellipseMode()</a> function.<br><br>\nThe arc is always drawn clockwise from wherever start falls to wherever stop falls on the ellipse.\nAdding or subtracting TWO_PI to either angle does not change where they fall.\nIf both start and stop fall at the same place, a full ellipse will be drawn. Be aware that the the\ny-axis increases in the downward direction therefore the values of PI is counter clockwise.</p>\n',itemtype:"method",name:"arc",params:[{name:"x",description:"<p>x-coordinate of the arc&#39;s ellipse</p>\n",type:"Number"},{name:"y",description:"<p>y-coordinate of the arc&#39;s ellipse</p>\n",type:"Number"},{name:"w",description:"<p>width of the arc&#39;s ellipse by default</p>\n",type:"Number"},{name:"h",description:"<p>height of the arc&#39;s ellipse by default</p>\n",type:"Number"},{name:"start",description:"<p>angle to start the arc, specified in radians</p>\n",type:"Number"},{name:"stop",description:"<p>angle to stop the arc, specified in radians</p>\n",type:"Number"},{name:"mode",description:"<p>optional parameter to determine the way of drawing\n                        the arc. either CHORD, PIE or OPEN</p>\n",type:"Constant",optional:!0},{name:"detail",description:"<p>optional parameter for WebGL mode only. This is to\n                        specify the number of vertices that makes up the\n                        perimeter of the arc. Default value is 25.</p>\n",type:"Number",optional:!0}],chainable:1,example:["\n<div>\n<code>\narc(50, 55, 50, 50, 0, HALF_PI);\nnoFill();\narc(50, 55, 60, 60, HALF_PI, PI);\narc(50, 55, 70, 70, PI, PI + QUARTER_PI);\narc(50, 55, 80, 80, PI + QUARTER_PI, TWO_PI);\n</code>\n</div>\n\n<div>\n<code>\narc(50, 50, 80, 80, 0, PI + QUARTER_PI);\n</code>\n</div>\n\n<div>\n<code>\narc(50, 50, 80, 80, 0, PI + QUARTER_PI, OPEN);\n</code>\n</div>\n\n<div>\n<code>\narc(50, 50, 80, 80, 0, PI + QUARTER_PI, CHORD);\n</code>\n</div>\n\n<div>\n<code>\narc(50, 50, 80, 80, 0, PI + QUARTER_PI, PIE);\n</code>\n</div>"],alt:"shattered outline of an ellipse with a quarter of a white circle bottom-right.\nwhite ellipse with top right quarter missing.\nwhite ellipse with black outline with top right missing.\nwhite ellipse with top right missing with black outline around shape.\nwhite ellipse with top right quarter missing with black outline around the shape.",class:"p5",module:"Shape",submodule:"2D Primitives"},{file:"src/core/shape/2d_primitives.js",line:210,description:'<p>Draws an ellipse (oval) to the screen. An ellipse with equal width and\nheight is a circle. By default, the first two parameters set the location,\nand the third and fourth parameters set the shape&#39;
21s width and height. If\nno height is specified, the value of width is used for both the width and\nheight. If a negative height or width is specified, the absolute value is taken.\nThe origin may be changed with the <a href="#/p5/ellipseMode">ellipseMode()</a> function.</p>\n',itemtype:"method",name:"ellipse",chainable:1,example:["\n<div>\n<code>\nellipse(56, 46, 55, 55);\n</code>\n</div>"],alt:"white ellipse with black outline in middle-right of canvas that is 55x55.",class:"p5",module:"Shape",submodule:"2D Primitives",overloads:[{line:210,params:[{name:"x",description:"<p>x-coordinate of the ellipse.</p>\n",type:"Number"},{name:"y",description:"<p>y-coordinate of the ellipse.</p>\n",type:"Number"},{name:"w",description:"<p>width of the ellipse.</p>\n",type:"Number"},{name:"h",description:"<p>height of the ellipse.</p>\n",type:"Number",optional:!0}],chainable:1},{line:235,params:[{name:"x",description:"",type:"Number"},{name:"y",description:"",type:"Number"},{name:"w",description:"",type:"Number"},{name:"h",description:"",type:"Number"},{name:"detail",description:"<p>number of radial sectors to draw (for WebGL mode)</p>\n",type:"Integer"}]}]},{file:"src/core/shape/2d_primitives.js",line:270,description:"<p>Draws a circle to the screen. A circle is a simple closed shape.\nIt is the set of all points in a plane that are at a given distance from a given point, the centre.\nThis function is a special case of the ellipse() function, where the width and height of the ellipse are the same.\nHeight and width of the ellipse correspond to the diameter of the circle.\nBy default, the first two parameters set the location of the centre of the circle, the third sets the diameter of the circle.</p>\n",itemtype:"method",name:"circle",params:[{name:"x",description:"<p>x-coordinate of the centre of the circle.</p>\n",type:"Number"},{name:"y",description:"<p>y-coordinate of the centre of the circle.</p>\n",type:"Number"},{name:"d",description:"<p>diameter of the circle.</p>\n",type:"Number"}],chainable:1,example:["\n<div>\n<code>\n// Draw a circle at location (30, 30) with a diameter of 20.\ncircle(30, 30, 20);\n</code>\n</div>"],alt:"white circle with black outline in mid of canvas that is 55x55.",class:"p5",module:"Shape",submodule:"2D Primitives"},{file:"src/core/shape/2d_primitives.js",line:300,description:'<p>Draws a line (a direct path between two points) to the screen. The version\nof <a href="#/p5/line">line()</a> with four parameters draws the line in 2D. To color a line, use\nthe <a href="#/p5/stroke">stroke()</a> function. A line cannot be filled, therefore the <a href="#/p5/fill">fill()</a>\nfunction will not affect the color of a line. 2D lines are drawn with a\nwidth of one pixel by default, but this can be changed with the\n<a href="#/p5/strokeWeight">
21strokeWeight()</a> function.</p>\n',itemtype:"method",name:"line",chainable:1,example:["\n<div>\n<code>\nline(30, 20, 85, 75);\n</code>\n</div>\n\n<div>\n<code>\nline(30, 20, 85, 20);\nstroke(126);\nline(85, 20, 85, 75);\nstroke(255);\nline(85, 75, 30, 75);\n</code>\n</div>"],alt:"line 78 pixels long running from mid-top to bottom-right of canvas.\n3 lines of various stroke sizes. Form top, bottom and right sides of a square.",class:"p5",module:"Shape",submodule:"2D Primitives",overloads:[{line:300,params:[{name:"x1",description:"<p>the x-coordinate of the first point</p>\n",type:"Number"},{name:"y1",description:"<p>the y-coordinate of the first point</p>\n",type:"Number"},{name:"x2",description:"<p>the x-coordinate of the second point</p>\n",type:"Number"},{name:"y2",description:"<p>the y-coordinate of the second point</p>\n",type:"Number"}],chainable:1},{line:336,params:[{name:"x1",description:"",type:"Number"},{name:"y1",description:"",type:"Number"},{name:"z1",description:"<p>the z-coordinate of the first point</p>\n",type:"Number"},{name:"x2",description:"",type:"Number"},{name:"y2",description:"",type:"Number"},{name:"z2",description:"<p>the z-coordinate of the second point</p>\n",type:"Number"}],chainable:1}]},{file:"src/core/shape/2d_primitives.js",line:356,description:"<p>Draws a point, a coordinate in space at the dimension of one pixel.\nThe first parameter is the horizontal value for the point, the second\nvalue is the vertical value for the point. The color of the point is\ndetermined by the current stroke.</p>\n",itemtype:"method",name:"point",params:[{name:"x",description:"<p>the x-coordinate</p>\n",type:"Number"},{name:"y",description:"<p>the y-coordinate</p>\n",type:"Number"},{name:"z",description:"<p>the z-coordinate (for WebGL mode)</p>\n",type:"Number",optional:!0}],chainable:1,example:["\n<div>\n<code>\npoint(30, 20);\npoint(85, 20);\npoint(85, 75);\npoint(30, 75);\n</code>\n</div>"],alt:"4 points centered in the middle-right of the canvas.",class:"p5",module:"Shape",submodule:"2D Primitives"},{file:"src/core/shape/2d_primitives.js",line:391,description:"<p>Draw a quad. A quad is a quadrilateral, a four sided polygon. It is\nsimilar to a rectangle, but the angles between its edges are not\nconstrained to ninety degrees. The first pair of parameters (x1,y1)\nsets the first vertex and the subsequent pairs should proceed\nclockwise or counter-clockwise around the defined shape.\nz-arguments only work when quad() is used in WEBGL mode.</p>\n",itemtype:"method",name:"quad",chainable:1,example:["\n<div>\n<code>\nquad(38, 31, 86, 20, 69, 63, 30, 76);\n</code>\n</div>"],alt:"irregular white quadrilateral shape with black outline mid-right of canvas.",class:"p5",module:"Shape",submodule:"2D Primitives",overloads:[{line:391,params:[{name:"x1",description:"<p>the x-coordinate of the first point</p>\n",type:"Number"},{name:"y1",description:"<p>the y-coordinate of the first point</p>\n",type:"Number"},{name:"x2",description:"<p>the x-coordinate of the second point</p>\n",type:"Number"},{name:"y2",description:"<p>the y-coordinate of the second point</p>\n",type:"Number"},{name:"x3",description:"<p>the x-coordinate of the third point</p>\n",type:"Number"},{name:"y3",description:"<p>the y-coordinate of the third point</p>\n",type:"Number"},{name:"x4",description:"<p>the x-coordinate of the fourth point</p>\n",type:"Number"},{name:"y4",description:"<p>the y-coordinate of the fourth point</p>\n",type:"Number"}],chainable:1},{line:421,params:[{name:"x1",description:"",type:"Number"},{name:"y1",description:"",type:"Number"},{name:"z1",description:"<p>the z-coordinate of the first point</p>\n",type:"Number"},{name:"x2",description:"",type:"Number"},{name:"y2",description:"",type:"Number"},{name:"z2",description:"<p>the z-coordinate of the second point</p>\n",type:"Number"},{name:"x3",description:"",type:"Number"},{name:"y3",description:"",type:"Number"},{name:"z3",description:"<p>the z-coordinate of the third point</p>\n",type:"Number"},{name:"x4",description:"",type:"Number"},{name:"y4",description:"",type:"Number"},{name:"z4",description:"<p>the z-coordinate of the fourth point</p>\n",type:"Number"}],chainable:1}]},{file:"src/core/shape/2d_primitives.js",line:458,description:'<p>Draws a rectangle to the screen. A rectangle is a four-sided shape with\nevery angle at ninety degrees. By default, the first two parameters set\nthe location of the upper-left corner, the third sets the width, and the\nfourth sets the height. The way these parameters are interpreted, however,\nmay be changed with the <a href="#/p5/rectMode">rectMode()</a> function.\n<br><br>\nThe fifth, sixth, seventh and eighth parameters, if specified,\ndetermine corner radius for the top-left, top-right, lower-right and\nlower-left corners, respectively. An omitted corner radius parameter is set\nto the value of the previously specified radius value in the parameter list.</p>\n',itemtype:"method",name:"rect",chainable:1,example:["\n<div>\n<code>\n// Draw a rectangle at location (30, 20) with a width and height of 55.\nrect(30, 20, 55, 55);\n</code>\n</div>\n\n<div>\n<code>\n// Draw a rectangle with rounded corners, each having a radius of 20.\nrect(30, 20, 55, 55, 20);\n</code>\n</div>\n\n<div>\n<code>\n// Draw a rectangle with rounded corners having the following radii:\n// top-left = 20, top-right = 15, bottom-right = 10, bottom-left = 5.\nrect(30, 20, 55, 55, 20, 15, 10, 5);\n</code>\n</div>"],alt:"55x55 white rect with black outline in mid-right of canvas.\n55x55 white rect with black outline and rounded edges in mid-right of canvas.\n55x55 white rect with black outline and rounded edges of different radii.",class:"p5",module:"Shape",submodule:"2D Primitives",overloads:[{line:458,params:[{name:"x",description:"<p>x-coordinate of the rectangle.</p>\n",type:"Number"},{name:"y",description:"<p>y-coordinate of the rectangle.</p>\n",type:"Number"},{name:"w",description:"<p>width of the rectangle.</p>\n",type:"Number"}
21,{name:"h",description:"<p>height of the rectangle.</p>\n",type:"Number"},{name:"tl",description:"<p>optional radius of top-left corner.</p>\n",type:"Number",optional:!0},{name:"tr",description:"<p>optional radius of top-right corner.</p>\n",type:"Number",optional:!0},{name:"br",description:"<p>optional radius of bottom-right corner.</p>\n",type:"Number",optional:!0},{name:"bl",description:"<p>optional radius of bottom-left corner.</p>\n",type:"Number",optional:!0}],chainable:1},{line:508,params:[{name:"x",description:"",type:"Number"},{name:"y",description:"",type:"Number"},{name:"w",description:"",type:"Number"},{name:"h",description:"",type:"Number"},{name:"detailX",description:"<p>number of segments in the x-direction (for WebGL mode)</p>\n",type:"Integer",optional:!0},{name:"detailY",description:"<p>number of segments in the y-direction (for WebGL mode)</p>\n",type:"Integer",optional:!0}],chainable:1}]},{file:"src/core/shape/2d_primitives.js",line:541,description:'<p>Draws a square to the screen. A square is a four-sided shape with\nevery angle at ninety degrees, and equal side size.\nThis function is a special case of the rect() function, where the width and height are the same, and the parameter is called &quot;s&quot; for side size.\nBy default, the first two parameters set the location of the upper-left corner, the third sets the side size of the square.\nThe way these parameters are interpreted, however,\nmay be changed with the <a href="#/p5/rectMode">rectMode()</a> function.\n<br><br>\nThe fourth, fifth, sixth and seventh parameters, if specified,\ndetermine corner radius for the top-left, top-right, lower-right and\nlower-left corners, respectively. An omitted corner radius parameter is set\nto the value of the previously specified radius value in the parameter list.</p>\n',itemtype:"method",name:"square",params:[{name:"x",description:"<p>x-coordinate of the square.</p>\n",type:"Number"},{name:"y",description:"<p>y-coordinate of the square.</p>\n",type:"Number"},{name:"s",description:"<p>side size of the square.</p>\n",type:"Number"},{name:"tl",description:"<p>optional radius of top-left corner.</p>\n",type:"Number",optional:!0},{name:"tr",description:"<p>optional radius of top-right corner.</p>\n",type:"Number",optional:!0},{name:"br",description:"<p>optional radius of bottom-right corner.</p>\n",type:"Number",optional:!0},{name:"bl",description:"<p>optional radius of bottom-left corner.</p>\n",type:"Number",optional:!0}],chainable:1,example:["\n<div>\n<code>\n// Draw a square at location (30, 20) with a side size of 55.\nsquare(30, 20, 55);\n</code>\n</div>\n\n<div>\n<code>\n// Draw a square with rounded corners, each having a radius of 20.\nsquare(30, 20, 55, 20);\n</code>\n</div>\n\n<div>\n<code>\n// Draw a square with rounded corners having the following radii:\n// top-left = 20, top-right = 15, bottom-right = 10, bottom-left = 5.\nsquare(30, 20, 55, 20, 15, 10, 5);\n</code>\n</div>"],alt:"55x55 white square with black outline in mid-right of canvas.\n55x55 white square with black outline and rounded edges in mid-right of canvas.\n55x55 white square with black outline and rounded edges of different radii.",class:"p5",module:"Shape",submodule:"2D Primitives"},{file:"src/core/shape/2d_primitives.js",line:595,description:"<p>A triangle is a plane created by connecting three points. The first two\narguments specify the first point, the middle two arguments specify the\nsecond point, and the last two arguments specify the third point.</p>\n",itemtype:"method",name:"triangle",params:[{name:"x1",description:"<p>x-coordinate of the first point</p>\n",type:"Number"},{name:"y1",description:"<p>y-coordinate of the first point</p>\n",type:"Number"},{name:"x2",description:"<p>x-coordinate of the second point</p>\n",type:"Number"},{name:"y2",description:"<p>y-coordinate of the second point</p>\n",type:"Number"},{name:"x3",description:"<p>x-coordinate of the third point</p>\n",type:"Number"},{name:"y3",description:"<p>y-coordinate of the third point</p>\n",type:"Number"}],chainable:1,example:["\n<div>\n<code>\ntriangle(30, 75, 58, 20, 86, 75);\n</code>\n</div>"],alt:"white triangle with black outline in mid-right of canvas.",class:"p5",module:"Shape",submodule:"2D Primitives"},{file:"src/core/shape/attributes.js",line:14,description:'<p>Modifies the location from which ellipses are drawn by changing the way\nin which parameters given to <a href="#/p5/ellipse">ellipse()</a> are interpreted.\n<br><br>\nThe default mode is ellipseMode(CENTER), which interprets the first two\nparameters of <a href="#/p5/ellipse">ellipse()</a> as the shape&#39;s center point, while the third and\nfourth parameters are its width and height.\n<br><br>\nellipseMode(RADIUS) also uses the first two parameters of <a href="#/p5/ellipse">ellipse()</a> as\nthe shape&#39;s center point, but uses the third and fourth parameters to\nspecify half of the shapes&#39;s width and height.\n<br><br>\nellipseMode(CORNER) interprets the first two parameters of <a href="#/p5/ellipse">ellipse()</a> as\nthe upper-left corner of the shape, while the third and fourth parameters\nare its width and height.\n<br><br>\nellipseMode(CORNERS) interprets the first two parameters of <a href="#/p5/ellipse">ellipse()</a> as\nthe location of one corner of the ellipse&#39;s bounding box, and the third\nand fourth parameters as the location of the opposite corner.\n<br><br>\nThe parameter must be written in ALL CAPS because Javascript is a\ncase-sensitive language.</p>\n',itemtype:"method",name:"ellipseMode",params:[{name:"mode",description:"<p>either CENTER, RADIUS, CORNER, or CORNERS</p>\n",type:"Constant"}],chainable:1,example:["\n<div>\n<code>\nellipseMode(RADIUS); // Set ellipseMode to RADIUS\nfill(255); // Set fill to white\nellipse(50, 50, 30, 30); // Draw white ellipse using RADIUS mode\n\nellipseMode(CENTER); // Set ellipseMode to CENTER\nfill(100); // Set fill to gray\nellipse(50, 50, 30, 30); // Draw gray ellipse using CENTER mode\n</code>\n</div>\n\n<div>\n<code>\nellipseMode(CORNER); // Set ellipseMode is CORNER\nfill(255); // Set fill to white\nellipse(25, 25, 50, 50); // Draw white ellipse using CORNER mode\n\nellipseMode(CORNERS); // Set ellipseMode to CORNERS\nfill(100); // Set fill to gray\nellipse(25, 25, 50, 50); // Draw gray ellipse using CORNERS mode\n</code>\n</div>"],alt:"60x60 white ellipse and 30x30 grey ellipse with black outlines at center.\n60x60 white ellipse @center and 30x30 grey ellipse top-right, black outlines.",class:"p5",module:"Shape",submodule:"Attributes"},{file:"src/core/shape/attributes.js",line:83,description:'<p>Draws all geometry with jagged (aliased) edges. Note that <a href="#/p5/smooth">smooth()</a> is\nactive by default in 2D mode, so it is necessary to call <a href="#/p5/noSmooth">noSmooth()</a> to disable\nsmoothing of geometry, images, and fonts. In 3D mode, <a href="#/p5/noSmooth">noSmooth()</a> is enabled\nby default, so it is necessary to call <a href="#/p5/smooth">smooth()</a> if you would like\nsmooth (antialiased) edges on your geometry.</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/shape/attributes.js",line:116,description:'<p>Modifies the location from which rectangles are drawn by changing the way\nin which parameters given to <a href="#/p5/rect">rect()</a> are interpreted.\n<br><br>\nThe default mode is rectMode(CORNER), which interprets the first two\nparameters of <a href="#/p5/rect">rect()</a> 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 <a href="#/p5/rect">rect()</a> 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 <a href="#/p5/rect">rect()</a> as the\nshape&#39;s center point, while the third and fourth parameters are its\nwidth and height.\n<br><br>\nrectMode(RADIUS) also uses the first two parameters of <a href="#/p5/rect">rect()</a> as the\nshape&#39;
21s center point, but uses the third and fourth parameters to specify\nhalf of the shapes&#39;s width and height.\n<br><br>\nThe parameter must be written in ALL CAPS because Javascript is a\ncase-sensitive language.</p>\n',itemtype:"method",name:"rectMode",params:[{name:"mode",description:"<p>either CORNER, CORNERS, CENTER, or RADIUS</p>\n",type:"Constant"}],chainable:1,example:["\n<div>\n<code>\nrectMode(CORNER); // Default rectMode is CORNER\nfill(255); // Set fill to white\nrect(25, 25, 50, 50); // Draw white rect using CORNER mode\n\nrectMode(CORNERS); // Set rectMode to CORNERS\nfill(100); // Set fill to gray\nrect(25, 25, 50, 50); // Draw gray rect using CORNERS mode\n</code>\n</div>\n\n<div>\n<code>\nrectMode(RADIUS); // Set rectMode to RADIUS\nfill(255); // Set fill to white\nrect(50, 50, 30, 30); // Draw white rect using RADIUS mode\n\nrectMode(CENTER); // Set rectMode to CENTER\nfill(100); // Set fill to gray\nrect(50, 50, 30, 30); // Draw gray rect using CENTER mode\n</code>\n</div>"],alt:"50x50 white rect at center and 25x25 grey rect in the top left of the other.\n50x50 white rect at center and 25x25 grey rect in the center of the other.",class:"p5",module:"Shape",submodule:"Attributes"},{file:"src/core/shape/attributes.js",line:185,description:'<p>Draws all geometry with smooth (anti-aliased) edges. <a href="#/p5/smooth">smooth()</a> will also\nimprove image quality of resized images. Note that <a href="#/p5/smooth">smooth()</a> is active by\ndefault in 2D mode; <a href="#/p5/noSmooth">noSmooth()</a> can be used to disable smoothing of geometry,\nimages, and fonts. In 3D mode, <a href="#/p5/noSmooth">noSmooth()</a> is enabled\nby default, so it is necessary to call <a href="#/p5/smooth">smooth()</a> if you would like\nsmooth (antialiased) edges on your geometry.</p>\n',itemtype:"method",name:"smooth",chainable:1,example:["\n<div>\n<code>\nbackground(0);\nnoStroke();\nsmooth();\nellipse(30, 48, 36, 36);\nnoSmooth();\nellipse(70, 48, 36, 36);\n</code>\n</div>"],alt:"2 pixelated 36x36 white ellipses one left one right of center. On black.",class:"p5",module:"Shape",submodule:"Attributes"},{file:"src/core/shape/attributes.js",line:219,description:"<p>Sets the style for rendering line endings. These ends are either squared,\nextended, or rounded, each of which specified with the corresponding\nparameters: SQUARE, PROJECT, and ROUND. The default cap is ROUND.</p>\n",itemtype:"method",name:"strokeCap",params:[{name:"cap",description:"<p>either SQUARE, PROJECT, or ROUND</p>\n",type:"Constant"}],chainable:1,example:["\n<div>\n<code>\nstrokeWeight(12.0);\nstrokeCap(ROUND);\nline(20, 30, 80, 30);\nstrokeCap(SQUARE);\nline(20, 50, 80, 50);\nstrokeCap(PROJECT);\nline(20, 70, 80, 70);\n</code>\n</div>"],alt:"3 lines. Top line: rounded ends, mid: squared, bottom:longer squared ends.",class:"p5",module:"Shape",submodule:"Attributes"},{file:"src/core/shape/attributes.js",line:256,description:"<p>Sets the style of the joints which connect line segments. These joints\nare either mitered, beveled, or rounded and specified with the\ncorresponding parameters MITER, BEVEL, and ROUND. The default joint is\nMITER.</p>\n",itemtype:"method",name:"strokeJoin",params:[{name:"join",description:"<p>either MITER, BEVEL, ROUND</p>\n",type:"Constant"}],chainable:1,example:["\n<div>\n<code>\nnoFill();\nstrokeWeight(10.0);\nstrokeJoin(MITER);\nbeginShape();\nvertex(35, 20);\nvertex(65, 50);\nvertex(35, 80);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nnoFill();\nstrokeWeight(10.0);\nstrokeJoin(BEVEL);\nbeginShape();\nvertex(35, 20);\nvertex(65, 50);\nvertex(35, 80);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nnoFill();\nstrokeWeight(10.0);\nstrokeJoin(ROUND);\nbeginShape();\nvertex(35, 20);\nvertex(65, 50);\nvertex(35, 80);\nendShape();\n</code>\n</div>"],alt:"Right-facing arrowhead shape with pointed tip in center of canvas.\nRight-facing arrowhead shape with flat tip in center of canvas.\nRight-facing arrowhead shape with rounded tip in center of canvas.",class:"p5",module:"Shape",submodule:"Attributes"},{file:"src/core/shape/attributes.js",line:323,description:"<p>Sets the width of the stroke used for lines, points, and the border\naround shapes. All widths are set in units of pixels.</p>\n",itemtype:"method",name:"strokeWeight",params:[{name:"weight",description:"<p>the weight (in pixels) of the stroke</p>\n",type:"Number"}],chainable:1,example:["\n<div>\n<code>\nstrokeWeight(1); // Default\nline(20, 20, 80, 20);\nstrokeWeight(4); // Thicker\nline(20, 40, 80, 40);\nstrokeWeight(10); // Beastly\nline(20, 70, 80, 70);\n</code>\n</div>"],alt:"3 horizontal black lines. Top line: thin, mid: medium, bottom:thick.",class:"p5",module:"Shape",submodule:"Attributes"},{file:"src/core/shape/curves.js",line:13,description:'<p>Draws a cubic Bezier curve on the screen. These curves are defined by a\nseries of anchor and control points. The first two parameters specify\nthe first anchor point and the last two parameters specify the other\nanchor point, which become the first and last points on the curve. The\nmiddle parameters specify the two control points which define the shape\nof the curve. Approximately speaking, control points &quot;pull&quot;
21 the curve\ntowards them.<br /><br />Bezier curves were developed by French\nautomotive engineer Pierre Bezier, and are commonly used in computer\ngraphics to define gently sloping curves. See also <a href="#/p5/curve">curve()</a>.</p>\n',itemtype:"method",name:"bezier",chainable:1,example:["\n<div>\n<code>\nnoFill();\nstroke(255, 102, 0);\nline(85, 20, 10, 10);\nline(90, 90, 15, 80);\nstroke(0, 0, 0);\nbezier(85, 20, 10, 10, 90, 90, 15, 80);\n</code>\n</div>\n\n<div>\n<code>\nbackground(0, 0, 0);\nnoFill();\nstroke(255);\nbezier(250, 250, 0, 100, 100, 0, 100, 0, 0, 0, 100, 0);\n</code>\n</div>"],alt:"stretched black s-shape in center with orange lines extending from end points.\nstretched black s-shape with 10 5x5 white ellipses along the shape.\nstretched black s-shape with 7 5x5 ellipses and orange lines along the shape.\nstretched black s-shape with 17 small orange lines extending from under shape.\nhorseshoe shape with orange ends facing left and black curved center.\nhorseshoe shape with orange ends facing left and black curved center.\nLine shaped like right-facing arrow,points move with mouse-x and warp shape.\nhorizontal line that hooks downward on the right and 13 5x5 ellipses along it.\nright curving line mid-right of canvas with 7 short lines radiating from it.",class:"p5",module:"Shape",submodule:"Curves",overloads:[{line:13,params:[{name:"x1",description:"<p>x-coordinate for the first anchor point</p>\n",type:"Number"},{name:"y1",description:"<p>y-coordinate for the first anchor point</p>\n",type:"Number"},{name:"x2",description:"<p>x-coordinate for the first control point</p>\n",type:"Number"},{name:"y2",description:"<p>y-coordinate for the first control point</p>\n",type:"Number"},{name:"x3",description:"<p>x-coordinate for the second control point</p>\n",type:"Number"},{name:"y3",description:"<p>y-coordinate for the second control point</p>\n",type:"Number"},{name:"x4",description:"<p>x-coordinate for the second anchor point</p>\n",type:"Number"},{name:"y4",description:"<p>y-coordinate for the second anchor point</p>\n",type:"Number"}],chainable:1},{line:66,params:[{name:"x1",description:"",type:"Number"},{name:"y1",description:"",type:"Number"},{name:"z1",description:"<p>z-coordinate for the first anchor point</p>\n",type:"Number"},{name:"x2",description:"",type:"Number"},{name:"y2",description:"",type:"Number"},{name:"z2",description:"<p>z-coordinate for the first control point</p>\n",type:"Number"},{name:"x3",description:"",type:"Number"},{name:"y3",description:"",type:"Number"},{name:"z3",description:"<p>z-coordinate for the second control point</p>\n",type:"Number"},{name:"x4",description:"",type:"Number"},{name:"y4",description:"",type:"Number"},{name:"z4",description:"<p>z-coordinate for the second anchor point</p>\n",type:"Number"}],chainable:1}]},{file:"src/core/shape/curves.js",line:96,description:"<p>Sets the resolution at which Beziers display.</p>\n<p>The default value is 20.</p>\n<p>This function is only useful when using the WEBGL renderer\nas the default canvas renderer does not use this information.</p>\n",itemtype:"method",name:"bezierDetail",params:[{name:"detail",description:"<p>resolution of the curves</p>\n",type:"Number"}],chainable:1,example:["\n<div modernizr='webgl'>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  noFill();\n\n  bezierDetail(5);\n}\n\nfunction draw() {\n  background(200);\n\n  bezier(-40, -40, 0,\n          90, -40, 0,\n         -90,  40, 0,\n          40,  40, 0);\n}\n</code>\n</div>"],alt:"stretched black s-shape with a low level of bezier detail",class:"p5",module:"Shape",submodule:"Curves"},{file:"src/core/shape/curves.js",line:139,description:"<p>Evaluates the Bezier at position t for points a, b, c, d.\nThe parameters a and d are the first and last points\non the curve, and b and c are the control points.\nThe final parameter t varies between 0 and 1.\nThis can be done once with the x coordinates and a second time\nwith the y coordinates to get the location of a bezier curve at t.</p>\n",itemtype:"method",name:"bezierPoint",params:[{name:"a",description:"<p>coordinate of first point on the curve</p>\n",type:"Number"},{name:"b",description:"<p>coordinate of first control point</p>\n",type:"Number"},{name:"c",description:"<p>coordinate of second control point</p>\n",type:"Number"},{name:"d",description:"<p>coordinate of second point on the curve</p>\n",type:"Number"},{name:"t",description:"<p>value between 0 and 1</p>\n",type:"Number"}],return:{description:"the value of the Bezier at position t",type:"Number"},example:["\n<div>\n<code>\nnoFill();\nlet x1 = 85,\n x2 = 10,\n x3 = 90,\n x4 = 15;\nlet y1 = 20,\n y2 = 10,\n y3 = 90,\n y4 = 80;\nbezier(x1, y1, x2, y2, x3, y3, x4, y4);\nfill(255);\nlet steps = 10;\nfor (let i = 0; i <= steps;
21 i++) {\n  let t = i / steps;\n  let x = bezierPoint(x1, x2, x3, x4, t);\n  let y = bezierPoint(y1, y2, y3, y4, t);\n  ellipse(x, y, 5, 5);\n}\n</code>\n</div>"],alt:"stretched black s-shape with 17 small orange lines extending from under shape.",class:"p5",module:"Shape",submodule:"Curves"},{file:"src/core/shape/curves.js",line:194,description:"<p>Evaluates the tangent to the Bezier at position t for points a, b, c, d.\nThe parameters a and d are the first and last points\non the curve, and b and c are the control points.\nThe final parameter t varies between 0 and 1.</p>\n",itemtype:"method",name:"bezierTangent",params:[{name:"a",description:"<p>coordinate of first point on the curve</p>\n",type:"Number"},{name:"b",description:"<p>coordinate of first control point</p>\n",type:"Number"},{name:"c",description:"<p>coordinate of second control point</p>\n",type:"Number"},{name:"d",description:"<p>coordinate of second point on the curve</p>\n",type:"Number"},{name:"t",description:"<p>value between 0 and 1</p>\n",type:"Number"}],return:{description:"the tangent at position t",type:"Number"},example:["\n<div>\n<code>\nnoFill();\nbezier(85, 20, 10, 10, 90, 90, 15, 80);\nlet steps = 6;\nfill(255);\nfor (let i = 0; i <= steps; i++) {\n  let t = i / steps;\n  // Get the location of the point\n  let x = bezierPoint(85, 10, 90, 15, t);\n  let y = bezierPoint(20, 10, 90, 80, t);\n  // Get the tangent points\n  let tx = bezierTangent(85, 10, 90, 15, t);\n  let ty = bezierTangent(20, 10, 90, 80, t);\n  // Calculate an angle from the tangent points\n  let a = atan2(ty, tx);\n  a += PI;\n  stroke(255, 102, 0);\n  line(x, y, cos(a) * 30 + x, sin(a) * 30 + y);\n  // The following line of code makes a line\n  // inverse of the above line\n  //line(x, y, cos(a)*-30 + x, sin(a)*-30 + y);\n  stroke(0);\n  ellipse(x, y, 5, 5);\n}\n</code>\n</div>\n\n<div>\n<code>\nnoFill();\nbezier(85, 20, 10, 10, 90, 90, 15, 80);\nstroke(255, 102, 0);\nlet steps = 16;\nfor (let i = 0; i <= steps; i++) {\n  let t = i / steps;\n  let x = bezierPoint(85, 10, 90, 15, t);\n  let y = bezierPoint(20, 10, 90, 80, t);\n  let tx = bezierTangent(85, 10, 90, 15, t);\n  let ty = bezierTangent(20, 10, 90, 80, t);\n  let a = atan2(ty, tx);\n  a -= HALF_PI;\n  line(x, y, cos(a) * 8 + x, sin(a) * 8 + y);\n}\n</code>\n</div>"],alt:"s-shaped line with 17 short orange lines extending from underside of shape",class:"p5",module:"Shape",submodule:"Curves"},{file:"src/core/shape/curves.js",line:273,description:'<p>Draws a curved line on the screen between two points, given as the\nmiddle four parameters. The first two parameters are a control point, as\nif the curve came from this point even though it&#39;s not drawn. The last\ntwo parameters similarly describe the other control point. <br /><br />\nLonger curves can be created by putting a series of <a href="#/p5/curve">curve()</a> functions\ntogether or using <a href="#/p5/curveVertex">curveVertex()</a>. An additional function called\n<a href="#/p5/curveTightness">curveTightness()</a> provides control for the visual quality of the curve.\nThe <a href="#/p5/curve">curve()</a> function is an implementation of Catmull-Rom splines.</p>\n',itemtype:"method",name:"curve",chainable:1,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\nlet p1 = { x: 5, y: 26 },\n p2 = { x: 73, y: 24 };\nlet p3 = { x: 73, y: 61 },\n 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>\n<div>\n<code>\nnoFill();\nstroke(255, 102, 0);\ncurve(5, 26, 0, 5, 26, 0, 73, 24, 0, 73, 61, 0);\nstroke(0);\ncurve(5, 26, 0, 73, 24, 0, 73, 61, 0, 15, 65, 0);\nstroke(255, 102, 0);\ncurve(73, 24, 0, 73, 61, 0, 15, 65, 0, 15, 65, 0);\n</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.\ncurving black and orange lines.",class:"p5",module:"Shape",submodule:"Curves",overloads:[{line:273,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"}],chainable:1},{line:338,params:[{name:"x1",description:"",type:"Number"},{name:"y1",description:"",type:"Number"},{name:"z1",description:"<p>z-coordinate for the beginning control point</p>\n",type:"Number"},{name:"x2",description:"",type:"Number"},{name:"y2",description:"",type:"Number"},{name:"z2",description:"<p>z-coordinate for the first point</p>\n",type:"Number"},{name:"x3",description:"",type:"Number"},{name:"y3",description:"",type:"Number"},{name:"z3",description:"<p>z-coordinate for the second point</p>\n",type:"Number"},{name:"x4",description:"",type:"Number"},{name:"y4",description:"",type:"Number"},{name:"z4",description:"<p>z-coordinate for the ending control point</p>\n",type:"Number"}],chainable:1}]},{file:"src/core/shape/curves.js",line:364,description:"<p>Sets the resolution at which curves display.</p>\n<p>The default value is 20 while the minimum value is 3.</p>\n<p>This function is only useful when using the WEBGL renderer\nas the default canvas renderer does not use this\ninformation.</p>\n",itemtype:"method",name:"curveDetail",params:[{name:"resolution",description:"<p>resolution of the curves</p>\n",type:"Number"}],chainable:1,example:["\n<div modernizr='webgl'>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n\n  curveDetail(5);\n}\nfunction draw() {\n  background(200);\n\n  curve(250, 600, 0, -30, 40, 0, 30, 30, 0, -250, 600, 0);\n}\n</code>\n</div>"],alt:"white arch shape with a low level of curve detail.",class:"p5",module:"Shape",submodule:"Curves"},{file:"src/core/shape/curves.js",line:406,description:'<p>Modifies the quality of forms created with <a href="#/p5/curve">curve()</a> and <a href="#/p5/curveVertex">curveVertex()</a>.\nThe parameter tightness determines how the curve fits to the vertex\npoints. The value 0.0 is the default value for tightness (this value\
21ndefines 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>amount 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  let t = map(mouseX, 0, width, -5, 5);\n  curveTightness(t);\n  beginShape();\n  curveVertex(10, 26);\n  curveVertex(10, 26);\n  curveVertex(83, 24);\n  curveVertex(83, 61);\n  curveVertex(25, 65);\n  curveVertex(25, 65);\n  endShape();\n}\n</code>\n</div>"],alt:"Line shaped like right-facing arrow,points move with mouse-x and warp shape.",class:"p5",module:"Shape",submodule:"Curves"},{file:"src/core/shape/curves.js",line:453,description:"<p>Evaluates the curve at position t for points a, b, c, d.\nThe parameter t varies between 0 and 1, a and d are control points\nof the curve, and b and c are the start and end points of the curve.\nThis can be done once with the x coordinates and a second time\nwith the y coordinates to get the location of a curve at t.</p>\n",itemtype:"method",name:"curvePoint",params:[{name:"a",description:"<p>coordinate of first control point of the curve</p>\n",type:"Number"},{name:"b",description:"<p>coordinate of first point</p>\n",type:"Number"},{name:"c",description:"<p>coordinate of second point</p>\n",type:"Number"},{name:"d",description:"<p>coordinate of second control point</p>\n",type:"Number"},{name:"t",description:"<p>value between 0 and 1</p>\n",type:"Number"}],return:{description:"bezier value at position t",type:"Number"},example:["\n<div>\n<code>\nnoFill();\ncurve(5, 26, 5, 26, 73, 24, 73, 61);\ncurve(5, 26, 73, 24, 73, 61, 15, 65);\nfill(255);\nellipseMode(CENTER);\nlet steps = 6;\nfor (let i = 0; i <= steps; i++) {\n  let t = i / steps;\n  let x = curvePoint(5, 5, 73, 73, t);\n  let y = curvePoint(26, 26, 24, 61, t);\n  ellipse(x, y, 5, 5);\n  x = curvePoint(5, 73, 73, 15, t);\n  y = curvePoint(26, 24, 61, 65, t);\n  ellipse(x, y, 5, 5);\n}\n</code>\n</div>\n\nline hooking down to right-bottom with 13 5x5 white ellipse points"],class:"p5",module:"Shape",submodule:"Curves"},{file:"src/core/shape/curves.js",line:502,description:"<p>Evaluates the tangent to the curve at position t for points a, b, c, d.\nThe parameter t varies between 0 and 1, a and d are points on the curve,\nand b and c are the control points.</p>\n",itemtype:"method",name:"curveTangent",params:[{name:"a",description:"<p>coordinate of first point on the curve</p>\n",type:"Number"},{name:"b",description:"<p>coordinate of first control point</p>\n",type:"Number"},{name:"c",description:"<p>coordinate of second control point</p>\n",type:"Number"},{name:"d",description:"<p>coordinate of second point on the curve</p>\n",type:"Number"},{name:"t",description:"<p>value between 0 and 1</p>\n",type:"Number"}],return:{description:"the tangent at position t",type:"Number"},example:["\n<div>\n<code>\nnoFill();\ncurve(5, 26, 73, 24, 73, 61, 15, 65);\nlet steps = 6;\nfor (let i = 0; i <= steps; i++) {\n  let t = i / steps;\n  let x = curvePoint(5, 73, 73, 15, t);\n  let y = curvePoint(26, 24, 61, 65, t);\n  //ellipse(x, y, 5, 5);\n  let tx = curveTangent(5, 73, 73, 15, t);\n  let ty = curveTangent(26, 24, 61, 65, t);\n  let a = atan2(ty, tx);\n  a -= PI / 2.0;\n  line(x, y, cos(a) * 8 + x, sin(a) * 8 + y);\n}\n</code>\n</div>"],alt:"right curving line mid-right of canvas with 7 short lines radiating from it.",class:"p5",module:"Shape",submodule:"Curves"},{file:"src/core/shape/vertex.js",line:22,description:'<p>Use the <a href="#/p5/beginContour">beginContour()</a> and <a href="#/p5/endContour">endContour()</a> functions to create negative\nshapes within shapes such as the center of the letter &#39;O&#39;. <a href="#/p5/beginContour">beginContour()</a>\nbegins recording vertices for the shape and <a href="#/p5/endContour">endContour()</a> stops recording.\nThe vertices that define a negative shape must &quot;wind&quot; in the opposite\ndirection from the exterior shape. First draw vertices for the exterior\nclockwise order, then for internal shapes, draw vertices\nshape in counter-clockwise.\n<br><br>\nThese functions can only be used within a <a href="#/p5/beginShape">beginShape()</a>/<a href="#/p5/endShape">endShape()</a> pair and\ntransformations such as <a href="#/p5/translate">translate()</a>, <a href="#/p5/rotate">rotate()</a>, and <a href="#/p5/scale">scale()</a> do not work\nwithin a <a href="#/p5/beginContour">beginContour()</a>/<a href="#/p5/endContour">endContour()</a> pair. It is also not possible to use\nother shapes, such as <a href="#/p5/ellipse">ellipse()</a> or <a href="#/p5/rect">rect()</a> within.</p>\n',itemtype:"method",name:"beginContour",chainable:1,example:["\n<div>\n<code>\ntranslate(50, 50);\nstroke(255, 0, 0);\nbeginShape();\n// Exterior part of shape, clockwise winding\nvertex(-40, -40);\nvertex(40, -40);\nvertex(40, 40);\nvertex(-40, 40);\n// Interior part of shape, counter-clockwise winding\nbeginContour();\nvertex(-20, -20);\nvertex(-20, 20);\nvertex(20, 20);\nvertex(20, -20);\nendContour();\nendShape(CLOSE);\n</code>\n</div>"],alt:"white rect and smaller grey rect with red outlines in center of canvas.",class:"p5",module:"Shape",submodule:"Vertex"},{file:"src/core/shape/vertex.js",line:70,description:'<p>Using the <a href="#/p5/beginShape">beginShape()</a> and <a href="#/p5/endShape">endShape()</a> functions allow creating more\ncomplex forms. <a href="#/p5/beginShape">beginShape()</a> begins recording vertices for a shape and\n<a href="#/p5/endShape">endShape()</a> stops recording. The value of the kind parameter tells it which\ntypes of shapes to create from the provided vertices. With no mode\nspecified, the shape can be any irregular polygon.\n<br><br>\nThe parameters available for <a href="#/p5/beginShape">beginShape()</a> are POINTS, LINES, TRIANGLES,\nTRIANGLE_FAN, TRIANGLE_STRIP, QUADS, and QUAD_STRIP. After calling the\n<a href="#/p5/beginShape">beginShape()</a> function, a series of <a href="#/p5/vertex">vertex()</a> commands must follow. To stop\ndrawing the shape, call <a href="#/p5/endShape">endShape()</a>. Each shape will be outlined with the\ncurrent stroke color and filled with the fill color.\n<br><br>\nTransformations such as <a href="#/p5/translate">translate()</a>, <a href="#/p5/rotate">rotate()</a>, and <a href="#/p5/scale">scale()</a> do not work\nwithin <a href="#/p5/beginShape">beginShape()</a>. It is also not possible to use other shapes, such as\n<a href="#/p5/ellipse">ellipse()</a> or <a href="#/p5/rect">rect()</a> within <a href="#/p5/beginShape">beginShape()</a>.</p>\n',itemtype:"method",name:"beginShape",params:[{name:"kind",description:"<p>either POINTS, LINES, TRIANGLES, TRIANGLE_FAN\n                               TRIANGLE_STRIP, QUADS, or QUAD_STRIP</p>\n",type:"Constant",optional:!0}],chainable:1,example:["\n<div>\n<code>\nbeginShape();\nvertex(30, 20);\nvertex(85, 20);
21\nvertex(85, 75);\nvertex(30, 75);\nendShape(CLOSE);\n</code>\n</div>\n\n<div>\n<code>\nbeginShape(POINTS);\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nbeginShape(LINES);\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nnoFill();\nbeginShape();\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nnoFill();\nbeginShape();\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape(CLOSE);\n</code>\n</div>\n\n<div>\n<code>\nbeginShape(TRIANGLES);\nvertex(30, 75);\nvertex(40, 20);\nvertex(50, 75);\nvertex(60, 20);\nvertex(70, 75);\nvertex(80, 20);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nbeginShape(TRIANGLE_STRIP);\nvertex(30, 75);\nvertex(40, 20);\nvertex(50, 75);\nvertex(60, 20);\nvertex(70, 75);\nvertex(80, 20);\nvertex(90, 75);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nbeginShape(TRIANGLE_FAN);\nvertex(57.5, 50);\nvertex(57.5, 15);\nvertex(92, 50);\nvertex(57.5, 85);\nvertex(22, 50);\nvertex(57.5, 15);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nbeginShape(QUADS);\nvertex(30, 20);\nvertex(30, 75);\nvertex(50, 75);\nvertex(50, 20);\nvertex(65, 20);\nvertex(65, 75);\nvertex(85, 75);\nvertex(85, 20);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nbeginShape(QUAD_STRIP);\nvertex(30, 20);\nvertex(30, 75);\nvertex(50, 20);\nvertex(50, 75);\nvertex(65, 20);\nvertex(65, 75);\nvertex(85, 20);\nvertex(85, 75);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nbeginShape();\nvertex(20, 20);\nvertex(40, 20);\nvertex(40, 40);\nvertex(60, 40);\nvertex(60, 60);\nvertex(20, 60);\nendShape(CLOSE);\n</code>\n</div>"],alt:"white square-shape with black outline in middle-right of canvas.\n4 black points in a square shape in middle-right of canvas.\n2 horizontal black lines. In the top-right and bottom-right of canvas.\n3 line shape with horizontal on top, vertical in middle and horizontal bottom.\nsquare line shape in middle-right of canvas.\n2 white triangle shapes mid-right canvas. left one pointing up and right down.\n5 horizontal interlocking and alternating white triangles in mid-right canvas.\n4 interlocking white triangles in 45 degree rotated square-shape.\n2 white rectangle shapes in mid-right canvas. Both 20x55.\n3 side-by-side white rectangles center rect is smaller in mid-right canvas.\nThick white l-shape with black outline mid-top-left of canvas.",class:"p5",module:"Shape",submodule:"Vertex"},{file:"src/core/shape/vertex.js",line:270,description:'<p>Specifies vertex coordinates for Bezier curves. Each call to\nbezierVertex() defines the position of two control points and\none anchor point of a Bezier curve, adding a new segment to a\nline or shape. For WebGL mode bezierVertex() can be used in 2D\nas well as 3D mode. 2D mode expects 6 parameters, while 3D mode\nexpects 9 parameters (including z coordinates).\n<br><br>\nThe first time bezierVertex() is used within a <a href="#/p5/beginShape">beginShape()</a>\ncall, it must be prefaced with a call to <a href="#/p5/vertex">vertex()</a> to set the first anchor\npoint. This function must be used between <a href="#/p5/beginShape">beginShape()</a> and <a href="#/p5/endShape">endShape()</a>\nand only when there is no MODE or POINTS parameter specified to\n<a href="#/p5/beginShape">beginShape()</a>.</p>\n',itemtype:"method",name:"bezierVertex",chainable:1,example:["\n<div>\n<code>\nnoFill();\nbeginShape();\nvertex(30, 20);\nbezierVertex(80, 0, 80, 75, 30, 75);\nendShape();\n</code>\n</div>","\n<div>\n<code>\nbeginShape();\nvertex(30, 20);\nbezierVertex(80, 0, 80, 75, 30, 75);\nbezierVertex(50, 80, 60, 25, 30, 20);\nendShape();\n</code>\n</div>","\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  setAttributes('antialias', true);\n}\nfunction draw() {\n  orbitControl();\n  background(50);\n  strokeWeight(4);\n  stroke(255);\n  point(-25, 30);\n  point(25, 30);\n  point(25, -30);\n  point(-25, -30);\n\n  strokeWeight(1);\n  noFill();\n\n  beginShape();\n  vertex(-25, 30);\n  bezierVertex(25, 30, 25, -30, -25, -30);\n  endShape();\n\n  beginShape();\n  vertex(-25, 30, 20);\n  bezierVertex(25, 30, 20, 25, -30, 20, -25, -30, 20);\n  endShape();\n}\n</code>\n</div>"],alt:"crescent shape in middle of canvas with another crescent shape on positive z-axis.",class:"p5",module:"Shape",submodule:"Vertex",overloads:[{line:270,params:[{name:"x2",description:"<p>x-coordinate for the first control point</p>\n",type:"Number"},{name:"y2",description:"<p>y-coordinate for the first control point</p>\n",type:"Number"},{name:"x3",description:"<p>x-coordinate for the second control point</p>\n",type:"Number"},{name:"y3",description:"<p>y-coordinate for the second control point</p>\n",type:"Number"},{name:"x4",description:"<p>
21x-coordinate for the anchor point</p>\n",type:"Number"},{name:"y4",description:"<p>y-coordinate for the anchor point</p>\n",type:"Number"}],chainable:1},{line:358,params:[{name:"x2",description:"",type:"Number"},{name:"y2",description:"",type:"Number"},{name:"z2",description:"<p>z-coordinate for the first control point (for WebGL mode)</p>\n",type:"Number"},{name:"x3",description:"",type:"Number"},{name:"y3",description:"",type:"Number"},{name:"z3",description:"<p>z-coordinate for the second control point (for WebGL mode)</p>\n",type:"Number"},{name:"x4",description:"",type:"Number"},{name:"y4",description:"",type:"Number"},{name:"z4",description:"<p>z-coordinate for the anchor point (for WebGL mode)</p>\n",type:"Number"}],chainable:1}]},{file:"src/core/shape/vertex.js",line:398,description:'<p>Specifies vertex coordinates for curves. This function may only\nbe used between <a href="#/p5/beginShape">beginShape()</a> and <a href="#/p5/endShape">endShape()</a> and only when there\nis no MODE parameter specified to <a href="#/p5/beginShape">beginShape()</a>.\nFor WebGL mode curveVertex() can be used in 2D as well as 3D mode.\n2D mode expects 2 parameters, while 3D mode expects 3 parameters.\n<br><br>\nThe first and last points in a series of curveVertex() lines will be used to\nguide the beginning and end of a the curve. A minimum of four\npoints is required to draw a tiny curve between the second and\nthird points. Adding a fifth point with curveVertex() will draw\nthe curve between the second, third, and fourth points. The\ncurveVertex() function is an implementation of Catmull-Rom\nsplines.</p>\n',itemtype:"method",name:"curveVertex",chainable:1,example:["\n<div>\n<code>\nstrokeWeight(5);\npoint(84, 91);\npoint(68, 19);\npoint(21, 17);\npoint(32, 91);\nstrokeWeight(1);\n\nnoFill();\nbeginShape();\ncurveVertex(84, 91);\ncurveVertex(84, 91);\ncurveVertex(68, 19);\ncurveVertex(21, 17);\ncurveVertex(32, 91);\ncurveVertex(32, 91);\nendShape();\n</code>\n</div>"],alt:"Upside-down u-shape line, mid canvas. left point extends beyond canvas view.",class:"p5",module:"Shape",submodule:"Vertex",overloads:[{line:398,params:[{name:"x",description:"<p>x-coordinate of the vertex</p>\n",type:"Number"},{name:"y",description:"<p>y-coordinate of the vertex</p>\n",type:"Number"}],chainable:1},{line:443,params:[{name:"x",description:"",type:"Number"},{name:"y",description:"",type:"Number"},{name:"z",description:"<p>z-coordinate of the vertex (for WebGL mode)</p>\n",type:"Number",optional:!0}],chainable:1}]},{file:"src/core/shape/vertex.js",line:508,description:'<p>Use the <a href="#/p5/beginContour">beginContour()</a> and <a href="#/p5/endContour">endContour()</a> functions to create negative\nshapes within shapes such as the center of the letter &#39;O&#39;. <a href="#/p5/beginContour">beginContour()</a>\nbegins recording vertices for the shape and <a href="#/p5/endContour">endContour()</a> stops recording.\nThe vertices that define a negative shape must &quot;wind&quot; in the opposite\ndirection from the exterior shape. First draw vertices for the exterior\nclockwise order, then for internal shapes, draw vertices\nshape in counter-clockwise.\n<br><br>\nThese functions can only be used within a <a href="#/p5/beginShape">beginShape()</a>/<a href="#/p5/endShape">endShape()</a> pair and\ntransformations such as <a href="#/p5/translate">translate()</a>, <a href="#/p5/rotate">rotate()</a>, and <a href="#/p5/scale">scale()</a> do not work\nwithin a <a href="#/p5/beginContour">beginContour()</a>/<a href="#/p5/endContour">endContour()</a> pair. It is also not possible to use\nother shapes, such as <a href="#/p5/ellipse">ellipse()</a> or <a href="#/p5/rect">rect()</a> within.</p>\n',itemtype:"method",name:"endContour",chainable:1,example:["\n<div>\n<code>\ntranslate(50, 50);\nstroke(255, 0, 0);\nbeginShape();\n// Exterior part of shape, clockwise winding\nvertex(-40, -40);\nvertex(40, -40);\nvertex(40, 40);\nvertex(-40, 40);\n// Interior part of shape, counter-clockwise winding\nbeginContour();\nvertex(-20, -20);\nvertex(-20, 20);\nvertex(20, 20);\nvertex(20, -20);\nendContour();\nendShape(CLOSE);\n</code>\n</div>"],alt:"white rect and smaller grey rect with red outlines in center of canvas.",class:"p5",module:"Shape",submodule:"Vertex"},{file:"src/core/shape/vertex.js",line:568,description:'<p>The <a href="#/p5/endShape">endShape()</a> function is the companion to <a href="#/p5/beginShape">beginShape()</a> and may only be\ncalled after <a href="#/p5/beginShape">beginShape()</a>. When <a href="#/p5/endshape">endshape()</a> is called, all of image data\ndefined since the previous call to <a href="#/p5/beginShape">beginShape()</a> is written into the image\nbuffer. The constant CLOSE as the value for the MODE parameter to close\nthe shape (to connect the beginning and the end).</p>\n',itemtype:"method",name:"endShape",params:[{name:"mode",description:"<p>use CLOSE to close the shape</p>\n",type:"Constant",optional:!0}],chainable:1,example:["\n<div>\n<code>\nnoFill();\n\nbeginShape();\nvertex(20, 20);\nvertex(45, 20);\nvertex(45, 80);\nendShape(CLOSE);\n\nbeginShape();\nvertex(50, 20);\nvertex(75, 20);\nvertex(75, 80);\nendShape();\n</code>\n</div>"],alt:"Triangle line shape with smallest interior angle on bottom and upside-
21down L.",class:"p5",module:"Shape",submodule:"Vertex"},{file:"src/core/shape/vertex.js",line:654,description:'<p>Specifies vertex coordinates for quadratic Bezier curves. Each call to\nquadraticVertex() defines the position of one control points and one\nanchor point of a Bezier curve, adding a new segment to a line or shape.\nThe first time quadraticVertex() is used within a <a href="#/p5/beginShape">beginShape()</a> call, it\nmust be prefaced with a call to <a href="#/p5/vertex">vertex()</a> to set the first anchor point.\nFor WebGL mode quadraticVertex() can be used in 2D as well as 3D mode.\n2D mode expects 4 parameters, while 3D mode expects 6 parameters\n(including z coordinates).\n<br><br>\nThis function must be used between <a href="#/p5/beginShape">beginShape()</a> and <a href="#/p5/endShape">endShape()</a>\nand only when there is no MODE or POINTS parameter specified to\n<a href="#/p5/beginShape">beginShape()</a>.</p>\n',itemtype:"method",name:"quadraticVertex",chainable:1,example:["\n<div>\n<code>\nstrokeWeight(5);\npoint(20, 20);\npoint(80, 20);\npoint(50, 50);\n\nnoFill();\nstrokeWeight(1);\nbeginShape();\nvertex(20, 20);\nquadraticVertex(80, 20, 50, 50);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nstrokeWeight(5);\npoint(20, 20);\npoint(80, 20);\npoint(50, 50);\n\npoint(20, 80);\npoint(80, 80);\npoint(80, 60);\n\nnoFill();\nstrokeWeight(1);\nbeginShape();\nvertex(20, 20);\nquadraticVertex(80, 20, 50, 50);\nquadraticVertex(20, 80, 80, 80);\nvertex(80, 60);\nendShape();\n</code>\n</div>"],alt:"arched-shaped black line with 4 pixel thick stroke weight.\nbackwards s-shaped black line with 4 pixel thick stroke weight.",class:"p5",module:"Shape",submodule:"Vertex",overloads:[{line:654,params:[{name:"cx",description:"<p>x-coordinate for the control point</p>\n",type:"Number"},{name:"cy",description:"<p>y-coordinate for the control point</p>\n",type:"Number"},{name:"x3",description:"<p>x-coordinate for the anchor point</p>\n",type:"Number"},{name:"y3",description:"<p>y-coordinate for the anchor point</p>\n",type:"Number"}],chainable:1},{line:720,params:[{name:"cx",description:"",type:"Number"},{name:"cy",description:"",type:"Number"},{name:"cz",description:"<p>z-coordinate for the control point (for WebGL mode)</p>\n",type:"Number"},{name:"x3",description:"",type:"Number"},{name:"y3",description:"",type:"Number"},{name:"z3",description:"<p>z-coordinate for the anchor point (for WebGL mode)</p>\n",type:"Number"}],chainable:1}]},{file:"src/core/shape/vertex.js",line:813,description:'<p>All shapes are constructed by connecting a series of vertices. <a href="#/p5/vertex">vertex()</a>\nis used to specify the vertex coordinates for points, lines, triangles,\nquads, and polygons. It is used exclusively within the <a href="#/p5/beginShape">beginShape()</a> and\n<a href="#/p5/endShape">endShape()</a> functions.</p>\n',itemtype:"method",name:"vertex",chainable:1,example:["\n<div>\n<code>\nstrokeWeight(3);\nbeginShape(POINTS);\nvertex(30, 20);\nvertex(85, 20);\nvertex(85, 75);\nvertex(30, 75);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\ncreateCanvas(100, 100, WEBGL);\nbackground(240, 240, 240);\nfill(237, 34, 93);\nnoStroke();\nbeginShape();\nvertex(0, 35);\nvertex(35, 0);\nvertex(0, -35);\nvertex(-35, 0);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\ncreateCanvas(100, 100, WEBGL);\nbackground(240, 240, 240);\nfill(237, 34, 93);\nnoStroke();\nbeginShape();\nvertex(-10, 10);\nvertex(0, 35);\nvertex(10, 10);\nvertex(35, 0);\nvertex(10, -8);\nvertex(0, -35);\nvertex(-10, -8);\nvertex(-35, 0);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\nstrokeWeight(3);\nstroke(237, 34, 93);\nbeginShape(LINES);\nvertex(10, 35);\nvertex(90, 35);\nvertex(10, 65);\nvertex(90, 65);\nvertex(35, 10);\nvertex(35, 90);\nvertex(65, 10);\nvertex(65, 90);\nendShape();\n</code>\n</div>\n\n<div>\n<code>\n// Click to change the number of sides.\n// In WebGL mode, custom shapes will only\n// display hollow fill sections when\n// all calls to vertex() use the same z-value.\n\nlet sides = 3;\nlet angle, px, py;\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  setAttributes('antialias', true);\n  fill(237, 34, 93);\n  strokeWeight(3);\n}\n\nfunction draw() {\n  background(200);\n  rotateX(frameCount * 0.01);\n  rotateZ(frameCount * 0.01);\n  ngon(sides, 0, 0, 80);\n}\n\nfunction mouseClicked() {\n  if (sides > 6) {\n    sides = 3;\n  } else {\n    sides++;\n  }\n}\n\nfunction ngon(n, x, y, d) {\n  beginShape();\n  for (var i = 0; i < n + 1;
21 i++) {\n    angle = TWO_PI / n * i;\n    px = x + sin(angle) * d / 2;\n    py = y - cos(angle) * d / 2;\n    vertex(px, py, 0);\n  }\n  for (i = 0; i < n + 1; i++) {\n    angle = TWO_PI / n * i;\n    px = x + sin(angle) * d / 4;\n    py = y - cos(angle) * d / 4;\n    vertex(px, py, 0);\n  }\n  endShape();\n}\n</code>\n</div>"],alt:"4 black points in a square shape in middle-right of canvas.\n4 points making a diamond shape.\n8 points making a star.\n8 points making 4 lines.\nA rotating 3D shape with a hollow section in the middle.",class:"p5",module:"Shape",submodule:"Vertex",overloads:[{line:813,params:[{name:"x",description:"<p>x-coordinate of the vertex</p>\n",type:"Number"},{name:"y",description:"<p>y-coordinate of the vertex</p>\n",type:"Number"}],chainable:1},{line:945,params:[{name:"x",description:"",type:"Number"},{name:"y",description:"",type:"Number"},{name:"z",description:"<p>z-coordinate of the vertex</p>\n",type:"Number"},{name:"u",description:"<p>the vertex&#39;s texture u-coordinate</p>\n",type:"Number",optional:!0},{name:"v",description:"<p>the vertex&#39;s texture v-coordinate</p>\n",type:"Number",optional:!0}],chainable:1}]},{file:"src/core/constants.js",line:13,description:"<p>The default, two-dimensional renderer.</p>\n",itemtype:"property",name:"P2D",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:19,description:"<p>One of the two render modes in p5.js: P2D (default renderer) and WEBGL\nEnables 3D render by introducing the third dimension: Z</p>\n",itemtype:"property",name:"WEBGL",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:28,itemtype:"property",name:"ARROW",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:33,itemtype:"property",name:"CROSS",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:38,itemtype:"property",name:"HAND",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:43,itemtype:"property",name:"MOVE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:48,itemtype:"property",name:"TEXT",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:53,itemtype:"property",name:"WAIT",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:61,description:'<p>HALF_PI is a mathematical constant with the value\n1.57079632679489661923. It is half the ratio of the\ncircumference of a circle to its diameter. It is useful in\ncombination with the trigonometric functions <a href="#/p5/sin">sin()</a> and <a href="#/p5/cos">cos()</a>.</p>\n',itemtype:"property",name:"HALF_PI",type:"Number",final:1,example:["\n<div><code>\narc(50, 50, 80, 80, 0, HALF_PI);\n</code></div>"],alt:"80x80 white quarter-circle with curve toward bottom right of canvas.",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:80,description:'<p>PI is a mathematical constant with the value\n3.14159265358979323846. It is the ratio of the circumference\nof a circle to its diameter. It is useful in combination with\nthe trigonometric functions <a href="#/p5/sin">sin()</a> and <a href="#/p5/cos">cos()</a>.</p>\n',itemtype:"property",name:"PI",type:"Number",final:1,example:["\n<div><code>\narc(50, 50, 80, 80, 0, PI);\n</code></div>"],alt:"white half-circle with curve toward bottom of canvas.",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:99,description:'<p>QUARTER_PI is a mathematical constant with the value 0.7853982.\nIt is one quarter the ratio of the circumference of a circle to\nits diameter. It is useful in combination with the trigonometric\nfunctions <a href="#/p5/sin">sin()</a> and <a href="#/p5/cos">cos()</a>.</p>\n',itemtype:"property",name:"QUARTER_PI",type:"Number",final:1,example:["\n<div><code>\narc(50, 50, 80, 80, 0, QUARTER_PI);\n</code></div>"],alt:"white eighth-circle rotated about 40 degrees with curve bottom right canvas.",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:118,description:'<p>TAU is an alias for TWO_PI, a mathematical constant with the\nvalue 6.28318530717958647693. It is twice the ratio of the\ncircumference of a circle to its diameter. It is useful in\ncombination with the trigonometric functions <a href="#/p5/sin">sin()</a> and <a href="#/p5/cos">cos()</a>.</p>\n',itemtype:"property",name:"TAU",type:"Number",final:1,example:["\n<div><code>\narc(50, 50, 80, 80, 0, TAU);\n</code></div>"],alt:"80x80 white ellipse shape in center of canvas.",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:137,description:'<p>TWO_PI is a mathematical constant with the value\n6.28318530717958647693. It is twice the ratio of the\ncircumference of a circle to its diameter. It is useful in\ncombination with the trigonometric functions <a href="#/p5/sin">sin()</a> and <a href="#/p5/cos">cos()</a>.</p>\n',itemtype:"property",name:"TWO_PI",type:"Number",final:1,example:["\n<div><code>\narc(50, 50, 80, 80, 0, TWO_PI);\n</code></div>"],alt:"80x80 white ellipse shape in center of canvas.",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:156,description:'<p>Constant to be used with <a href="#/p5/angleMode">angleMode()</a> function, to set the mode which\np5.js interprates and calculates angles (either DEGREES or RADIANS).</p>\n',itemtype:"property",name:"DEGREES",type:"String",final:1,example:["\n<div class='norender'><code>\nfunction setup() {\n  angleMode(DEGREES);\n}\n</code></div>"],class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:170,description:'<p>Constant to be used with <a href="#/p5/angleMode">angleMode()</a> function, to set the mode which\np5.js interprates and calculates angles (either RADIANS or DEGREES).</p>\n',itemtype:"property",name:"RADIANS",type:"String",final:1,example:["\n<div class='norender'><code>\nfunction setup() {\n  angleMode(RADIANS);\n}\n</code></div>"],class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:188,itemtype:"property",name:"CORNER",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:193,itemtype:"property",name:"CORNERS",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:198,itemtype:"property",name:"RADIUS",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:203,itemtype:"property",name:"RIGHT",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:208,itemtype:"property",name:"LEFT",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:213,itemtype:"property",name:"CENTER",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:218,itemtype:"property",name:"TOP",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:223,itemtype:"property",name:"BOTTOM",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:228,itemtype:"property",name:"BASELINE",type:"String",final:1,default:"alphabetic",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:234,itemtype:"property",name:"POINTS",type:"Number",final:1,default:"0x0000",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:240,itemtype:"property",name:"LINES",type:"Number",final:1,default:"0x0001",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:246,itemtype:"property",name:"LINE_STRIP",type:"Number",final:1,default:"0x0003",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:252,itemtype:"property",name:"LINE_LOOP",type:"Number",final:1,default:"0x0002",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:258,itemtype:"property",name:"TRIANGLES",type:"Number",final:1,default:"0x0004",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:264,itemtype:"property",name:"TRIANGLE_FAN",type:"Number",final:1,default:"0x0006",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:270,itemtype:"property",name:"TRIANGLE_STRIP",type:"Number",final:1,default:"0x0005",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:276,itemtype:"property",name:"QUADS",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:281,itemtype:"property",name:"QUAD_STRIP",type:"String",final:1,default:"quad_strip",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:287,itemtype:"property",name:"CLOSE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:292,itemtype:"property",name:"OPEN",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:297,itemtype:"property",name:"CHORD",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:302,itemtype:"property",name:"PIE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:307,itemtype:"property",name:"PROJECT",type:"String",final:1,default:"square",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:313,itemtype:"property",name:"SQUARE",type:"String",final:1,default:"butt",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:319,itemtype:"property",name:"ROUND",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:324,itemtype:"property",name:"BEVEL",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:329,itemtype:"property",name:"MITER",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:336,itemtype:"property",name:"RGB",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:341,itemtype:"property",name:"HSB",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:346,itemtype:"property",name:"HSL",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:353,description:'<p>AUTO allows us to automatically set the width or height of an element (but not both),\nbased on the current height and width of the element. Only one parameter can\nbe passed to the <a href="/#/p5.Element/size">size</a> function as AUTO, at a time.</p>\n',itemtype:"property",name:"AUTO",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:380,itemtype:"property",name:"BLEND",type:"String",final:1,default:"source-over",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:386,itemtype:"property",name:"ADD",type:"String",final:1,default:"lighter",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:394,itemtype:"property",name:"DARKEST",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:399,itemtype:"property",name:"LIGHTEST",type:"String",final:1,default:"lighten",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:405,itemtype:"property",name:"DIFFERENCE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:410,itemtype:"property",name:"SUBTRACT",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:415,itemtype:"property",name:"EXCLUSION",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:420,itemtype:"property",name:"MULTIPLY",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:425,itemtype:"property",name:"SCREEN",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:430,itemtype:"property",name:"REPLACE",type:"String",final:1,default:"copy",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:436,itemtype:"property",name:"OVERLAY",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:441,itemtype:"property",name:"HARD_LIGHT",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:446,itemtype:"property",name:"SOFT_LIGHT",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:451,itemtype:"property",name:"DODGE",type:"String",final:1,default:"color-dodge",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:457,itemtype:"property",name:"BURN",type:"String",final:1,default:"color-burn",class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:465,itemtype:"property",name:"THRESHOLD",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:470,itemtype:"property",name:"GRAY",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:475,itemtype:"property",name:"OPAQUE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:480,itemtype:"property",name:"INVERT",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:485,itemtype:"property",name:"POSTERIZE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:490,itemtype:"property",name:"DILATE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:495,itemtype:"property",name:"ERODE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:500,itemtype:"property",name:"BLUR",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:507,itemtype:"property",name:"NORMAL",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:512,itemtype:"property",name:"ITALIC",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:517,itemtype:"property",name:"BOLD",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:522,itemtype:"property",name:"BOLDITALIC",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:547,itemtype:"property",name:"IMAGE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:561,itemtype:"property",name:"LANDSCAPE",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:566,itemtype:"property",name:"PORTRAIT",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:576,itemtype:"property",name:"GRID",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/constants.js",line:582,itemtype:"property",name:"AXES",type:"String",final:1,class:"p5",module:"Constants",submodule:"Constants"},{file:"src/core/environment.js",line:22,description:'<p>The <a href="#/p5/print">print()</a> function writes to the console 
21area of your browser.\nThis function is often helpful for looking at the data a program is\nproducing. This function creates a new line of text for each call to\nthe function. Individual elements can be\nseparated with quotes (&quot;&quot;) and joined with the addition operator (+).</p>\n<p>Note that calling print() without any arguments invokes the window.print()\nfunction which opens the browser&#39;s print dialog. To print a blank line\nto console you can write print(&#39;\\n&#39;).</p>\n',itemtype:"method",name:"print",params:[{name:"contents",description:"<p>any combination of Number, String, Object, Boolean,\n                      Array to print</p>\n",type:"Any"}],example:["\n<div><code class='norender'>\nlet x = 10;\nprint('The value of x is ' + x);\n// prints \"The value of x is 10\"\n</code></div>"],alt:"default grey canvas",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:53,description:'<p>The system variable <a href="#/p5/frameCount">frameCount</a> contains the number of frames that have\nbeen displayed since the program started. Inside <a href="#/p5/setup">setup()</a> the value is 0,\nafter the first iteration of draw it is 1, etc.</p>\n',itemtype:"property",name:"frameCount",type:"Integer",readonly:"",example:["\n  <div><code>\nfunction setup() {\n  frameRate(30);\n  textSize(30);\n  textAlign(CENTER);\n}\n\nfunction draw() {\n  background(200);\n  text(frameCount, width / 2, height / 2);\n}\n</code></div>"],alt:"numbers rapidly counting upward with frame count set to 30.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:80,description:'<p>The system variable <a href="#/p5/deltaTime">deltaTime</a> contains the time\ndifference between the beginning of the previous frame and the beginning\nof the current frame in milliseconds.\n<br><br>\nThis variable is useful for creating time sensitive animation or physics\ncalculation that should stay constant regardless of frame rate.</p>\n',itemtype:"property",name:"deltaTime",type:"Integer",readonly:"",example:["\n<div><code>\nlet rectX = 0;\nlet fr = 30; //starting FPS\nlet clr;\n\nfunction setup() {\n  background(200);\n  frameRate(fr); // Attempt to refresh at starting FPS\n  clr = color(255, 0, 0);\n}\n\nfunction draw() {\n  background(200);\n  rectX = rectX + 1 * (deltaTime / 50); // Move Rectangle in relation to deltaTime\n\n  if (rectX >= width) {\n    // If you go off screen.\n    if (fr === 30) {\n      clr = color(0, 0, 255);\n      fr = 10;\n      frameRate(fr); // make frameRate 10 FPS\n    } else {\n      clr = color(255, 0, 0);\n      fr = 30;\n      frameRate(fr); // make frameRate 30 FPS\n    }\n    rectX = 0;\n  }\n  fill(clr);\n  rect(rectX, 40, 20, 20);\n}\n</code></div>"],alt:"red rect moves left to right, followed by blue rect moving at the same speed\nwith a lower frame rate. Loops.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:131,description:"<p>Confirms if the window a p5.js program is in is &quot;focused,&quot; meaning that\nthe sketch will accept mouse or keyboard input. This variable is\n&quot;true&quot; if the window is focused and &quot;false&quot; if not.</p>\n",itemtype:"property",name:"focused",type:"Boolean",readonly:"",example:['\n<div><code>\n// To demonstrate, put two windows side by side.\n// Click on the window that the p5 sketch isn\'t in!\nfunction draw() {\n  background(200);\n  noStroke();\n  fill(0, 200, 0);\n  ellipse(25, 25, 50, 50);\n\n  if (!focused) {\n   // or "if (focused === false)"\n    stroke(200, 0, 0);\n    line(0, 0, 100, 100);\n    line(100, 0, 0, 100);\n  }\n}\n</code></div>'],alt:"green 50x50 ellipse at top left. Red X covers canvas when page focus changes",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:163,description:"<p>Sets the cursor to a predefined symbol or an image, or makes it visible\nif already hidden. If you are trying to set an image as the cursor, the\nrecommended size is 16x16 or 32x32 pixels. The values for parameters x and y\nmust be less than the dimensions of the image.</p>\n",itemtype:"method",name:"cursor",params:[{name:"type",description:'<p>Built-In: either ARROW, CROSS, HAND, MOVE, TEXT and WAIT\n                              Native CSS properties: &#39;grab&#39;, &#39;progress&#39;, &#39;cell&#39; etc.\n                              External: path for cursor&#39;s images\n                              (Allowed File extensions: .cur, .gif, .jpg, .jpeg, .png)\n                              For more information on Native CSS cursors and url visit:\n                              <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/cursor">https://developer.mozilla.org/en-US/docs/Web/CSS/cursor</a></p>\n',type:"String|Constant"},{name:"x",description:"<p>the horizontal active spot of the cursor (must be less than 32)</p>\n",type:"Number",optional:!0},{name:"y",description:"<p>the vertical active spot of the cursor (must be less than 32)</p>\n",type:"Number",optional:!0}],example:["\n<div><code>
21\n// Move the mouse across the quadrants\n// to see the cursor change\nfunction draw() {\n  line(width / 2, 0, width / 2, height);\n  line(0, height / 2, width, height / 2);\n  if (mouseX < 50 && mouseY < 50) {\n    cursor(CROSS);\n  } else if (mouseX > 50 && mouseY < 50) {\n    cursor('progress');\n  } else if (mouseX > 50 && mouseY > 50) {\n    cursor('https://s3.amazonaws.com/mupublicdata/cursor.cur');\n  } else {\n    cursor('grab');\n  }\n}\n</code></div>"],alt:"canvas is divided into four quadrants. cursor on first is a cross, second is a progress,\nthird is a custom cursor using path to the cursor and fourth is a grab.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:232,description:'<p>Specifies the number of frames to be displayed every second. For example,\nthe function call frameRate(30) will attempt to refresh 30 times a second.\nIf the processor is not fast enough to maintain the specified rate, the\nframe rate will not be achieved. Setting the frame rate within <a href="#/p5/setup">setup()</a> is\nrecommended. The default frame rate is based on the frame rate of the display\n(here also called &quot;refresh rate&quot;), which is set to 60 frames per second on most\ncomputers. A frame rate of 24 frames per second (usual for movies) or above\nwill be enough for smooth animations\nThis is the same as setFrameRate(val).\n<br><br>\nCalling <a href="#/p5/frameRate">frameRate()</a> with no arguments returns the current framerate. The\ndraw function must run at least once before it will return a value. This\nis the same as <a href="#/p5/getFrameRate">getFrameRate()</a>.\n<br><br>\nCalling <a href="#/p5/frameRate">frameRate()</a> with arguments that are not of the type numbers\nor are non positive also returns current framerate.</p>\n',itemtype:"method",name:"frameRate",chainable:1,example:["\n\n<div><code>\nlet rectX = 0;\nlet fr = 30; //starting FPS\nlet clr;\n\nfunction setup() {\n  background(200);\n  frameRate(fr); // Attempt to refresh at starting FPS\n  clr = color(255, 0, 0);\n}\n\nfunction draw() {\n  background(200);\n  rectX = rectX += 1; // Move Rectangle\n\n  if (rectX >= width) {\n   // If you go off screen.\n    if (fr === 30) {\n      clr = color(0, 0, 255);\n      fr = 10;\n      frameRate(fr); // make frameRate 10 FPS\n    } else {\n      clr = color(255, 0, 0);\n      fr = 30;\n      frameRate(fr); // make frameRate 30 FPS\n    }\n    rectX = 0;\n  }\n  fill(clr);\n  rect(rectX, 40, 20, 20);\n}\n</code></div>"],alt:"blue rect moves left to right, followed by red rect moving faster. Loops.",class:"p5",module:"Environment",submodule:"Environment",overloads:[{line:232,params:[{name:"fps",description:"<p>number of frames to be displayed every second</p>\n",type:"Number"}],chainable:1},{line:293,params:[],return:{description:"current frameRate",type:"Number"}}]},{file:"src/core/environment.js",line:332,description:"<p>Hides the cursor from view.</p>\n",itemtype:"method",name:"noCursor",example:["\n<div><code>\nfunction setup() {\n  noCursor();\n}\n\nfunction draw() {\n  background(200);\n  ellipse(mouseX, mouseY, 10, 10);\n}\n</code></div>"],alt:"cursor becomes 10x 10 white ellipse the moves with mouse x and y.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:357,description:'<p>System variable that stores the width of the screen display according to The\ndefault <a href="#/p5/pixelDensity">pixelDensity</a>. This is used to run a\nfull-screen program on any display size. To return actual screen size,\nmultiply this by pixelDensity.</p>\n',itemtype:"property",name:"displayWidth",type:"Number",readonly:"",example:['\n<div class="norender"><code>\ncreateCanvas(displayWidth, displayHeight);\n</code></div>'],alt:"cursor becomes 10x 10 white ellipse the moves with mouse x and y.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:376,description:'<p>System variable that stores the height of the screen display according to The\ndefault <a href="#/p5/pixelDensity">pixelDensity</a>. This is used to run a\nfull-screen program on any display size. To return actual screen size,\nmultiply this by pixelDensity.</p>\n',itemtype:"property",name:"displayHeight",type:"Number",readonly:"",example:['\n<div class="norender"><code>\ncreateCanvas(displayWidth, displayHeight);\n</code></div>
21'],alt:"no display.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:395,description:"<p>System variable that stores the width of the inner window, it maps to\nwindow.innerWidth.</p>\n",itemtype:"property",name:"windowWidth",type:"Number",readonly:"",example:['\n<div class="norender"><code>\ncreateCanvas(windowWidth, windowHeight);\n</code></div>'],alt:"no display.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:411,description:"<p>System variable that stores the height of the inner window, it maps to\nwindow.innerHeight.</p>\n",itemtype:"property",name:"windowHeight",type:"Number",readonly:"",example:['\n<div class="norender"><code>\ncreateCanvas(windowWidth, windowHeight);\n</code></div>'],alt:"no display.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:427,description:'<p>The <a href="#/p5/windowResized">windowResized()</a> function is called once every time the browser window\nis resized. This is a good place to resize the canvas or do any other\nadjustments to accommodate the new window size.</p>\n',itemtype:"method",name:"windowResized",example:['\n<div class="norender"><code>\nfunction setup() {\n  createCanvas(windowWidth, windowHeight);\n}\n\nfunction draw() {\n  background(0, 100, 200);\n}\n\nfunction windowResized() {\n  resizeCanvas(windowWidth, windowHeight);\n}\n</code></div>'],alt:"no display.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:481,description:'<p>System variable that stores the width of the drawing canvas. This value\nis set by the first parameter of the <a href="#/p5/createCanvas">createCanvas()</a> function.\nFor example, the function call createCanvas(320, 240) sets the width\nvariable to the value 320. The value of width defaults to 100 if\n<a href="#/p5/createCanvas">createCanvas()</a> is not used in a program.</p>\n',itemtype:"property",name:"width",type:"Number",readonly:"",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:493,description:'<p>System variable that stores the height of the drawing canvas. This value\nis set by the second parameter of the <a href="#/p5/createCanvas">createCanvas()</a> function. For\nexample, the function call createCanvas(320, 240) sets the height\nvariable to the value 240. The value of height defaults to 100 if\n<a href="#/p5/createCanvas">createCanvas()</a> is not used in a program.</p>\n',itemtype:"property",name:"height",type:"Number",readonly:"",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:505,description:"<p>If argument is given, sets the sketch to fullscreen or not based on the\nvalue of the argument. If no argument is given, returns the current\nfullscreen state. Note that due to browser restrictions this can only\nbe called on user input, for example, on mouse press like the example\nbelow.</p>\n",itemtype:"method",name:"fullscreen",params:[{name:"val",description:"<p>whether the sketch should be in fullscreen mode\nor not</p>\n",type:"Boolean",optional:!0}],return:{description:"current fullscreen state",type:"Boolean"},example:["\n<div>\n<code>\n// Clicking in the box toggles fullscreen on and off.\nfunction setup() {\n  background(200);\n}\nfunction mousePressed() {\n  if (mouseX > 0 && mouseX < 100 && mouseY > 0 && mouseY < 100) {\n    let fs = fullscreen();\n    fullscreen(!fs);\n  }\n}\n</code>\n</div>"],alt:"no display.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:556,description:'<p>Sets the pixel scaling for high pixel density displays. By default\npixel density is set to match display density, call pixelDensity(1)\nto turn this off. Calling <a href="#/p5/pixelDensity">pixelDensity()</a> with no arguments returns\nthe current pixel density of the sketch.</p>\n',itemtype:"method",name:"pixelDensity",chainable:1,example:["\n<div>\n<code>\nfunction setup() {\n  pixelDensity(1);\n  createCanvas(100, 100);\n  background(200);\n  ellipse(width / 2, height / 2, 50, 50);\n}\n</code>\n</div>\n<div>\n<code>\nfunction setup() {\n  pixelDensity(3.0);\n  createCanvas(100, 100);\n  background(200);\n  ellipse(width / 2, height / 2, 50, 50);\n}\n</code>\n</div>"],alt:"fuzzy 50x50 white ellipse with black outline in center of canvas.\nsharp 50x50 white ellipse with black outline in center of canvas.",class:"p5",module:"Env
21ironment",submodule:"Environment",overloads:[{line:556,params:[{name:"val",description:"<p>whether or how much the sketch should scale</p>\n",type:"Number"}],chainable:1},{line:591,params:[],return:{description:"current pixel density of the sketch",type:"Number"}}]},{file:"src/core/environment.js",line:611,description:"<p>Returns the pixel density of the current display the sketch is running on.</p>\n",itemtype:"method",name:"displayDensity",return:{description:"current pixel density of the display",type:"Number"},example:["\n<div>\n<code>\nfunction setup() {\n  let density = displayDensity();\n  pixelDensity(density);\n  createCanvas(100, 100);\n  background(200);\n  ellipse(width / 2, height / 2, 50, 50);\n}\n</code>\n</div>"],alt:"50x50 white ellipse with black outline in center of canvas.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:668,description:"<p>Gets the current URL.</p>\n",itemtype:"method",name:"getURL",return:{description:"url",type:"String"},example:["\n<div>\n<code>\nlet url;\nlet x = 100;\n\nfunction setup() {\n  fill(0);\n  noStroke();\n  url = getURL();\n}\n\nfunction draw() {\n  background(200);\n  text(url, x, height / 2);\n  x--;\n}\n</code>\n</div>"],alt:"current url (http://p5js.org/reference/#/p5/getURL) moves right to left.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:699,description:"<p>Gets the current URL path as an array.</p>\n",itemtype:"method",name:"getURLPath",return:{description:"path components",type:"String[]"},example:["\n<div class='norender'><code>\nfunction setup() {\n  let urlPath = getURLPath();\n  for (let i = 0; i < urlPath.length; i++) {\n    text(urlPath[i], 10, i * 20 + 20);\n  }\n}\n</code></div>"],alt:"no display",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/environment.js",line:722,description:"<p>Gets the current URL params as an Object.</p>\n",itemtype:"method",name:"getURLParams",return:{description:"URL params",type:"Object"},example:["\n<div class='norender notest'>\n<code>\n// Example: http://p5js.org?year=2014&month=May&day=15\n\nfunction setup() {\n  let params = getURLParams();\n  text(params.day, 10, 20);\n  text(params.month, 10, 40);\n  text(params.year, 10, 60);\n}\n</code>\n</div>"],alt:"no display.",class:"p5",module:"Environment",submodule:"Environment"},{file:"src/core/error_helpers.js",line:1,requires:["core"],class:"p5",module:"Environment"},{file:"src/core/error_helpers.js",line:584,description:"<p>Validates parameters\nparam  {String}               func    the name of the function\nparam  {Array}                args    user input arguments</p>\n<p>example:\n var a;\n ellipse(10,10,a,5);\nconsole ouput:\n &quot;It looks like ellipse received an empty variable in spot #2.&quot;</p>\n<p>example:\n ellipse(10,&quot;foo&quot;,5,5);\nconsole output:\n &quot;ellipse was expecting a number for parameter #1,\n          received &quot;foo&quot; instead.&quot;</p>\n",class:"p5",module:"Environment"},{file:"src/core/error_helpers.js",line:645,description:"<p>Prints out all the colors in the color pallete with white text.\nFor color blindness testing.</p>\n",class:"p5",module:"Environment"},{file:"src/core/helpers.js",line:1,requires:["constants"],class:"p5",module:"Environment"},{file:"src/core/legacy.js",line:1,requires:["core\nThese are functions that are part of the Processing API but are not part of\nthe p5.js API. In some cases they have a new name","in others","they are\nremoved completely. Not all unsupported Processing functions are listed here\nbut we try to include ones that a user coming from Processing might likely\ncall."],class:"p5",module:"Environment"},{file:"src/core/main.js",line:42,description:'<p>Called directly before <a href="#/p5/setup">setup()</a>, the <a href="#/p5/preload">preload()</a> function is used to handle\nasynchronous loading of external files in a blocking way. If a preload\nfunction is defined, <a href="#/p5/setup">setup()</a> will wait until any load calls within have\nfinished. Nothing besides load calls (<a href="#/p5/loadImage">loadImage</a>, <a href="#/p5/loadJSON">loadJSON</a>, <a href="#/p5/loadFont">loadFont</a>,\n<a href="#/p5/loadStrings">loadStrings</a>, etc.) should be inside the preload function. If asynchronous\nloading is preferred, the load methods can instead be called in <a href="#/p5/setup">setup()</a>\nor anywhere else with the use of a callback parameter.\n<br><br>\nBy default the text &quot;loading...&quot; will be displayed. To make your own\nloading page, include an HTML element with id &quot;p5_loading&quot; in your\npage. More information <a href="http://bit.ly/2kQ6Nio">here</a>.</p>\n',itemtype:"method",name:"preload",example:["\n<div><code>\nlet img;\nlet c;\nfunction preload() {\n  // preload() runs once\n  img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n  // setup() waits until preload() is done\n  img.loadPixels();\n  // get color of middle pixel\n  c = img.get(img.width / 2, img.height / 2);\n}\n\nfunction draw() {\n  background(c);\n  image(img, 25, 25, 50, 50);\n}\n</code></div>"],alt:"nothing displayed",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/main.js",line:83,description:'<p>The <a href="#/p5/setup">setup()</a> function is called once when the program starts. It&#39;s used to\ndefine initial environment properties such as screen size and background\ncolor and to load media such as images and fonts as the program starts.\nThere can only be one <a href="#/p5/setup">setup()</a> function for each program and it shouldn&#39;t\nbe called again after its initial execution.\n<br><br>\nNote: Variables declared within <a href="#/p5/setup">setup()</a> are not accessible within other\nfunctions, including <a href="#/p5/draw">draw()</a>.</p>\n',itemtype:"method",name:"setup",example:["\n<div><code>\nlet a = 0;\n\nfunction setup() {\n  background(0);\n  noStroke();\n  fill(102);\n}\n\nfunction draw() {\n  rect(a++ % width, 10, 2, 80);\n}\n</code></div>"],alt:"nothing displayed",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/main.js",line:114,description:'<p>Called directly after <a href="#/p5/setup">setup()</a>, the <a href="#/p5/draw">draw()</a> function continuously executes\nthe lines of code contained inside its block until the program is stopped\nor <a href="#/p5/noLoop">noLoop()</a> is called. Note if <a href="#/p5/noLoop">noLoop()</a>
21 is called in <a href="#/p5/setup">setup()</a>, <a href="#/p5/draw">draw()</a> will\nstill be executed once before stopping. <a href="#/p5/draw">draw()</a> is called automatically and\nshould never be called explicitly.\n<br><br>\nIt should always be controlled with <a href="#/p5/noLoop">noLoop()</a>, <a href="#/p5/redraw">redraw()</a> and <a href="#/p5/loop">loop()</a>. After\n<a href="#/p5/noLoop">noLoop()</a> stops the code in <a href="#/p5/draw">draw()</a> from executing, <a href="#/p5/redraw">redraw()</a> causes the\ncode inside <a href="#/p5/draw">draw()</a> to execute once, and <a href="#/p5/loop">loop()</a> will cause the code\ninside <a href="#/p5/draw">draw()</a> to resume executing continuously.\n<br><br>\nThe number of times <a href="#/p5/draw">draw()</a> executes in each second may be controlled with\nthe <a href="#/p5/frameRate">frameRate()</a> function.\n<br><br>\nThere can only be one <a href="#/p5/draw">draw()</a> function for each sketch, and <a href="#/p5/draw">draw()</a> must\nexist if you want the code to run continuously, or to process events such\nas <a href="#/p5/mousePressed">mousePressed()</a>. Sometimes, you might have an empty call to <a href="#/p5/draw">draw()</a> in\nyour program, as shown in the above example.\n<br><br>\nIt is important to note that the drawing coordinate system will be reset\nat the beginning of each <a href="#/p5/draw">draw()</a> call. If any transformations are performed\nwithin <a href="#/p5/draw">draw()</a> (ex: scale, rotate, translate), their effects will be\nundone at the beginning of <a href="#/p5/draw">draw()</a>, so transformations will not accumulate\nover time. On the other hand, styling applied (ex: fill, stroke, etc) will\nremain in effect.</p>\n',itemtype:"method",name:"draw",example:["\n<div><code>\nlet yPos = 0;\nfunction setup() {\n  // setup() runs once\n  frameRate(30);\n}\nfunction draw() {\n  // draw() loops forever, until stopped\n  background(204);\n  yPos = yPos - 1;\n  if (yPos < 0) {\n    yPos = height;\n  }\n  line(0, yPos, width, yPos);\n}\n</code></div>"],alt:"nothing displayed",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/main.js",line:396,description:"<p>Removes the entire p5 sketch. This will remove the canvas and any\nelements created by p5.js. It will also stop the draw loop and unbind\nany properties or methods from the window global scope. It will\nleave a variable p5 in case you wanted to create a new p5 sketch.\nIf you like, you can set p5 = null to erase it. While all functions and\nvariables and objects created by the p5 library will be removed, any\nother global variables created by your code will remain.</p>\n",itemtype:"method",name:"remove",example:["\n<div class='norender'><code>\nfunction draw() {\n  ellipse(50, 50, 10, 10);\n}\n\nfunction mousePressed() {\n  remove(); // remove whole sketch on mouse press\n}\n</code></div>"],alt:"nothing displayed",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/main.js",line:577,description:"<p>Allows for the friendly error system (FES) to be turned off when creating a sketch,\nwhich can give a significant boost to performance when needed.\nSee <a href='https://github.com/processing/p5.js/wiki/Optimizing-p5.js-Code-for-Performance#disable-the-friendly-error-system-fes'>\ndisabling the friendly error system</a>.</p>\n",itemtype:"property",name:"disableFriendlyErrors",type:"Boolean",example:['\n<div class="norender notest"><code>\np5.disableFriendlyErrors = true;\n\nfunction setup() {\n  createCanvas(100, 50);\n}\n</code></div>'],class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/p5.Element.js",line:26,description:"<p>Underlying HTML element. All normal HTML methods can be called on this.</p>\n",example:["\n<div>\n<code>\nfunction setup() {\n  let c = createCanvas(50, 50);\n  c.elt.style.border = '5px solid red';\n}\n\nfunction draw() {\n  background(220);\n}\n</code>\n</div>"],itemtype:"property",name:"elt",readonly:"",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:52,description:"<p>Attaches the element to the parent specified. A way of setting\n the container for the element. Accepts either a string ID, DOM\n node, or <a href=\"#/p5.Element\">p5.Element</a>. If no arguments given, parent node is returned.\n For more ways to position the canvas, see the\n <a href='https://github.com/processing/p5.js/wiki/Positioning-your-canvas'>\n positioning the canvas</a> wiki page.\nAll above examples except for the first one require the inclusion of\n the p5.dom library in your index.html. See the\n <a href='http://p5js.org/libraries/#using-a-library'>using a library</a>\n section for information on how to include this library.</p>\n",itemtype:"method",name:"parent",chainable:1,example:["\n <div class=\"norender notest\"><code>\n // in the html file:\n // &lt;div id=\"myContainer\">&lt;/div>\n// in the js file:\n let cnv = createCanvas(100, 100);\n cnv.parent('myContainer');\n </code></div>\n <div class='norender'><code>\n let div0 = createDiv('this is the parent');\n let div1 = createDiv('this is the child');\n div1.parent(div0); // use p5.Element\n </code></div>\n <div class='norender'><code>\n let div0 = createDiv('this is the parent');\n div0.id('apples');\n let div1 = createDiv('this is the child');\n div1.parent('apples'); // use id\n </code></div>\n <div class='norender notest'><code>\n let elt = document.getElementById('myParentDiv');\n let div1 = createDiv('this is the child');\n div1.parent(elt);
21 // use element from page\n </code></div>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM",overloads:[{line:52,params:[{name:"parent",description:'<p>the ID, DOM node, or <a href="#/p5.Element">p5.Element</a>\n                         of desired parent element</p>\n',type:"String|p5.Element|Object"}],chainable:1},{line:100,params:[],return:{description:"",type:"p5.Element"}}]},{file:"src/core/p5.Element.js",line:122,description:'<p>Sets the ID of the element. If no ID argument is passed in, it instead\n returns the current ID of the element.\n Note that only one element can have a particular id in a page.\n The <a href="#/p5.Element/class">.class()</a> function can be used\n to identify multiple elements with the same class name.</p>\n',itemtype:"method",name:"id",chainable:1,example:["\n <div class='norender'><code>\n function setup() {\n   let cnv = createCanvas(100, 100);\n   // Assigns a CSS selector ID to\n   // the canvas element.\n   cnv.id('mycanvas');\n }\n </code></div>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM",overloads:[{line:122,params:[{name:"id",description:"<p>ID of the element</p>\n",type:"String"}],chainable:1},{line:147,params:[],return:{description:"the id of the element",type:"String"}}]},{file:"src/core/p5.Element.js",line:162,description:"<p>Adds given class to the element. If no class argument is passed in, it\n instead returns a string containing the current class(es) of the element.</p>\n",itemtype:"method",name:"class",chainable:1,example:["\n <div class='norender'><code>\n function setup() {\n   let cnv = createCanvas(100, 100);\n   // Assigns a CSS selector class 'small'\n   // to the canvas element.\n   cnv.class('small');\n }\n </code></div>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM",overloads:[{line:162,params:[{name:"class",description:"<p>class to add</p>\n",type:"String"}],chainable:1},{line:184,params:[],return:{description:"the class of the element",type:"String"}}]},{file:"src/core/p5.Element.js",line:197,description:'<p>The .<a href="#/p5.Element/mousePressed">mousePressed()</a> function is called once after every time a\nmouse button is pressed over the element.\nSome mobile browsers may also trigger this event on a touch screen,\nif the user performs a quick tap.\nThis can be used to attach element specific event listeners.</p>\n',itemtype:"method",name:"mousePressed",params:[{name:"fxn",description:"<p>function to be fired when mouse is\n                               pressed over the element.\n                               if <code>false</code> is passed instead, the previously\n                               firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:["\n<div class='norender'><code>\nlet cnv;\nlet d;\nlet g;\nfunction setup() {\n  cnv = createCanvas(100, 100);\n  cnv.mousePressed(changeGray); // attach listener for\n  // canvas click only\n  d = 10;\n  g = 100;\n}\n\nfunction draw() {\n  background(g);\n  ellipse(width / 2, height / 2, d, d);\n}\n\n// this function fires with any click anywhere\nfunction mousePressed() {\n  d = d + 10;\n}\n\n// this function fires only when cnv is clicked\nfunction changeGray() {\n  g = random(0, 255);\n}\n</code></div>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:258,description:'<p>The .<a href="#/p5.Element/doubleClicked">doubleClicked()</a> function is called once after every time a\nmouse button is pressed twice over the element. This can be used to\nattach element and action specific event listeners.</p>\n',itemtype:"method",name:"doubleClicked",params:[{name:"fxn",description:"<p>function to be fired when mouse is\n                               double clicked over the element.\n                               if <code>false</code> is passed instead, the previously\n                               firing function will no longer fire.</p>\n",type:"Function|Boolean"}],return:{description:"",type:"p5.Element"},example:["\n<div class='norender'><code>\nlet cnv;\nlet d;\nlet g;\nfunction setup() {\n  cnv = createCanvas(100, 100);\n  cnv.doubleClicked(changeGray); // attach listener for\n  // canvas double click only\n  d = 10;\n  g = 100;\n}\n\nfunction draw() {\n  background(g);\n  ellipse(width / 2, height / 2, d, d);\n}
21\n\n// this function fires with any double click anywhere\nfunction doubleClicked() {\n  d = d + 10;\n}\n\n// this function fires only when cnv is double clicked\nfunction changeGray() {\n  g = random(0, 255);\n}\n</code></div>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:307,description:'<p>The .<a href="#/p5.Element/mouseWheel">mouseWheel()</a> function is called once after every time a\nmouse wheel is scrolled over the element. This can be used to\nattach element specific event listeners.\n<br><br>\nThe function accepts a callback function as argument which will be executed\nwhen the <code>wheel</code> event is triggered on the element, the callback function is\npassed one argument <code>event</code>. The <code>event.deltaY</code> property returns negative\nvalues if the mouse wheel is rotated up or away from the user and positive\nin the other direction. The <code>event.deltaX</code> does the same as <code>event.deltaY</code>\nexcept it reads the horizontal wheel scroll of the mouse wheel.\n<br><br>\nOn OS X with &quot;natural&quot; scrolling enabled, the <code>event.deltaY</code> values are\nreversed.</p>\n',itemtype:"method",name:"mouseWheel",params:[{name:"fxn",description:"<p>function to be fired when mouse is\n                               scrolled over the element.\n                               if <code>false</code> is passed instead, the previously\n                               firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:["\n<div class='norender'><code>\nlet cnv;\nlet d;\nlet g;\nfunction setup() {\n  cnv = createCanvas(100, 100);\n  cnv.mouseWheel(changeSize); // attach listener for\n  // activity on canvas only\n  d = 10;\n  g = 100;\n}\n\nfunction draw() {\n  background(g);\n  ellipse(width / 2, height / 2, d, d);\n}\n\n// this function fires with mousewheel movement\n// anywhere on screen\nfunction mouseWheel() {\n  g = g + 10;\n}\n\n// this function fires with mousewheel movement\n// over canvas only\nfunction changeSize(event) {\n  if (event.deltaY > 0) {\n    d = d + 10;\n  } else {\n    d = d - 10;\n  }\n}\n</code></div>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:373,description:'<p>The .<a href="#/p5.Element/mouseReleased">mouseReleased()</a> function is called once after every time a\nmouse button is released over the element.\nSome mobile browsers may also trigger this event on a touch screen,\nif the user performs a quick tap.\nThis can be used to attach element specific event listeners.</p>\n',itemtype:"method",name:"mouseReleased",params:[{name:"fxn",description:"<p>function to be fired when mouse is\n                               released over the element.\n                               if <code>false</code> is passed instead, the previously\n                               firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:["\n<div class='norender'><code>\nlet cnv;\nlet d;\nlet g;\nfunction setup() {\n  cnv = createCanvas(100, 100);\n  cnv.mouseReleased(changeGray); // attach listener for\n  // activity on canvas only\n  d = 10;\n  g = 100;\n}\n\nfunction draw() {\n  background(g);\n  ellipse(width / 2, height / 2, d, d);\n}\n\n// this function fires after the mouse has been\n// released\nfunction mouseReleased() {\n  d = d + 10;\n}\n\n// this function fires after the mouse has been\n// released while on canvas\nfunction changeGray() {\n  g = random(0, 255);\n}\n</code></div>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:427,description:'<p>The .<a href="#/p5.Element/mouseClicked">mouseClicked()</a> function is called once after a mouse button is\npressed and released over the element.\nSome mobile browsers may also trigger this event on a touch screen,\nif the user performs a quick tap.\nThis can be used to attach element specific event listeners.</p>\n',itemtype:"method",name:"mouseClicked",params:[{name:"fxn",description:"<p>function to be fired when mouse is\n                               clicked over the element.\n                               if <code>false</code> is passed instead, the previously\n                               firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:['\n<div class="norender">\n<code>\nlet cnv;\nlet d;\nlet g;\n\nfunction setup() {\n  cnv = createCanvas(100, 100);\n  cnv.mouseClicked(changeGray); // attach listener for\n  // activity on canvas only\n  d = 10;\n  g = 100;\n}\n\nfunction draw() {\n  background(g);\n  ellipse(width / 2, height / 2, d, d);\n}\n\n// this function fires after the mouse has been\n// clicked anywhere\nfunction mouseClicked() {\n  d = d + 10;\n}\n\n// this function fires after the mouse has been\n// clicked on canvas\nfunction changeGray() {\n  g = random(0, 255);\n}\n</code>\n</div>'],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"}
21,{file:"src/core/p5.Element.js",line:483,description:'<p>The .<a href="#/p5.Element/mouseMoved">mouseMoved()</a> function is called once every time a\nmouse moves over the element. This can be used to attach an\nelement specific event listener.</p>\n',itemtype:"method",name:"mouseMoved",params:[{name:"fxn",description:"<p>function to be fired when a mouse moves\n                               over the element.\n                               if <code>false</code> is passed instead, the previously\n                               firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:["\n<div class='norender'><code>\nlet cnv;\nlet d = 30;\nlet 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:541,description:'<p>The .<a href="#/p5.Element/mouseOver">mouseOver()</a> 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>\nlet cnv;\nlet d;\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:584,description:'<p>The .<a href="#/p5.Element/mouseOut">mouseOut()</a> function is called once after every time a\nmouse moves off the element. This can be used to attach an\nelement specific event listener.</p>\n',itemtype:"method",name:"mouseOut",params:[{name:"fxn",description:"<p>function to be fired when a mouse\n                               moves off of an element.\n                               if <code>false</code> is passed instead, the previously\n                               firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:["\n<div class='norender'><code>\nlet cnv;\nlet d;\nfunction setup() {\n  cnv = createCanvas(100, 100);\n  cnv.mouseOut(changeGray);\n  d = 10;\n}\n\nfunction draw() {\n  ellipse(width / 2, height / 2, d, d);\n}\n\nfunction changeGray() {\n  d = d + 10;\n  if (d > 100) {\n    d = 0;\n  }\n}\n</code></div>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:626,description:'<p>The .<a href="#/p5.Element/touchStarted">touchStarted()</a> function is called once after every time a touch is\nregistered. This can be used to attach element specific event listeners.</p>\n',itemtype:"method",name:"touchStarted",params:[{name:"fxn",description:"<p>function to be fired when a touch\n                               starts over the element.\n                               if <code>false</code> is passed instead, the previously\n                               firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:["\n<div class='norender'><code>\nlet cnv;\nlet d;\nlet g;\nfunction setup() {\n  cnv = createCanvas(100, 100);\n  cnv.touchStarted(changeGray); // attach listener for\n  // canvas click only\n  d = 10;\n  g = 100;\n}\n\nfunction draw() {\n  background(g);\n  ellipse(width / 2, height / 2, d, d);\n}\n\n// this function fires with any touch anywhere\nfunction touchStarted() {\
21n  d = d + 10;\n}\n\n// this function fires only when cnv is clicked\nfunction changeGray() {\n  g = random(0, 255);\n}\n</code></div>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:674,description:'<p>The .<a href="#/p5.Element/touchMoved">touchMoved()</a> function is called once after every time a touch move is\nregistered. This can be used to attach element specific event listeners.</p>\n',itemtype:"method",name:"touchMoved",params:[{name:"fxn",description:"<p>function to be fired when a touch moves over\n                               the element.\n                               if <code>false</code> is passed instead, the previously\n                               firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:["\n<div class='norender'><code>\nlet cnv;\nlet g;\nfunction setup() {\n  cnv = createCanvas(100, 100);\n  cnv.touchMoved(changeGray); // attach listener for\n  // canvas click only\n  g = 100;\n}\n\nfunction draw() {\n  background(g);\n}\n\n// this function fires only when cnv is clicked\nfunction changeGray() {\n  g = random(0, 255);\n}\n</code></div>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:714,description:'<p>The .<a href="#/p5.Element/touchEnded">touchEnded()</a> function is called once after every time a touch is\nregistered. This can be used to attach element specific event listeners.</p>\n',itemtype:"method",name:"touchEnded",params:[{name:"fxn",description:"<p>function to be fired when a touch ends\n                               over the element.\n                               if <code>false</code> is passed instead, the previously\n                               firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:["\n<div class='norender'><code>\nlet cnv;\nlet d;\nlet g;\nfunction setup() {\n  cnv = createCanvas(100, 100);\n  cnv.touchEnded(changeGray); // attach listener for\n  // canvas click only\n  d = 10;\n  g = 100;\n}\n\nfunction draw() {\n  background(g);\n  ellipse(width / 2, height / 2, d, d);\n}\n\n// this function fires with any touch anywhere\nfunction touchEnded() {\n  d = d + 10;\n}\n\n// this function fires only when cnv is clicked\nfunction changeGray() {\n  g = random(0, 255);\n}\n</code></div>"],alt:"no display.",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:763,description:'<p>The .<a href="#/p5.Element/dragOver">dragOver()</a> function is called once after every time a\nfile is dragged over the element. This can be used to attach an\nelement specific event listener.</p>\n',itemtype:"method",name:"dragOver",params:[{name:"fxn",description:"<p>function to be fired when a file is\n                               dragged over the element.\n                               if <code>false</code> is passed instead, the previously\n                               firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:["\n<div><code>\n// To test this sketch, simply drag a\n// file over the canvas\nfunction setup() {\n  let c = createCanvas(100, 100);\n  background(200);\n  textAlign(CENTER);\n  text('Drag file', width / 2, height / 2);\n  c.dragOver(dragOverCallback);\n}\n\n// This function will be called whenever\n// a file is dragged over the canvas\nfunction dragOverCallback() {\n  background(240);\n  text('Dragged over', width / 2, height / 2);\n}\n</code></div>"],alt:"nothing displayed",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:801,description:"<p>The .dragLeave() function is called once after every time a\ndragged file leaves the element area. This can be used to attach an\nelement specific event listener.</p>\n",itemtype:"method",name:"dragLeave",params:[{name:"fxn",description:"<p>function to be fired when a file is\n                               dragged off the element.\n                               if <code>false</code> is passed instead, the previously\n                               firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:["\n<div><code>\n// To test this sketch, simply drag a file\n// over and then out of the canvas area\nfunction setup() {\n  let c = createCanvas(100, 100);\n  background(200);\n  textAlign(CENTER);\n  text('Drag file', width / 2, height / 2);\n  c.dragLeave(dragLeaveCallback);\n}\n\n// This function will be called whenever\n// a file is dragged out of the canvas\nfunction dragLeaveCallback() {\n  background(240);\n  text('Dragged off', width / 2, height / 2);\n}\n</code></div>"],alt:"nothing displayed",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Element.js",line:865,description:"<p>Helper fxn for sharing pixel methods</p>\n",class:"p5.Element",module:"DOM",submodule:"DOM"},{file:"src/core/p5.Graphics.js",line:65,description:"<p>Resets certain values such as those modified by functions in the Transform category\nand in the Lights category that are not automatically reset\nwith graphics buffer objects. Calling this in <a href='#/p5/draw'>draw()</a> will copy the behavior\nof the standard canvas.</p>\n",itemtype:"method",name:"reset",example:["\n\n<div><code>\nlet pg;\nfunction setup() {\n  createCanvas(100, 100);\n  background(0);\n  pg = createGraphics(50, 100);\n  pg.fill(0);\n  frameRate(5);\n}\nfunction draw() {\n  image(pg, width / 2, 0);\n  pg.background(255);\n  // p5.Graphics object behave a bit differently in some cases\n  // The normal canvas on the left resets the translate\n  // with every loop through draw()\n  // the graphics object on the right doesn't automatically reset\n  // so translate() is additive and it moves down the screen\n  rect(0, 0, width / 2, 5);\n  pg.rect(0, 0, width / 2, 5);\n  translate(0, 5, 0);\n  pg.translate(0, 5, 0);\n}\nfunction mouseClicked() {\n  // if you click you will see that\n  // reset() resets the translate back to the initial state\n  // of the Graphics object\n  pg.reset();\n}\n</code></div>"],alt:"A white line on a black background stays still on the top-left half.\nA black line animates from top to bottom on a white background on the right half.\nWhen clicked, the black line starts back over at the top.",class:"p5.Graphics",module:"Rendering",submodule:"Rendering"},{file:"src/core/p5.Graphics.js",line:117,description:"<p>Removes a Graphics object from the page and frees any resources\nassociated with it.</p>\n",itemtype:"method",name:"remove",example:["\n<div class='norender'><code>\nlet bg;\nfunction setup() {\n  bg = createCanvas(100, 100);\n  bg.background(0);\n  image(bg, 0, 0);\n  bg.remove();\n}\n</code></div>\n\n<div><code>\nlet bg;\nfunction setup() {\n  pixelDensity(1);\n  createCanvas(100, 100);
21\n  stroke(255);\n  fill(0);\n\n  // create and draw the background image\n  bg = createGraphics(100, 100);\n  bg.background(200);\n  bg.ellipse(50, 50, 80, 80);\n}\nfunction draw() {\n  let t = millis() / 1000;\n  // draw the background\n  if (bg) {\n    image(bg, frameCount % 100, 0);\n    image(bg, frameCount % 100 - 100, 0);\n  }\n  // draw the foreground\n  let p = p5.Vector.fromAngle(t, 35).add(50, 50);\n  ellipse(p.x, p.y, 30);\n}\nfunction mouseClicked() {\n  // remove the background\n  if (bg) {\n    bg.remove();\n    bg = null;\n  }\n}\n</code></div>"],alt:"no image\na multi-colored circle moving back and forth over a scrolling background.",class:"p5.Graphics",module:"Rendering",submodule:"Rendering"},{file:"src/core/p5.Renderer.js",line:97,description:"<p>Resize our canvas element.</p>\n",class:"p5.Renderer",module:"Rendering",submodule:"Rendering"},{file:"src/core/p5.Renderer.js",line:335,description:"<p>Helper fxn to check font type (system or otf)</p>\n",class:"p5.Renderer",module:"Rendering",submodule:"Rendering"},{file:"src/core/p5.Renderer.js",line:388,description:'<p>Helper fxn to measure ascent and descent.\nAdapted from <a href="http://stackoverflow.com/a/25355178">http://stackoverflow.com/a/25355178</a></p>\n',class:"p5.Renderer",module:"Rendering",submodule:"Rendering"},{file:"src/core/p5.Renderer2D.js",line:9,description:"<p>p5.Renderer2D\nThe 2D graphics canvas renderer class.\nextends p5.Renderer</p>\n",class:"p5",module:"Rendering"},{file:"src/core/p5.Renderer2D.js",line:407,description:'<p>Generate a cubic Bezier representing an arc on the unit circle of total\nangle <code>size</code> radians, beginning <code>start</code> radians above the x-axis. Up to\nfour of these curves are combined to make a full arc.</p>\n<p>See <a href="http://www.joecridge.me/bezier.pdf">www.joecridge.me/bezier.pdf</a> for an explanation of the method.</p>\n',class:"p5",module:"Rendering"},{file:"src/core/rendering.js",line:17,description:'<p>Creates a canvas element in the document, and sets the dimensions of it\nin pixels. This method should be called only once at the start of setup.\nCalling <a href="#/p5/createCanvas">createCanvas</a> more than once in a sketch will result in very\nunpredictable behavior. If you want more than one drawing canvas\nyou could use <a href="#/p5/createGraphics">createGraphics</a> (hidden by default but it can be shown).\n<br><br>\nThe system variables width and height are set by the parameters passed\nto this function. If <a href="#/p5/createCanvas">createCanvas()</a> is not used, the window will be\ngiven a default size of 100x100 pixels.\n<br><br>\nFor more ways to position the canvas, see the\n<a href=\'https://github.com/processing/p5.js/wiki/Positioning-your-canvas\'>\npositioning the canvas</a> wiki page.</p>\n',itemtype:"method",name:"createCanvas",params:[{name:"w",description:"<p>width of the canvas</p>\n",type:"Number"},{name:"h",description:"<p>height of the canvas</p>\n",type:"Number"},{name:"renderer",description:"<p>either P2D or WEBGL</p>\n",type:"Constant",optional:!0}],return:{description:"",type:"p5.Renderer"},example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 50);\n  background(153);\n  line(0, 0, width, height);\n}\n</code>\n</div>"],alt:"Black line extending from top-left of canvas to bottom right.",class:"p5",module:"Rendering",submodule:"Rendering"},{file:"src/core/rendering.js",line:119,description:"<p>Resizes the canvas to given width and height. The canvas will be cleared\nand draw will be called immediately, allowing the sketch to re-render itself\nin the resized canvas.</p>\n",itemtype:"method",name:"resizeCanvas",params:[{name:"w",description:"<p>width of the canvas</p>\n",type:"Number"},{name:"h",description:"<p>height of the canvas</p>\n",type:"Number"},{name:"noRedraw",description:"<p>don&#39;t redraw the canvas immediately</p>\n",type:"Boolean",optional:!0}],example:['\n<div class="norender"><code>\nfunction setup() {\n  createCanvas(windowWidth, windowHeight);\n}\n\nfunction draw() {\n  background(0, 100, 200);\n}\n\nfunction windowResized() {\n  resizeCanvas(windowWidth, windowHeight);\n}\n</code></div>'],alt:"No image displayed.",class:"p5",module:"Rendering",submodule:"Rendering"}
21,{file:"src/core/rendering.js",line:174,description:"<p>Removes the default canvas for a p5 sketch that doesn&#39;t\nrequire a canvas</p>\n",itemtype:"method",name:"noCanvas",example:["\n<div>\n<code>\nfunction setup() {\n  noCanvas();\n}\n</code>\n</div>"],alt:"no image displayed",class:"p5",module:"Rendering",submodule:"Rendering"},{file:"src/core/rendering.js",line:197,description:"<p>Creates and returns a new p5.Renderer object. Use this class if you need\nto draw into an off-screen graphics buffer. The two parameters define the\nwidth and height in pixels.</p>\n",itemtype:"method",name:"createGraphics",params:[{name:"w",description:"<p>width of the offscreen graphics buffer</p>\n",type:"Number"},{name:"h",description:"<p>height of the offscreen graphics buffer</p>\n",type:"Number"},{name:"renderer",description:"<p>either P2D or WEBGL\nundefined defaults to p2d</p>\n",type:"Constant",optional:!0}],return:{description:"offscreen graphics buffer",type:"p5.Graphics"},example:["\n<div>\n<code>\nlet pg;\nfunction setup() {\n  createCanvas(100, 100);\n  pg = createGraphics(100, 100);\n}\nfunction draw() {\n  background(200);\n  pg.background(100);\n  pg.noStroke();\n  pg.ellipse(pg.width / 2, pg.height / 2, 50, 50);\n  image(pg, 50, 50);\n  image(pg, 0, 0, 50, 50);\n}\n</code>\n</div>"],alt:"4 grey squares alternating light and dark grey. White quarter circle mid-left.",class:"p5",module:"Rendering",submodule:"Rendering"},{file:"src/core/rendering.js",line:236,description:"<p>Blends the pixels in the display window according to the defined mode.\nThere is a choice of the following modes to blend the source pixels (A)\nwith the ones of pixels already in the display window (B):</p>\n<p><ul></p>\n<p><li><code>BLEND</code> - linear interpolation of colours: C =\nA*factor + B. <b>This is the default blending mode.</b></li></p>\n<p><li><code>ADD</code> - sum of A and B</li></p>\n<p><li><code>DARKEST</code> - only the darkest colour succeeds: C =\nmin(A*factor, B).</li></p>\n<p><li><code>LIGHTEST</code> - only the lightest colour succeeds: C =\nmax(A*factor, B).</li></p>\n<p><li><code>DIFFERENCE</code> - subtract colors from underlying image.</li></p>\n<p><li><code>EXCLUSION</code> - similar to <code>DIFFERENCE</code>, but less\nextreme.</li></p>\n<p><li><code>MULTIPLY</code> - multiply the colors, result will always be\ndarker.</li></p>\n<p><li><code>SCREEN</code> - opposite multiply, uses inverse values of the\ncolors.</li></p>\n<p><li><code>REPLACE</code> - the pixels entirely replace the others and\ndon&#39;t utilize alpha (transparency) values.</li></p>\n<p><li><code>OVERLAY</code> - mix of <code>MULTIPLY</code> and <code>SCREEN\n</code>. Multiplies dark values, and screens light values. <em>(2D)</em></li></p>\n<p><li><code>HARD_LIGHT</code> - <code>SCREEN</code> when greater than 50%\ngray, <code>MULTIPLY</code> when lower. <em>(2D)</em></li></p>\n<p><li><code>SOFT_LIGHT</code> - mix of <code>DARKEST</code> and\n<code>LIGHTEST</code>. Works like <code>OVERLAY</code>, but not as harsh. <em>(2D)</em>\n</li></p>\n<p><li><code>DODGE</code> - lightens light tones and increases contrast,\nignores darks. <em>(2D)</em></li></p>\n<p><li><code>BURN</code> - darker areas are applied, increasing contrast,\nignores lights. <em>(2D)</em></li></p>\n<p><li><code>SUBTRACT</code> - remainder of A and B <em>(3D)</em></li>\n</ul>\n<br><br>\n<em>(2D)</em> indicates that this blend mode <b>only</b> works in the 2D renderer.<br>\n<em>(3D)</em> indicates that this blend mode <b>only</b> works in the WEBGL renderer.</p>\n",itemtype:"method",name:"blendMode",params:[{name:"mode",description:"<p>blend mode to set for canvas.\n               either BLEND, DARKEST, LIGHTEST, DIFFERENCE, MULTIPLY,\n               EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\n               SOFT_LIGHT, DODGE, BURN, ADD, or SUBTRACT</p>\n",type:"Constant"}],example:["\n<div>\n<code>\nblendMode(LIGHTEST);\nstrokeWeight(30);\nstroke(80, 150, 255);\nline(25, 25, 75, 75);\nstroke(255, 50, 50);\nline(75, 25, 25, 75);\n</code>\n</div>\n<div>\n<code>\nblendMode(MULTIPLY);\nstrokeWeight(30);\nstroke(80, 150, 255);\nline(25, 25, 75, 75);\nstroke(255, 50, 50);\nline(75, 25, 25, 75);\n</code>\n</div>"],alt:"translucent image thick red & blue diagonal rounded lines intersecting center\nThick red & blue diagonal rounded lines intersecting center. dark at overlap",class:"p5",module:"Rendering",submodule:"Rendering"},{file:"src/core/shim.js",line:23,description:'<p>shim for Uint8ClampedArray.slice\n(allows arrayCopy to work with pixels[])\nwith thanks to <a href="http://halfpapstudios.com/blog/tag/html5-canvas/">http://halfpapstudios.com/blog/tag/html5-canvas/</a>\nEnumerable set to false to protect for...in from\nUint8ClampedArray.prototype pollution.</p>\n',class:"p5",module:"Rendering"},{file:"src/core/shim.js",line:45,description:'<p>this is implementation of Object.assign() which is unavailable in\nIE11 and (non-Chrome) Android browsers.\nThe assign() method is used to copy the values of all enumerable\nown properties from one or more source objects to a target object.\nIt will return the target object.\nModified from <a href="https://github.com/ljharb/object.assign">https://github.com/ljharb/object.assign</a></p>\n',class:"p5",module:"Rendering"},{file:"src/core/structure.js",line:12,description:'<p>Stops p5.js from continuously executing the code within <a href="#/p5/draw">draw()</a>.\nIf <a href="#/p5/loop">loop()</a> is called, the code in <a href="#/p5/draw">draw()</a>
21 begins to run continuously again.\nIf using <a href="#/p5/noLoop">noLoop()</a> in <a href="#/p5/setup">setup()</a>, it should be the last line inside the block.\n<br><br>\nWhen <a href="#/p5/noLoop">noLoop()</a> is used, it&#39;s not possible to manipulate or access the\nscreen inside event handling functions such as <a href="#/p5/mousePressed">mousePressed()</a> or\n<a href="#/p5/keyPressed">keyPressed()</a>. Instead, use those functions to call <a href="#/p5/redraw">redraw()</a> or <a href="#/p5/loop">loop()</a>,\nwhich will run <a href="#/p5/draw">draw()</a>, which can update the screen properly. This means\nthat when <a href="#/p5/noLoop">noLoop()</a> has been called, no drawing can happen, and functions\nlike <a href="#/p5/saveFrame">saveFrame()</a> or <a href="#/p5/loadPixels">loadPixels()</a> may not be used.\n<br><br>\nNote that if the sketch is resized, <a href="#/p5/redraw">redraw()</a> will be called to update\nthe sketch, even after <a href="#/p5/noLoop">noLoop()</a> has been specified. Otherwise, the sketch\nwould enter an odd state until <a href="#/p5/loop">loop()</a> was called.</p>\n',itemtype:"method",name:"noLoop",example:["\n<div><code>\nfunction setup() {\n  createCanvas(100, 100);\n  background(200);\n  noLoop();\n}\n\nfunction draw() {\n  line(10, 10, 90, 90);\n}\n</code></div>\n\n<div><code>\nlet x = 0;\nfunction setup() {\n  createCanvas(100, 100);\n}\n\nfunction draw() {\n  background(204);\n  x = x + 0.1;\n  if (x > width) {\n    x = 0;\n  }\n  line(x, 0, x, height);\n}\n\nfunction mousePressed() {\n  noLoop();\n}\n\nfunction mouseReleased() {\n  loop();\n}\n</code></div>"],alt:"113 pixel long line extending from top-left to bottom right of canvas.\nhorizontal line moves slowly from left. Loops but stops on mouse press.",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/structure.js",line:74,description:'<p>By default, p5.js loops through draw() continuously, executing the code\nwithin it. However, the <a href="#/p5/draw">draw()</a> loop may be stopped by calling <a href="#/p5/noLoop">noLoop()</a>.\nIn that case, the <a href="#/p5/draw">draw()</a> loop can be resumed with loop().</p>\n<p>Avoid calling loop() from inside setup().</p>\n',itemtype:"method",name:"loop",example:["\n<div><code>\nlet x = 0;\nfunction setup() {\n  createCanvas(100, 100);\n  noLoop();\n}\n\nfunction draw() {\n  background(204);\n  x = x + 0.1;\n  if (x > width) {\n    x = 0;\n  }\n  line(x, 0, x, height);\n}\n\nfunction mousePressed() {\n  loop();\n}\n\nfunction mouseReleased() {\n  noLoop();\n}\n</code></div>"],alt:"horizontal line moves slowly from left. Loops but stops on mouse press.",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/structure.js",line:122,description:'<p>The <a href="#/p5/push">push()</a> function saves the current drawing style settings and\ntransformations, while <a href="#/p5/pop">pop()</a> restores these settings. Note that these\nfunctions are always used together. They allow you to change the style\nand transformation settings and later return to what you had. When a new\nstate is started with <a href="#/p5/push">push()</a>, it builds on the current style and transform\ninformation. The <a href="#/p5/push">push()</a> and <a href="#/p5/pop">pop()</a> functions can be embedded to provide\nmore control. (See the second example for a demonstration.)\n<br><br>\n<a href="#/p5/push">push()</a> stores information related to the current transformation state\nand style settings controlled by the following functions: <a href="#/p5/fill">fill()</a>,\n<a href="#/p5/stroke">stroke()</a>, <a href="#/p5/tint">tint()</a>, <a href="#/p5/strokeWeight">
21strokeWeight()</a>, <a href="#/p5/strokeCap">strokeCap()</a>, <a href="#/p5/strokeJoin">strokeJoin()</a>,\n<a href="#/p5/imageMode">imageMode()</a>, <a href="#/p5/rectMode">rectMode()</a>, <a href="#/p5/ellipseMode">ellipseMode()</a>, <a href="#/p5/colorMode">colorMode()</a>, <a href="#/p5/textAlign">textAlign()</a>,\n<a href="#/p5/textFont">textFont()</a>, <a href="#/p5/textSize">textSize()</a>, <a href="#/p5/textLeading">textLeading()</a>.\n<br><br>\nIn WEBGL mode additional style settings are stored. These are controlled by the following functions: <a href="#/p5/setCamera">setCamera()</a>, <a href="#/p5/ambientLight">ambientLight()</a>, <a href="#/p5/directionalLight">directionalLight()</a>,\n<a href="#/p5/pointLight">pointLight()</a>, <a href="#/p5/texture">texture()</a>, <a href="#/p5/specularMaterial">specularMaterial()</a>, <a href="#/p5/shininess">shininess()</a>, <a href="#/p5/normalMaterial">normalMaterial()</a>\nand <a href="#/p5/shader">shader()</a>.</p>\n',itemtype:"method",name:"push",example:["\n<div>\n<code>\nellipse(0, 50, 33, 33); // Left circle\n\npush(); // Start a new drawing state\nstrokeWeight(10);\nfill(204, 153, 0);\ntranslate(50, 0);\nellipse(0, 50, 33, 33); // Middle circle\npop(); // Restore original state\n\nellipse(100, 50, 33, 33); // Right circle\n</code>\n</div>\n<div>\n<code>\nellipse(0, 50, 33, 33); // Left circle\n\npush(); // Start a new drawing state\nstrokeWeight(10);\nfill(204, 153, 0);\nellipse(33, 50, 33, 33); // Left-middle circle\n\npush(); // Start another new drawing state\nstroke(0, 102, 153);\nellipse(66, 50, 33, 33); // Right-middle circle\npop(); // Restore previous state\n\npop(); // Restore original state\n\nellipse(100, 50, 33, 33); // Right circle\n</code>\n</div>"],alt:"Gold ellipse + thick black outline @center 2 white ellipses on left and right.\n2 Gold ellipses left black right blue stroke. 2 white ellipses on left+right.",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/structure.js",line:191,description:'<p>The <a href="#/p5/push">push()</a> function saves the current drawing style settings and\ntransformations, while <a href="#/p5/pop">pop()</a> restores these settings. Note that these\nfunctions are always used together. They allow you to change the style\nand transformation settings and later return to what you had. When a new\nstate is started with <a href="#/p5/push">push()</a>, it builds on the current style and transform\ninformation. The <a href="#/p5/push">push()</a> and <a href="#/p5/pop">pop()</a> functions can be embedded to provide\nmore control. (See the second example for a demonstration.)\n<br><br>\n<a href="#/p5/push">push()</a> stores information related to the current transformation state\nand style settings controlled by the following functions: <a href="#/p5/fill">fill()</a>,\n<a href="#/p5/stroke">stroke()</a>, <a href="#/p5/tint">tint()</a>, <a href="#/p5/strokeWeight">
21strokeWeight()</a>, <a href="#/p5/strokeCap">strokeCap()</a>, <a href="#/p5/strokeJoin">strokeJoin()</a>,\n<a href="#/p5/imageMode">imageMode()</a>, <a href="#/p5/rectMode">rectMode()</a>, <a href="#/p5/ellipseMode">ellipseMode()</a>, <a href="#/p5/colorMode">colorMode()</a>, <a href="#/p5/textAlign">textAlign()</a>,\n<a href="#/p5/textFont">textFont()</a>, <a href="#/p5/textSize">textSize()</a>, <a href="#/p5/textLeading">textLeading()</a>.\n<br><br>\nIn WEBGL mode additional style settings are stored. These are controlled by the following functions: <a href="#/p5/setCamera">setCamera()</a>, <a href="#/p5/ambientLight">ambientLight()</a>, <a href="#/p5/directionalLight">directionalLight()</a>,\n<a href="#/p5/pointLight">pointLight()</a>, <a href="#/p5/texture">texture()</a>, <a href="#/p5/specularMaterial">specularMaterial()</a>, <a href="#/p5/shininess">shininess()</a>, <a href="#/p5/normalMaterial">normalMaterial()</a>\nand <a href="#/p5/shader">shader()</a>.</p>\n',itemtype:"method",name:"pop",example:["\n<div>\n<code>\nellipse(0, 50, 33, 33); // Left circle\n\npush(); // Start a new drawing state\ntranslate(50, 0);\nstrokeWeight(10);\nfill(204, 153, 0);\nellipse(0, 50, 33, 33); // Middle circle\npop(); // Restore original state\n\nellipse(100, 50, 33, 33); // Right circle\n</code>\n</div>\n<div>\n<code>\nellipse(0, 50, 33, 33); // Left circle\n\npush(); // Start a new drawing state\nstrokeWeight(10);\nfill(204, 153, 0);\nellipse(33, 50, 33, 33); // Left-middle circle\n\npush(); // Start another new drawing state\nstroke(0, 102, 153);\nellipse(66, 50, 33, 33); // Right-middle circle\npop(); // Restore previous state\n\npop(); // Restore original state\n\nellipse(100, 50, 33, 33); // Right circle\n</code>\n</div>"],alt:"Gold ellipse + thick black outline @center 2 white ellipses on left and right.\n2 Gold ellipses left black right blue stroke. 2 white ellipses on left+right.",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/structure.js",line:261,description:'<p>Executes the code within <a href="#/p5/draw">draw()</a> one time. This functions allows the\n program to update the display window only when necessary, for example\n when an event registered by <a href="#/p5/mousePressed">mousePressed()</a> or <a href="#/p5/keyPressed">keyPressed()</a> occurs.\n <br><br>\n In structuring a program, it only makes sense to call <a href="#/p5/redraw">redraw()</a> within\n events such as <a href="#/p5/mousePressed">mousePressed()</a>. This is because <a href="#/p5/redraw">redraw()</a> does not run\n <a href="#/p5/draw">draw()</a> immediately (it only sets a flag that indicates an update is\n needed).\n <br><br>\n The <a href="#/p5/redraw">redraw()</a> function does not work properly when called inside <a href="#/p5/draw">draw()</a>.\n To enable/disable animations, use <a href="#/p5/loop">loop()</a> and <a href="#/p5/noLoop">noLoop()</a>.\n <br><br>\n In addition you can set the number of redraws per method call. Just\n add an integer as single parameter for the number of redraws.</p>\n',itemtype:"method",name:"redraw",params:[{name:"n",description:"<p>Redraw for n-times. The default value is 1.</p>\n",type:"Integer",optional:!0}],example:["\n <div><code>\n let x = 0;\nfunction setup() {\n   createCanvas(100, 100);\n   noLoop();\n }\nfunction draw() {\n   background(204);\n   line(x, 0, x, height);\n }\nfunction mousePressed() {\n   x += 1;\n   redraw();\n }\n </code></div>\n<div class='norender'><code>\n let x = 0;\nfunction setup() {\n   createCanvas(100, 100);\n   noLoop();\n }\nfunction draw() {\n   background(204);\n   x += 1;\n   line(x, 0, x, height);\n }\nfunction mousePressed() {\n   redraw(5);\n }\n </code></div>"],alt:"black line on far left of canvas\n black line on far left of canvas",class:"p5",module:"Structure",submodule:"Structure"},{file:"src/core/transform.js",line:13,description:'<p>Multiplies the current matrix by the one specified through the parameters.\nThis is a powerful operation that can perform the equivalent of translate,\nscale, shear and rotate all at once. You can learn more about transformation\nmatrices on <a href="https://en.wikipedia.org/wiki/Transformation_matrix">\nWikipedia</a>.</p>\n<p>The naming of the arguments here follows the naming of the <a href=\n"https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-transform">\nWHATWG specification</a> and corresponds to a\ntransformation matrix of the\nform:</p>\n<blockquote>\n<p><img style="max-width: 150px" src="assets/transformation-matrix.png"\nalt="The transformation matrix used when applyM
21atrix is called"/></p>\n</blockquote>\n',itemtype:"method",name:"applyMatrix",params:[{name:"a",description:"<p>numbers which define the 2x3 matrix to be multiplied</p>\n",type:"Number"},{name:"b",description:"<p>numbers which define the 2x3 matrix to be multiplied</p>\n",type:"Number"},{name:"c",description:"<p>numbers which define the 2x3 matrix to be multiplied</p>\n",type:"Number"},{name:"d",description:"<p>numbers which define the 2x3 matrix to be multiplied</p>\n",type:"Number"},{name:"e",description:"<p>numbers which define the 2x3 matrix to be multiplied</p>\n",type:"Number"},{name:"f",description:"<p>numbers which define the 2x3 matrix to be multiplied</p>\n",type:"Number"}],chainable:1,example:["\n<div>\n<code>\nfunction setup() {\n  frameRate(10);\n  rectMode(CENTER);\n}\n\nfunction draw() {\n  var step = frameCount % 20;\n  background(200);\n  // Equivalent to translate(x, y);\n  applyMatrix(1, 0, 0, 1, 40 + step, 50);\n  rect(0, 0, 50, 50);\n}\n</code>\n</div>\n<div>\n<code>\nfunction setup() {\n  frameRate(10);\n  rectMode(CENTER);\n}\n\nfunction draw() {\n  var step = frameCount % 20;\n  background(200);\n  translate(50, 50);\n  // Equivalent to scale(x, y);\n  applyMatrix(1 / step, 0, 0, 1 / step, 0, 0);\n  rect(0, 0, 50, 50);\n}\n</code>\n</div>\n<div>\n<code>\nfunction setup() {\n  frameRate(10);\n  rectMode(CENTER);\n}\n\nfunction draw() {\n  var step = frameCount % 20;\n  var angle = map(step, 0, 20, 0, TWO_PI);\n  var cos_a = cos(angle);\n  var sin_a = sin(angle);\n  background(200);\n  translate(50, 50);\n  // Equivalent to rotate(angle);\n  applyMatrix(cos_a, sin_a, -sin_a, cos_a, 0, 0);\n  rect(0, 0, 50, 50);\n}\n</code>\n</div>\n<div>\n<code>\nfunction setup() {\n  frameRate(10);\n  rectMode(CENTER);\n}\n\nfunction draw() {\n  var step = frameCount % 20;\n  var angle = map(step, 0, 20, -PI / 4, PI / 4);\n  background(200);\n  translate(50, 50);\n  // equivalent to shearX(angle);\n  var shear_factor = 1 / tan(PI / 2 - angle);\n  applyMatrix(1, 0, shear_factor, 1, 0, 0);\n  rect(0, 0, 50, 50);\n}\n</code>\n</div>\n<div modernizr='webgl'>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  noFill();\n}\n\nfunction draw() {\n  background(200);\n  rotateY(PI / 6);\n  stroke(153);\n  box(35);\n  var rad = millis() / 1000;\n  // Set rotation angles\n  var ct = cos(rad);\n  var st = sin(rad);\n  // Matrix for rotation around the Y axis\n  applyMatrix(  ct, 0.0,  st,  0.0,\n               0.0, 1.0, 0.0,  0.0,\n               -st, 0.0,  ct,  0.0,\n               0.0, 0.0, 0.0,  1.0);\n  stroke(255);\n  box(50);\n}\n</code>\n</div>"],alt:"A rectangle translating to the right\nA rectangle shrinking to the center\nA rectangle rotating clockwise about the center\nA rectangle shearing",class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:150,description:"<p>Replaces the current matrix with the identity matrix.</p>\n",itemtype:"method",name:"resetMatrix",chainable:1,example:["\n<div>\n<code>\ntranslate(50, 50);\napplyMatrix(0.5, 0.5, -0.5, 0.5, 0, 0);\nrect(0, 0, 20, 20);\n// Note that the translate is also reset.\nresetMatrix();\nrect(0, 0, 20, 20);\n</code>\n</div>"],alt:"A rotated retangle in the center with another at the top left corner",class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:176,description:'<p>Rotates a shape the amount specified by the angle parameter. This\nfunction accounts for <a href="#/p5/angleMode">angleMode</a>, so angles can be entered in either\nRADIANS or DEGREES.\n<br><br>\nObjects are always rotated around their relative position to the\norigin and positive numbers rotate objects in a clockwise direction.\nTransformations apply to everything that happens after and subsequent\ncalls to the function accumulates the effect. For example, calling\nrotate(HALF_PI) and then rotate(HALF_PI) is the same as rotate(PI).\nAll tranformations are reset when <a href="#/p5/draw">draw()</a> begins again.\n<br><br>\nTechnically, <a href="#/p5/rotate">rotate()</a> multiplies the current transformation matrix\nby a rotation matrix. This function can be further controlled by\nthe <a href="#/p5/push">push()</a> and <a href="#/p5/pop">pop()</a>.</p>\n',itemtype:"method",name:"rotate",params:[{name:"angle",description:"<p>the angle of rotation, specified in radians\n                       or degrees, depending on current angleMode</p>\n",type:"Number"}
21,{name:"axis",description:"<p>(in 3d) the axis to rotate around</p>\n",type:"p5.Vector|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>"],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:216,description:"<p>Rotates around X axis.</p>\n",itemtype:"method",name:"rotateX",params:[{name:"angle",description:"<p>the angle of rotation, specified in radians\n                       or degrees, depending on current angleMode</p>\n",type:"Number"}],chainable:1,example:["\n<div modernizr='webgl'>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\nfunction draw() {\n  background(255);\n  rotateX(millis() / 1000);\n  box();\n}\n</code>\n</div>"],alt:"3d box rotating around the x axis.",class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:246,description:"<p>Rotates around Y axis.</p>\n",itemtype:"method",name:"rotateY",params:[{name:"angle",description:"<p>the angle of rotation, specified in radians\n                       or degrees, depending on current angleMode</p>\n",type:"Number"}],chainable:1,example:["\n<div modernizr='webgl'>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\nfunction draw() {\n  background(255);\n  rotateY(millis() / 1000);\n  box();\n}\n</code>\n</div>"],alt:"3d box rotating around the y axis.",class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:276,description:"<p>Rotates around Z axis. Webgl mode only.</p>\n",itemtype:"method",name:"rotateZ",params:[{name:"angle",description:"<p>the angle of rotation, specified in radians\n                       or degrees, depending on current angleMode</p>\n",type:"Number"}],chainable:1,example:["\n<div modernizr='webgl'>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\nfunction draw() {\n  background(255);\n  rotateZ(millis() / 1000);\n  box();\n}\n</code>\n</div>"],alt:"3d box rotating around the z axis.",class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:306,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 <a href="#/p5/scale">scale()</a> is called\nwithin <a href="#/p5/draw">draw()</a>, 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 <a href="#/p5/push">push()</a> and <a href="#/p5/pop">pop()</a>.</p>\n',itemtype:"method",name:"scale",chainable:1,example:["\n<div>\n<code>\nrect(30, 20, 50, 50);\nscale(0.5);\nrect(30, 20, 50, 50);\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",overloads:[{line:306,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|Number[]"},{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},{line:351,params:[{name:"scales",description:"<p>per-axis percents to scale the object</p>\n",type:"p5.Vector|Number[]"}],chainable:1}]},{file:"src/core/transform.js",line:381,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 <a href="#/p5/shearX">shearX()</a> is called within the <a href="#/p5/draw">draw()</a>, the transformation is reset when\nthe loop begins again.\n<br><br>
21\nTechnically, <a href="#/p5/shearX">shearX()</a> multiplies the current transformation matrix by a\nrotation matrix. This function can be further controlled by the\n<a href="#/p5/push">push()</a> and <a href="#/p5/pop">pop()</a> functions.</p>\n',itemtype:"method",name:"shearX",params:[{name:"angle",description:"<p>angle of shear specified in radians or degrees,\n                       depending on current angleMode</p>\n",type:"Number"}],chainable:1,example:["\n<div>\n<code>\ntranslate(width / 4, height / 4);\nshearX(PI / 4.0);\nrect(0, 0, 30, 30);\n</code>\n</div>"],alt:"white irregular quadrilateral with black outline at top middle.",class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:421,description:'<p>Shears a shape around the y-axis the amount specified by the angle\nparameter. Angles should be specified in the current angleMode. Objects\nare always sheared around their relative position to the origin and\npositive numbers shear objects in a clockwise direction.\n<br><br>\nTransformations apply to everything that happens after and subsequent\ncalls to the function accumulates the effect. For example, calling\nshearY(PI/2) and then shearY(PI/2) is the same as shearY(PI). If\n<a href="#/p5/shearY">shearY()</a> is called within the <a href="#/p5/draw">draw()</a>, the transformation is reset when\nthe loop begins again.\n<br><br>\nTechnically, <a href="#/p5/shearY">shearY()</a> multiplies the current transformation matrix by a\nrotation matrix. This function can be further controlled by the\n<a href="#/p5/push">push()</a> and <a href="#/p5/pop">pop()</a> functions.</p>\n',itemtype:"method",name:"shearY",params:[{name:"angle",description:"<p>angle of shear specified in radians or degrees,\n                       depending on current angleMode</p>\n",type:"Number"}],chainable:1,example:["\n<div>\n<code>\ntranslate(width / 4, height / 4);\nshearY(PI / 4.0);\nrect(0, 0, 30, 30);\n</code>\n</div>"],alt:"white irregular quadrilateral with black outline at middle bottom.",class:"p5",module:"Transform",submodule:"Transform"},{file:"src/core/transform.js",line:461,description:'<p>Specifies an amount to displace objects within the display window.\nThe x parameter specifies left/right translation, the y parameter\nspecifies up/down translation.\n<br><br>\nTransformations are cumulative and apply to everything that happens after\nand subsequent calls to the function accumulates the effect. For example,\ncalling translate(50, 0) and then translate(20, 0) is the same as\ntranslate(70, 0). If <a href="#/p5/translate">translate()</a> is called within <a href="#/p5/draw">draw()</a>, the\ntransformation is reset when the loop begins again. This function can be\nfurther controlled by using <a href="#/p5/push">push()</a> and <a href="#/p5/pop">pop()</a>.</p>\n',itemtype:"method",name:"translate",chainable:1,example:["\n<div>\n<code>\ntranslate(30, 20);\nrect(0, 0, 55, 55);\n</code>\n</div>\n\n<div>\n<code>\nrect(0, 0, 55, 55); // Draw rect at original 0,0\ntranslate(30, 20);\nrect(0, 0, 55, 55); // Draw rect at new 0,0\ntranslate(14, 14);\nrect(0, 0, 55, 55); // Draw rect at new 0,0\n</code>\n</div>\n\n\n<div>\n<code>\nfunction draw() {\n  background(200);\n  rectMode(CENTER);\n  translate(width / 2, height / 2);\n  translate(p5.Vector.fromAngle(millis() / 1000, 40));\n  rect(0, 0, 20, 20);\n}\n</code>\n</div>"],alt:"white 55x55 rect with black outline at center right.\n3 white 55x55 rects with black outlines at top-l, center-r and bottom-r.\na 20x20 white rect moving in a circle around the canvas",class:"p5",module:"Transform",submodule:"Transform",overloads:[{line:461,params:[{name:"x",description:"<p>left/right translation</p>\n",type:"Number"},{name:"y",description:"<p>up/down translation</p>\n",type:"Number"},{name:"z",description:"<p>forward/backward translation (webgl only)</p>\n",type:"Number",optional:!0}],chainable:1},{line:515,params:[{name:"vector",description:"<p>the vector to translate by</p>\n",type:"p5.Vector"}],chainable:1}]},{file:"src/data/local_storage.js",line:11,description:'<p>Stores a value in local storage under the key name.\n Local storage is saved in the browser and persists\n between browsing sessions and page reloads.\n The key can be the name of the variable but doesn&#39;t\n have to be. To retrieve stored items\n see <a href="#/p5/getItem">getItem</a>.\n <br><br>\n Sensitive data such as passwords or personal information\n should not be stored in local storage.</p>\n',itemtype:"method",name:"storeItem",params:[{name:"key",description:"",type:"String"},{name:"value",description:"",type:"String|Number|Object|Boolean|p5.Color"}],example:["\n <div><code>\n // Type to change the letter in the\n // center of the canvas.\n // If you reload the page, it will\n // still display the last key you entered\nlet myText;\nfunction setup() {\n   createCanvas(100, 100);\n   myText = getItem('myText');\n   if (myText === null) {\n     myText = '';\n   }\n }\nfunction draw() {\n   textSize(40);\n   background(255);\n   text(myText, width / 2, height / 2);\n }
21\nfunction keyPressed() {\n   myText = key;\n   storeItem('myText', myText);\n }\n </code></div>"],alt:"When you type the key name is displayed as black text on white background.\n If you reload the page, the last letter typed is still displaying.",class:"p5",module:"Data",submodule:"LocalStorage"},{file:"src/data/local_storage.js",line:88,description:"<p>Returns the value of an item that was stored in local storage\n using storeItem()</p>\n",itemtype:"method",name:"getItem",params:[{name:"key",description:"<p>name that you wish to use to store in local storage</p>\n",type:"String"}],return:{description:"Value of stored item",type:"Number|Object|String|Boolean|p5.Color"},example:["\n <div><code>\n // Click the mouse to change\n // the color of the background\n // Once you have changed the color\n // it will stay changed even when you\n // reload the page.\nlet myColor;\nfunction setup() {\n   createCanvas(100, 100);\n   myColor = getItem('myColor');\n }\nfunction draw() {\n   if (myColor !== null) {\n     background(myColor);\n   }\n }\nfunction mousePressed() {\n   myColor = color(random(255), random(255), random(255));\n   storeItem('myColor', myColor);\n }\n </code></div>"],alt:"If you click, the canvas changes to a random color.\n If you reload the page, the canvas is still the color it\n was when the page was previously loaded.",class:"p5",module:"Data",submodule:"LocalStorage"},{file:"src/data/local_storage.js",line:163,description:"<p>Clears all local storage items set with storeItem()\n for the current domain.</p>\n",itemtype:"method",name:"clearStorage",example:["\n <div class=\"norender\">\n <code>\n function setup() {\n   let myNum = 10;\n   let myBool = false;\n   storeItem('myNum', myNum);\n   storeItem('myBool', myBool);\n   print(getItem('myNum')); // logs 10 to the console\n   print(getItem('myBool')); // logs false to the console\n   clearStorage();\n   print(getItem('myNum')); // logs null to the console\n   print(getItem('myBool')); // logs null to the console\n }\n </code></div>"],class:"p5",module:"Data",submodule:"LocalStorage"},{file:"src/data/local_storage.js",line:191,description:"<p>Removes an item that was stored with storeItem()</p>\n",itemtype:"method",name:"removeItem",params:[{name:"key",description:"",type:"String"}],example:["\n <div class=\"norender\">\n <code>\n function setup() {\n   let myVar = 10;\n   storeItem('myVar', myVar);\n   print(getItem('myVar')); // logs 10 to the console\n   removeItem('myVar');\n   print(getItem('myVar')); // logs null to the console\n }\n </code></div>"],class:"p5",module:"Data",submodule:"LocalStorage"},{file:"src/data/p5.TypedDict.js",line:16,description:"<p>Creates a new instance of p5.StringDict using the key-value pair\n or the object you provide.</p>\n",itemtype:"method",name:"createStringDict",return:{description:"",type:"p5.StringDict"},example:["\n <div class=\"norender\">\n <code>\n function setup() {\n   let myDictionary = createStringDict('p5', 'js');\n   print(myDictionary.hasKey('p5')); // logs true to console\n  let anotherDictionary = createStringDict({ happy: 'coding' });\n   print(anotherDictionary.hasKey('happy')); // logs true to console\n }\n </code></div>"],class:"p5",module:"Data",submodule:"Dictionary",overloads:[{line:16,params:[{name:"key",description:"",type:"String"},{name:"value",description:"",type:"String"}],return:{description:"",type:"p5.StringDict"}},{line:39,params:[{name:"object",description:"<p>object</p>\n",type:"Object"}],return:{description:"",type:"p5.StringDict"}}]},{file:"src/data/p5.TypedDict.js",line:50,description:'<p>Creates a new instance of <a href="#/p5.NumberDict">p5.NumberDict</a> using the key-value pair\n or object you provide.</p>\n',itemtype:"method",name:"createNumberDict",return:{description:"",type:"p5.NumberDict"},example:['\n <div class="norender">\n <code>\n function setup() {\n   let myDictionary = createNumberDict(100, 42);\n   print(myDictionary.hasKey(100)); // logs true to console\n  let anotherDictionary = createNumberDict({ 200: 84 });\n   print(anotherDictionary.hasKey(200)); // logs true to console\n }\n </code></div>'],class:"p5",module:"Data",submodule:"Dictionary",overloads:[{line:50,params:[{name:"key",description:"",type:"Number"},{name:"value",description:"",type:"Number"}],return:{description:"",type:"p5.NumberDict"}},{line:73,params:[{name:"object",description:"<p>object</p>\n",type:"Object"}],return:{description:"",type:"p5.NumberDict"}}]},{file:"src/data/p5.TypedDict.js",line:103,description:"<p>Returns the number of key-value pairs currently stored in the Dictionary.</p>\n",itemtype:"method",name:"size",return:{description:"the number of key-value pairs in the Dictionary",type:"Integer"},example:['\n<div class="norender">\n<code>\nfunction setup() {\n  let myDictionary = createNumberDict(1, 10);\n  myDictionary.create(2, 20);\n  myDictionary.create(3, 30);\n  print(myDictionary.size()); // logs 3 to the console\n}\n</code></div>\n'],class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:125,description:"<p>Returns true if the given key exists in the Dictionary,\notherwise returns false.</p>\n",itemtype:"method",name:"hasKey",params:[{name:"key",description:"<p>that you want to look up</p>\n",type:"Number|String"}],return:{description:"whether that key exists in Dictionary",type:"Boolean"},example:["\n<div class=\"norender\">\n<code>\nfunction setup() {\n  let myDictionary = createStringDict('p5', 'js');\n  print(myDictionary.hasKey('p5')); // logs true to console\n}\n</code></div>\n"],class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:148,description:"<p>Returns the value stored at the given key.</p>\n",itemtype:"method",name:"get",params:[{name:"the",description:"<p>key you want to access</p>\n",type:"Number|String"}],return:{description:"the value stored at that key",type:"Number|String"},example:["\n<div class=\"norender\">\n<code>\nfunction setup() {\n  let myDictionary = createStringDict('p5', 'js');\n  let myValue = myDictionary.get('p5');\n  print(myValue === 'js'); // logs true to console\n}\n</code></div>\n"],class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:175,description:"<p>Updates the value associated with the given key in case it already exists\nin the Dictionary. Otherwise a new key-value pair is added.</p>\n",itemtype:"method",name:"set",params:[{name:"key",description:"",type:"Number|String"},{name:"value",description:"",type:"Number|String"}],example:["\n<div class=\"norender\">\n<code>\nfunction setup() {\n  let myDictionary = createStringDict('p5', 'js');\n  myDictionary.set('p5', 'JS');\n  myDictionary.print(); // logs \"key: p5 - value: JS\" to console\n}\n</code></div>\n"],class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:203,description:"<p>private helper function to handle the user passing in objects\nduring construction or calls to create()</p>\n",class:"p5.TypedDict",module:"Data",submodule:"Dictionary"}
21,{file:"src/data/p5.TypedDict.js",line:214,description:"<p>Creates a new key-value pair in the Dictionary.</p>\n",itemtype:"method",name:"create",example:["\n<div class=\"norender\">\n<code>\nfunction setup() {\n  let myDictionary = createStringDict('p5', 'js');\n  myDictionary.create('happy', 'coding');\n  myDictionary.print();\n  // above logs \"key: p5 - value: js, key: happy - value: coding\" to console\n}\n</code></div>"],class:"p5.TypedDict",module:"Data",submodule:"Dictionary",overloads:[{line:214,params:[{name:"key",description:"",type:"Number|String"},{name:"value",description:"",type:"Number|String"}]},{line:232,params:[{name:"obj",description:"<p>key/value pair</p>\n",type:"Object"}]}]},{file:"src/data/p5.TypedDict.js",line:250,description:"<p>Removes all previously stored key-value pairs from the Dictionary.</p>\n",itemtype:"method",name:"clear",example:["\n<div class=\"norender\">\n<code>\nfunction setup() {\n  let myDictionary = createStringDict('p5', 'js');\n  print(myDictionary.hasKey('p5')); // prints 'true'\n  myDictionary.clear();\n  print(myDictionary.hasKey('p5')); // prints 'false'\n}\n</code>\n</div>"],class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:271,description:"<p>Removes the key-value pair stored at the given key from the Dictionary.</p>\n",itemtype:"method",name:"remove",params:[{name:"key",description:"<p>for the pair to remove</p>\n",type:"Number|String"}],example:["\n<div class=\"norender\">\n<code>\nfunction setup() {\n  let myDictionary = createStringDict('p5', 'js');\n  myDictionary.create('happy', 'coding');\n  myDictionary.print();\n  // above logs \"key: p5 - value: js, key: happy - value: coding\" to console\n  myDictionary.remove('p5');\n  myDictionary.print();\n  // above logs \"key: happy value: coding\" to console\n}\n</code></div>\n"],class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:301,description:"<p>Logs the set of items currently stored in the Dictionary to the console.</p>\n",itemtype:"method",name:"print",example:["\n<div class=\"norender\">\n<code>\nfunction setup() {\n  let myDictionary = createStringDict('p5', 'js');\n  myDictionary.create('happy', 'coding');\n  myDictionary.print();\n  // above logs \"key: p5 - value: js, key: happy - value: coding\" to console\n}\n</code>\n</div>"],class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:325,description:"<p>Converts the Dictionary into a CSV file for local download.</p>\n",itemtype:"method",name:"saveTable",example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100);\n  background(200);\n  text('click here to save', 10, 10, 70, 80);\n}\n\nfunction mousePressed() {\n  if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n    createStringDict({\n      john: 1940,\n      paul: 1942,\n      george: 1943,\n      ringo: 1940\n    }).saveTable('beatles');\n  }\n}\n</code>\n</div>"],class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:363,description:"<p>Converts the Dictionary into a JSON file for local download.</p>\n",itemtype:"method",name:"saveJSON",example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100);\n  background(200);\n  text('click here to save', 10, 10, 70, 80);\n}\n\nfunction mousePressed() {\n  if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n    createStringDict({\n      john: 1940,\n      paul: 1942,\n      george: 1943,\n      ringo: 1940\n    }).saveJSON('beatles');\n  }\n}\n</code>\n</div>"],class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:394,description:"<p>private helper function to ensure that the user passed in valid\nvalues for the Dictionary type</p>\n",class:"p5.TypedDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:437,description:"<p>private helper function to ensure that the user passed in valid\nvalues for the Dictionary type</p>\n",class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:446,description:"<p>Add the given number to the value currently stored at the given key.\nThe sum then replaces the value previously stored in the Dictionary.</p>\n",itemtype:"method",name:"add",params:[{name:"Key",description:"<p>for the value you wish to add to</p>\n",type:"Number"},{name:"Number",description:"<p>to add to the value</p>\n",type:"Number"}],example:["\n<div class='norender'>\n<code>\nfunction setup() {\n  let myDictionary = createNumberDict(2, 5);\n  myDictionary.add(2, 2);\n  print(myDictionary.get(2)); // logs 7 to console.\n}\n</code></div>\n\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:474,description:"<p>Subtract the given number from the value currently stored at the given key.\nThe difference then replaces the value previously stored in the Dictionary.</p>\n",itemtype:"method",name:"sub",params:[{name:"Key",description:"<p>
21for the value you wish to subtract from</p>\n",type:"Number"},{name:"Number",description:"<p>to subtract from the value</p>\n",type:"Number"}],example:["\n<div class='norender'>\n<code>\nfunction setup() {\n  let myDictionary = createNumberDict(2, 5);\n  myDictionary.sub(2, 2);\n  print(myDictionary.get(2)); // logs 3 to console.\n}\n</code></div>\n\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:498,description:"<p>Multiply the given number with the value currently stored at the given key.\nThe product then replaces the value previously stored in the Dictionary.</p>\n",itemtype:"method",name:"mult",params:[{name:"Key",description:"<p>for value you wish to multiply</p>\n",type:"Number"},{name:"Amount",description:"<p>to multiply the value by</p>\n",type:"Number"}],example:["\n<div class='norender'>\n<code>\nfunction setup() {\n  let myDictionary = createNumberDict(2, 4);\n  myDictionary.mult(2, 2);\n  print(myDictionary.get(2)); // logs 8 to console.\n}\n</code></div>\n\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:526,description:"<p>Divide the given number with the value currently stored at the given key.\nThe quotient then replaces the value previously stored in the Dictionary.</p>\n",itemtype:"method",name:"div",params:[{name:"Key",description:"<p>for value you wish to divide</p>\n",type:"Number"},{name:"Amount",description:"<p>to divide the value by</p>\n",type:"Number"}],example:["\n<div class='norender'>\n<code>\nfunction setup() {\n  let myDictionary = createNumberDict(2, 8);\n  myDictionary.div(2, 2);\n  print(myDictionary.get(2)); // logs 4 to console.\n}\n</code></div>\n\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:554,description:"<p>private helper function for finding lowest or highest value\nthe argument &#39;flip&#39; is used to flip the comparison arrow\nfrom &#39;less than&#39; to &#39;greater than&#39;</p>\n",class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:579,description:"<p>Return the lowest number currently stored in the Dictionary.</p>\n",itemtype:"method",name:"minValue",return:{description:"",type:"Number"},example:["\n<div class='norender'>\n<code>\nfunction setup() {\n  let myDictionary = createNumberDict({ 2: -10, 4: 0.65, 1.2: 3 });\n  let lowestValue = myDictionary.minValue(); // value is -10\n  print(lowestValue);\n}\n</code></div>\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:600,description:"<p>Return the highest number currently stored in the Dictionary.</p>\n",itemtype:"method",name:"maxValue",return:{description:"",type:"Number"},example:["\n<div class='norender'>\n<code>\nfunction setup() {\n  let myDictionary = createNumberDict({ 2: -10, 4: 0.65, 1.2: 3 });\n  let highestValue = myDictionary.maxValue(); // value is 3\n  print(highestValue);\n}\n</code></div>\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:621,description:"<p>private helper function for finding lowest or highest key\nthe argument &#39;flip&#39; is used to flip the comparison arrow\nfrom &#39;less than&#39; to &#39;greater than&#39;</p>\n",class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:644,description:"<p>Return the lowest key currently used in the Dictionary.</p>\n",itemtype:"method",name:"minKey",return:{description:"",type:"Number"},example:["\n<div class='norender'>\n<code>\nfunction setup() {\n  let myDictionary = createNumberDict({ 2: 4, 4: 6, 1.2: 3 });\n  let lowestKey = myDictionary.minKey(); // value is 1.2\n  print(lowestKey);\n}\n</code></div>\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/data/p5.TypedDict.js",line:665,description:"<p>Return the highest key currently used in the Dictionary.</p>\n",itemtype:"method",name:"maxKey",return:{description:"",type:"Number"},example:["\n<div class='norender'>\n<code>\nfunction setup() {\n  let myDictionary = createNumberDict({ 2: 4, 4: 6, 1.2: 3 });\n  let highestKey = myDictionary.maxKey(); // value is 4\n  print(highestKey);\n}\n</code></div>\n"],class:"p5.NumberDict",module:"Data",submodule:"Dictionary"},{file:"src/events/acceleration.js",line:12,description:"<p>The system variable deviceOrientation always contains the orientation of\nthe device. The value of this variable will either be set &#39;landscape&#39;
21\nor &#39;portrait&#39;. If no data is available it will be set to &#39;undefined&#39;.\neither LANDSCAPE or PORTRAIT.</p>\n",itemtype:"property",name:"deviceOrientation",type:"Constant",readonly:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:23,description:"<p>The system variable accelerationX always contains the acceleration of the\ndevice along the x axis. Value is represented as meters per second squared.</p>\n",itemtype:"property",name:"accelerationX",type:"Number",readonly:"",example:["\n<div>\n<code>\n// Move a touchscreen device to register\n// acceleration changes.\nfunction draw() {\n  background(220, 50);\n  fill('magenta');\n  ellipse(width / 2, height / 2, accelerationX);\n}\n</code>\n</div>"],alt:"Magnitude of device acceleration is displayed as ellipse size",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:46,description:"<p>The system variable accelerationY always contains the acceleration of the\ndevice along the y axis. Value is represented as meters per second squared.</p>\n",itemtype:"property",name:"accelerationY",type:"Number",readonly:"",example:["\n<div>\n<code>\n// Move a touchscreen device to register\n// acceleration changes.\nfunction draw() {\n  background(220, 50);\n  fill('magenta');\n  ellipse(width / 2, height / 2, accelerationY);\n}\n</code>\n</div>"],alt:"Magnitude of device acceleration is displayed as ellipse size",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:69,description:"<p>The system variable accelerationZ always contains the acceleration of the\ndevice along the z axis. Value is represented as meters per second squared.</p>\n",itemtype:"property",name:"accelerationZ",type:"Number",readonly:"",example:["\n<div>\n<code>\n// Move a touchscreen device to register\n// acceleration changes.\nfunction draw() {\n  background(220, 50);\n  fill('magenta');\n  ellipse(width / 2, height / 2, accelerationZ);\n}\n</code>\n</div>"],alt:"Magnitude of device acceleration is displayed as ellipse size",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:94,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:104,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:114,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:135,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",itemtype:"property",name:"rotationX",type:"Number",readonly:"",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>"],alt:"red horizontal line right, green vertical line bottom. black background.",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:166,description:"<p>The system variable rotationY always contains the rotation of the\ndevice along the y axis. V
21alue 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",itemtype:"property",name:"rotationY",type:"Number",readonly:"",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>"],alt:"red horizontal line right, green vertical line bottom. black background.",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:197,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:233,description:"<p>The system variable pRotationX always contains the rotation of the\ndevice along the x axis in the frame previous to the current frame. Value\nis represented as 0 to +/-180 degrees.\n<br><br>\npRotationX can also be used with rotationX to determine the rotate\ndirection of the device along the X-axis.</p>\n",example:["\n<div class='norender'>\n<code>\n// A simple if statement looking at whether\n// rotationX - pRotationX < 0 is true or not will be\n// sufficient for determining the rotate direction\n// in most cases.\n\n// Some extra logic is needed to account for cases where\n// the angles wrap around.\nlet rotateDirection = 'clockwise';\n\n// Simple range conversion to make things simpler.\n// This is not absolutely necessary but the logic\n// will be different in that case.\n\nlet rX = rotationX + 180;\nlet pRX = pRotationX + 180;\n\nif ((rX - pRX > 0 && rX - pRX < 270) || rX - pRX < -270) {\n  rotateDirection = 'clockwise';\n} else if (rX - pRX < 0 || rX - pRX > 270) {\n  rotateDirection = 'counter-clockwise';\n}\n\nprint(rotateDirection);\n</code>\n</div>"],alt:"no image to display.",itemtype:"property",name:"pRotationX",type:"Number",readonly:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:278,description:"<p>The system variable pRotationY always contains the rotation of the\ndevice along the y axis in the frame previous to the current frame. Value\nis represented as 0 to +/-90 degrees.\n<br><br>\npRotationY can also be used with rotationY to determine the rotate\ndirection of the device along the Y-axis.</p>\n",example:["\n<div class='norender'>\n<code>\n// A simple if statement looking at whether\n// rotationY - pRotationY < 0 is true or not will be\n// sufficient for determining the rotate direction\n// in most cases.\n\n// Some extra logic is needed to account for cases where\n// the angles wrap around.\nlet rotateDirection = 'clockwise';\n\n// Simple range conversion to make things simpler.\n// This is not absolutely necessary but the logic\n// will be different in that case.\n\nlet rY = rotationY + 180;\nlet pRY = pRotationY + 180;\n\nif ((rY - pRY > 0 && rY - pRY < 270) || rY - pRY < -270) {\n  rotateDirection = 'clockwise';\n} else if (rY - pRY < 0 || rY - pRY > 270) {\n  rotateDirection = 'counter-clockwise';\n}\nprint(rotateDirection);\n</code>\n</div>"],alt:"no image to display.",itemtype:"property",name:"pRotationY",type:"Number",readonly:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:322,description:"<p>The system variable pRotationZ always contains the rotation of the\ndevice along the z axis in the frame previous to the current frame. Value\nis represented as 0 to 359 degrees.\n<br><br>\npRotationZ can also be used with rotationZ to determine the rotate\ndirection of the device along the Z-axis.</p>\n",example:["\n<div class='norender'>\n<code>\n// A simple if statement looking at whether\n// rotationZ - pRotationZ < 0 is true or not will be\n// sufficient for determining the rotate direction\n// in most cases.\n\n// Some extra logic is needed to account for cases where\n// the angles wrap around.\nlet rotateDirection = 'clockwise';\n\nif (\n  (rotationZ - pRotationZ > 0 && rotationZ - pRotationZ < 270) ||\n  rotationZ - pRotationZ < -270\n) {\n  rotateDirection = 'clockwise';\n} else if (rotationZ - pRotationZ < 0 || rotationZ - pRotationZ > 270) {\n  rotateDirection = 'counter-clockwise';\n}\nprint(rotateDirection);\n</code>\n</div>"],alt:"no image to display.",itemtype:"property",name:"pRotationZ",type:"Number",readonly:"",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:380,description:'<p>When a device is rotated, the axis that triggers the <a href="#/p5/deviceTurned">deviceTurned()</a>\nmethod is stored in the turnAxis variable. The turnAxis variable is only defined within\nthe scope of deviceTurned().</p>\n',itemtype:"property",name:"turnAxis",type:"String",readonly:"",example:["\n<div>\n<code>\n// Run this example on a mobile device\n// Rotate the device by 90 degrees in the\n// X-axis to change the value.\n\nvar value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction deviceTurned() {\n  if (turnAxis === 'X') {\n    if (value === 0) {\n      value = 255;\n    }
21 else if (value === 255) {\n      value = 0;\n    }\n  }\n}\n</code>\n</div>"],alt:"50x50 black rect in center of canvas. turns white on mobile when device turns\n50x50 black rect in center of canvas. turns white on mobile when x-axis turns",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:419,description:'<p>The <a href="#/p5/setMoveThreshold">setMoveThreshold()</a> function is used to set the movement threshold for\nthe <a href="#/p5/deviceMoved">deviceMoved()</a> function. The default threshold is set to 0.5.</p>\n',itemtype:"method",name:"setMoveThreshold",params:[{name:"value",description:"<p>The threshold value</p>\n",type:"Number"}],example:['\n<div class="norender">\n<code>\n// Run this example on a mobile device\n// You will need to move the device incrementally further\n// the closer the square\'s color gets to white in order to change the value.\n\nlet value = 0;\nlet threshold = 0.5;\nfunction setup() {\n  setMoveThreshold(threshold);\n}\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction deviceMoved() {\n  value = value + 5;\n  threshold = threshold + 0.1;\n  if (value > 255) {\n    value = 0;\n    threshold = 30;\n  }\n  setMoveThreshold(threshold);\n}\n</code>\n</div>'],alt:"50x50 black rect in center of canvas. turns white on mobile when device moves",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:462,description:'<p>The <a href="#/p5/setShakeThreshold">setShakeThreshold()</a> function is used to set the movement threshold for\nthe <a href="#/p5/deviceShaken">deviceShaken()</a> function. The default threshold is set to 30.</p>\n',itemtype:"method",name:"setShakeThreshold",params:[{name:"value",description:"<p>The threshold value</p>\n",type:"Number"}],example:['\n<div class="norender">\n<code>\n// Run this example on a mobile device\n// You will need to shake the device more firmly\n// the closer the box\'s fill gets to white in order to change the value.\n\nlet value = 0;\nlet threshold = 30;\nfunction setup() {\n  setShakeThreshold(threshold);\n}\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction deviceMoved() {\n  value = value + 5;\n  threshold = threshold + 5;\n  if (value > 255) {\n    value = 0;\n    threshold = 30;\n  }\n  setShakeThreshold(threshold);\n}\n</code>\n</div>'],alt:"50x50 black rect in center of canvas. turns white on mobile when device\nis being shaked",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:506,description:'<p>The <a href="#/p5/deviceMoved">deviceMoved()</a> function is called when the device is moved by more than\nthe threshold value along X, Y or Z axis. The default threshold is set to 0.5.\nThe threshold value can be changed using <a href="https://p5js.org/reference/#/p5/setMoveThreshold">setMoveThreshold()</a>.</p>\n',itemtype:"method",name:"deviceMoved",example:['\n<div class="norender">\n<code>\n// Run this example on a mobile device\n// Move the device around\n// to change the value.\n\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction deviceMoved() {\n  value = value + 5;\n  if (value > 255) {\n    value = 0;\n  }\n}\n</code>\n</div>'],alt:"50x50 black rect in center of canvas. turns white on mobile when device moves",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:538,description:'<p>The <a href="#/p5/deviceTurned">deviceTurned()</a> function is called when the device rotates by\nmore than 90 degrees continuously.\n<br><br>\nThe axis that triggers the <a href="#/p5/deviceTurned">deviceTurned()</a> method is stored in the turnAxis\nvariable. The <a href="#/p5/deviceTurned">deviceTurned()</a> method can be locked to trigger on any axis:\nX, Y or Z by comparing the turnAxis variable to &#39;X&#39;, &#39;Y&#39; or &#39;Z&#39;.</p>\n',itemtype:"method",name:"deviceTurned",example:["\n<div class=\"norender\">\n<code>\n// Run this example on a mobile device\n// Rotate the device by 90 degrees\n// to change the value.\n\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction deviceTurned() {\n  if (value === 0) {\n    value = 255;\n  }
21 else if (value === 255) {\n    value = 0;\n  }\n}\n</code>\n</div>\n<div>\n<code>\n// Run this example on a mobile device\n// Rotate the device by 90 degrees in the\n// X-axis to change the value.\n\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction deviceTurned() {\n  if (turnAxis === 'X') {\n    if (value === 0) {\n      value = 255;\n    } else if (value === 255) {\n      value = 0;\n    }\n  }\n}\n</code>\n</div>"],alt:"50x50 black rect in center of canvas. turns white on mobile when device turns\n50x50 black rect in center of canvas. turns white on mobile when x-axis turns",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/acceleration.js",line:597,description:'<p>The <a href="#/p5/deviceShaken">deviceShaken()</a> function is called when the device total acceleration\nchanges of accelerationX and accelerationY values is more than\nthe threshold value. The default threshold is set to 30.\nThe threshold value can be changed using <a href="https://p5js.org/reference/#/p5/setShakeThreshold">setShakeThreshold()</a>.</p>\n',itemtype:"method",name:"deviceShaken",example:['\n<div class="norender">\n<code>\n// Run this example on a mobile device\n// Shake the device to change the value.\n\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction deviceShaken() {\n  value = value + 5;\n  if (value > 255) {\n    value = 0;\n  }\n}\n</code>\n</div>'],alt:"50x50 black rect in center of canvas. turns white on mobile when device shakes",class:"p5",module:"Events",submodule:"Acceleration"},{file:"src/events/keyboard.js",line:12,description:'<p>The boolean system variable <a href="#/p5/keyIsPressed">keyIsPressed</a> is true if any key is pressed\nand false if no keys are pressed.</p>\n',itemtype:"property",name:"keyIsPressed",type:"Boolean",readonly:"",example:["\n<div>\n<code>\nfunction draw() {\n  if (keyIsPressed === true) {\n    fill(0);\n  } else {\n    fill(255);\n  }\n  rect(25, 25, 50, 50);\n}\n</code>\n</div>"],alt:"50x50 white rect that turns black on keypress.",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/keyboard.js",line:39,description:'<p>The system variable key always contains the value of the most recent\nkey on the keyboard that was typed. To get the proper capitalization, it\nis best to use it within <a href="#/p5/keyTyped">keyTyped()</a>. For non-ASCII keys, use the <a href="#/p5/keyCode">keyCode</a>\nvariable.</p>\n',itemtype:"property",name:"key",type:"String",readonly:"",example:["\n<div><code>\n// Click any key to display it!\n// (Not Guaranteed to be Case Sensitive)\nfunction setup() {\n  fill(245, 123, 158);\n  textSize(50);\n}\n\nfunction draw() {\n  background(200);\n  text(key, 33, 65); // Display last key pressed.\n}\n</code></div>"],alt:"canvas displays any key value that is pressed in pink font.",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/keyboard.js",line:68,description:'<p>The variable keyCode is used to detect special keys such as BACKSPACE,\nDELETE, ENTER, RETURN, TAB, ESCAPE, SHIFT, CONTROL, OPTION, ALT, UP_ARROW,\nDOWN_ARROW, LEFT_ARROW, RIGHT_ARROW.\nYou can also check for custom keys by looking up the keyCode of any key\non a site like this: <a href="http://keycode.info/">keycode.info</a>.</p>\n',itemtype:"property",name:"keyCode",type:"Integer",readonly:"",example:["\n<div><code>\nlet fillVal = 126;\nfunction draw() {\n  fill(fillVal);\n  rect(25, 25, 50, 50);\n}\n\nfunction keyPressed() {\n  if (keyCode === UP_ARROW) {\n    fillVal = 255;\n  } else if (keyCode === DOWN_ARROW) {\n    fillVal = 0;\n  }\n  return false; // prevent default\n}\n</code></div>\n<div><code>\nfunction draw() {}\nfunction keyPressed() {\n  background('yellow');\n  text(`${key} ${keyCode}`, 10, 40);\n  print(key, ' ', keyCode);\n  return false; // prevent default\n}\n</code></div>"],alt:"Grey rect center. turns white when up arrow pressed and black when down\nDisplay key pressed and its keyCode in a yellow box",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/keyboard.js",line:109,description:'<p>The <a href="#/p5/keyPressed">keyPressed()</a> function is called once every time a key is pressed. The\nkeyCode for the key that was pressed is stored in the <a href="#/p5/keyCode">keyCode</a> variable.\n<br><br>\nFor non-ASCII keys, use the keyCode variable. You can check if the keyCode\nequals BACKSPACE, DELETE, ENTE
21R, RETURN, TAB, ESCAPE, SHIFT, CONTROL,\nOPTION, ALT, UP_ARROW, DOWN_ARROW, LEFT_ARROW, RIGHT_ARROW.\n<br><br>\nFor ASCII keys, the key that was pressed is stored in the key variable. However, it\ndoes not distinguish between uppercase and lowercase. For this reason, it\nis recommended to use <a href="#/p5/keyTyped">keyTyped()</a> to read the key variable, in which the\ncase of the variable will be distinguished.\n<br><br>\nBecause of how operating systems handle key repeats, holding down a key\nmay cause multiple calls to <a href="#/p5/keyTyped">keyTyped()</a> (and <a href="#/p5/keyReleased">keyReleased()</a> as well). The\nrate of repeat is set by the operating system and how each computer is\nconfigured.<br><br>\nBrowsers may have different default\nbehaviors attached to various key events. To prevent any default\nbehavior for this event, add &quot;return false&quot; to the end of the method.</p>\n',itemtype:"method",name:"keyPressed",example:['\n<div>\n<code>\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction keyPressed() {\n  if (value === 0) {\n    value = 255;\n  } else {\n    value = 0;\n  }\n}\n</code>\n</div>\n<div>\n<code>\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction keyPressed() {\n  if (keyCode === LEFT_ARROW) {\n    value = 255;\n  } else if (keyCode === RIGHT_ARROW) {\n    value = 0;\n  }\n}\n</code>\n</div>\n<div class="norender">\n<code>\nfunction keyPressed() {\n  // Do something\n  return false; // prevent any default behaviour\n}\n</code>\n</div>'],alt:"black rect center. turns white when key pressed and black when released\nblack rect center. turns white when left arrow pressed and black when right.",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/keyboard.js",line:196,description:'<p>The <a href="#/p5/keyReleased">keyReleased()</a> function is called once every time a key is released.\nSee <a href="#/p5/key">key</a> and <a href="#/p5/keyCode">keyCode</a> for more information.<br><br>\nBrowsers may have different default\nbehaviors attached to various key events. To prevent any default\nbehavior for this event, add &quot;return false&quot; to the end of the method.</p>\n',itemtype:"method",name:"keyReleased",example:["\n<div>\n<code>\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction keyReleased() {\n  if (value === 0) {\n    value = 255;\n  } else {\n    value = 0;\n  }\n  return false; // prevent any default behavior\n}\n</code>\n</div>"],alt:"black rect center. turns white when key pressed and black when pressed again",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/keyboard.js",line:248,description:'<p>The <a href="#/p5/keyTyped">keyTyped()</a> function is called once every time a key is pressed, but\naction keys such as Backspace, Delete, Ctrl, Shift, and Alt are ignored. If you are trying to detect\na keyCode for one of these keys, use the <a href="#/p5/keyPressed">keyPressed()</a> function instead.\nThe most recent key typed will be stored in the key variable.\n<br><br>\nBecause of how operating systems handle key repeats, holding down a key\nwill cause multiple calls to <a href="#/p5/keyTyped">keyTyped()</a> (and <a href="#/p5/keyReleased">keyReleased()</a> as well). The\nrate of repeat is set by the operating system and how each computer is\nconfigured.<br><br>\nBrowsers may have different default behaviors attached to various key\nevents. To prevent any default behavior for this event, add &quot;return false&quot;\nto the end of the method.</p>\n',itemtype:"method",name:"keyTyped",example:["\n<div>\n<code>\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction keyTyped() {\n  if (key === 'a') {\n    value = 255;\n  } else if (key === 'b') {\n    value = 0;\n  }\n  // uncomment to prevent any default behavior\n  // return false;\n}\n</code>\n</div>"],alt:"black rect center. turns white when 'a' key typed and black when 'b' pressed",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/keyboard.js",line:302,description:"<p>The onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released.</p>\n",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/keyboard.js",line:312,description:'<p>The <a href="#/p5/keyIsDown">keyIsDown()</a> function checks if the key is currently down, i.e. pressed.\nIt can be used if you have an object that moves, and you want several keys\nto be able to affect its behaviour simultaneously, such as moving a\nsprite diagonally. You can put in any number representing the keyCode of\nthe key, or use any of the variable <a href="#/p5/keyCode">keyCode</a> names listed\n<a href="http://p5js.org/reference/#p5/keyCode">here</a>.</p>\n',itemtype:"method",name:"keyIsDown",params:[{name:"code",description:"<p>The key to check for.</p>\n",type:"Number"}],return:{description:"whether key is down or not",type:"Boolean"},example:['\n<div><code>\nlet x = 100;\nlet y = 100;\n\nfunction setup() {\n  createCanvas(512, 512);\n  fill(255, 0, 0);\n}\n\nfunction draw() {\n  if (keyIsDown(LEFT_ARROW)) {\n    x -= 5;\n  }\n\n  if (keyIsDown(RIGHT_ARROW)) {\n    x += 5;\n  }\n\n  if (keyIsDown(UP_ARROW)) {\n    y -= 5;\n  }\n\n  if (keyIsDown(DOWN_ARROW)) {\n    y += 5;\n  }\n\n  clear();\n  ellipse(x, y, 50, 50);\n}\n</code></div>\n\n<div><code>\nlet diameter = 50;\n\nfunction setup() {\n  createCanvas(512, 512);\n}\n\nfunction draw() {\n  // 107 and 187 are keyCodes for "+"\n  if (keyIsDown(107) || keyIsDown(187)) {\n    diameter += 1;\n  }
21\n\n  // 109 and 189 are keyCodes for "-"\n  if (keyIsDown(109) || keyIsDown(189)) {\n    diameter -= 1;\n  }\n\n  clear();\n  fill(255, 0, 0);\n  ellipse(50, 50, diameter, diameter);\n}\n</code></div>'],alt:"50x50 red ellipse moves left, right, up and down with arrow presses.\n50x50 red ellipse gets bigger or smaller when + or - are pressed.",class:"p5",module:"Events",submodule:"Keyboard"},{file:"src/events/mouse.js",line:22,description:"<p>The system variable mouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the canvas. The value at\nthe top-left corner is (0, 0) for 2-D and (-width/2, -height/2) for WebGL.\nIf touch is used instead of mouse input, mouseX will hold the x value\nof the most recent touch point.</p>\n",itemtype:"property",name:"mouseX",type:"Number",readonly:"",example:["\n<div>\n<code>\n// Move the mouse across the canvas\nfunction draw() {\n  background(244, 248, 252);\n  line(mouseX, 0, mouseX, 100);\n}\n</code>\n</div>"],alt:"horizontal black line moves left and right with mouse x-position",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:49,description:"<p>The system variable mouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the canvas. The value at\nthe top-left corner is (0, 0) for 2-D and (-width/2, -height/2) for WebGL.\nIf touch is used instead of mouse input, mouseY will hold the y value\nof the most recent touch point.</p>\n",itemtype:"property",name:"mouseY",type:"Number",readonly:"",example:["\n<div>\n<code>\n// Move the mouse across the canvas\nfunction draw() {\n  background(244, 248, 252);\n  line(0, mouseY, 100, mouseY);\n}\n</code>\n</div>"],alt:"vertical black line moves up and down with mouse y-position",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:76,description:"<p>The system variable pmouseX always contains the horizontal position of\nthe mouse or finger in the frame previous to the current frame, relative to\n(0, 0) of the canvas. The value at the top-left corner is (0, 0) for 2-D and\n(-width/2, -height/2) for WebGL. Note: pmouseX will be reset to the current mouseX\nvalue at the start of each touch event.</p>\n",itemtype:"property",name:"pmouseX",type:"Number",readonly:"",example:["\n<div>\n<code>\n// Move the mouse across the canvas to leave a trail\nfunction setup() {\n  //slow down the frameRate to make it more visible\n  frameRate(10);\n}\n\nfunction draw() {\n  background(244, 248, 252);\n  line(mouseX, mouseY, pmouseX, pmouseY);\n  print(pmouseX + ' -> ' + mouseX);\n}\n</code>\n</div>"],alt:"line trail is created from cursor movements. faster movement make longer line.",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:109,description:"<p>The system variable pmouseY always contains the vertical position of\nthe mouse or finger in the frame previous to the current frame, relative to\n(0, 0) of the canvas. The value at the top-left corner is (0, 0) for 2-D and\n(-width/2, -height/2) for WebGL. Note: pmouseY will be reset to the current mouseY\nvalue at the start of each touch event.</p>\n",itemtype:"property",name:"pmouseY",type:"Number",readonly:"",example:["\n<div>\n<code>\nfunction draw() {\n  background(237, 34, 93);\n  fill(0);\n  //draw a square only if the mouse is not moving\n  if (mouseY === pmouseY && mouseX === pmouseX) {\n    rect(20, 20, 60, 60);\n  }\n\n  print(pmouseY + ' -> ' + mouseY);\n}\n</code>\n</div>"],alt:"60x60 black rect center, fuchsia background. rect flickers on mouse movement",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:141,description:"<p>The system variable winMouseX always contains the current horizontal\nposition of the mouse, relative to (0, 0) of the window.</p>\n",itemtype:"property",name:"winMouseX",type:"Number",readonly:"",example:["\n<div>\n<code>\nlet myCanvas;\n\nfunction setup() {\n  //use a variable to store a pointer to the canvas\n  myCanvas = createCanvas(100, 100);\n  const body = document.getElementsByTagName('body')[0];\n  myCanvas.parent(body);\n}\n\nfunction draw() {\n  background(237, 34, 93);\n  fill(0);\n\n  //move the canvas to the horizontal mouse position\n  //relative to the window\n  myCanvas.position(winMouseX + 1, windowHeight / 2);\n\n  //the y of the square is relative to the canvas\n  rect(20, mouseY, 60, 60);\n}\n</code>\n</div>"],alt:"60x60 black rect y moves with mouse y and fuchsia canvas moves with mouse x",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:180,description:"<p>The system variable winMouseY always contains the current vertical\nposition of the mouse, relative to (0, 0) of the window.</p>\n",itemtype:"property",name:"winMouseY",type:"Number",readonly:"",example:["\n<div>\n<code>\nlet myCanvas;\n\nfunction setup() {\n  //use a variable to store a pointer to the canvas\n  myCanvas = createCanvas(100, 100);\n  const body = document.getElementsByTagName('body')[0];\n  myCanvas.parent(body);\n}\n\nfunction draw() {\n  background(237, 34, 93);\n  fill(0);\n\n  //move the canvas to the vertical mouse position\n  //relative to the window\n  myCanvas.position(windowWidth / 2, winMouseY 
21+ 1);\n\n  //the x of the square is relative to the canvas\n  rect(mouseX, 20, 60, 60);\n}\n</code>\n</div>"],alt:"60x60 black rect x moves with mouse x and fuchsia canvas y moves with mouse y",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:219,description:"<p>The system variable pwinMouseX always contains the horizontal position\nof the mouse in the frame previous to the current frame, relative to\n(0, 0) of the window. Note: pwinMouseX will be reset to the current winMouseX\nvalue at the start of each touch event.</p>\n",itemtype:"property",name:"pwinMouseX",type:"Number",readonly:"",example:["\n<div>\n<code>\nlet myCanvas;\n\nfunction setup() {\n  //use a variable to store a pointer to the canvas\n  myCanvas = createCanvas(100, 100);\n  noStroke();\n  fill(237, 34, 93);\n}\n\nfunction draw() {\n  clear();\n  //the difference between previous and\n  //current x position is the horizontal mouse speed\n  let speed = abs(winMouseX - pwinMouseX);\n  //change the size of the circle\n  //according to the horizontal speed\n  ellipse(50, 50, 10 + speed * 5, 10 + speed * 5);\n  //move the canvas to the mouse position\n  myCanvas.position(winMouseX + 1, winMouseY + 1);\n}\n</code>\n</div>"],alt:"fuchsia ellipse moves with mouse x and y. Grows and shrinks with mouse speed",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:260,description:"<p>The system variable pwinMouseY always contains the vertical position of\nthe mouse in the frame previous to the current frame, relative to (0, 0)\nof the window. Note: pwinMouseY will be reset to the current winMouseY\nvalue at the start of each touch event.</p>\n",itemtype:"property",name:"pwinMouseY",type:"Number",readonly:"",example:["\n<div>\n<code>\nlet myCanvas;\n\nfunction setup() {\n  //use a variable to store a pointer to the canvas\n  myCanvas = createCanvas(100, 100);\n  noStroke();\n  fill(237, 34, 93);\n}\n\nfunction draw() {\n  clear();\n  //the difference between previous and\n  //current y position is the vertical mouse speed\n  let speed = abs(winMouseY - pwinMouseY);\n  //change the size of the circle\n  //according to the vertical speed\n  ellipse(50, 50, 10 + speed * 5, 10 + speed * 5);\n  //move the canvas to the mouse position\n  myCanvas.position(winMouseX + 1, winMouseY + 1);\n}\n</code>\n</div>"],alt:"fuchsia ellipse moves with mouse x and y. Grows and shrinks with mouse speed",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:302,description:"<p>Processing automatically tracks if the mouse button is pressed and which\nbutton is pressed. The value of the system variable mouseButton is either\nLEFT, RIGHT, or CENTER depending on which button was pressed last.\nWarning: different browsers may track mouseButton differently.</p>\n",itemtype:"property",name:"mouseButton",type:"Constant",readonly:"",example:["\n<div>\n<code>\nfunction draw() {\n  background(237, 34, 93);\n  fill(0);\n\n  if (mouseIsPressed) {\n    if (mouseButton === LEFT) {\n      ellipse(50, 50, 50, 50);\n    }\n    if (mouseButton === RIGHT) {\n      rect(25, 25, 50, 50);\n    }\n    if (mouseButton === CENTER) {\n      triangle(23, 75, 50, 20, 78, 75);\n    }\n  }\n\n  print(mouseButton);\n}\n</code>\n</div>"],alt:"50x50 black ellipse appears on center of fuchsia canvas on mouse click/press.",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:341,description:"<p>The boolean system variable mouseIsPressed is true if the mouse is pressed\nand false if not.</p>\n",itemtype:"property",name:"mouseIsPressed",type:"Boolean",readonly:"",example:["\n<div>\n<code>\nfunction draw() {\n  background(237, 34, 93);\n  fill(0);\n\n  if (mouseIsPressed) {\n    ellipse(50, 50, 50, 50);\n  } else {\n    rect(25, 25, 50, 50);\n  }\n\n  print(mouseIsPressed);\n}\n</code>\n</div>"],alt:"black 50x50 rect becomes ellipse with mouse click/press. fuchsia background.",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:432,description:'<p>The <a href="#/p5/mouseMoved">mouseMoved()</a> function is called every time the mouse moves and a mouse\nbutton is not pressed.<br><br>\nBrowsers may have different default\nbehaviors attached to various mouse events. To prevent any default\nbehavior for this event, add &quot;return false&quot; to the end of the method.</p>\n',itemtype:"method",name:"mouseMoved",params:[{name:"event",description:"<p>optional MouseEvent callback argument.</p>\n",type:"Object",optional:!0}],example:['\n<div>\n<code>
21\n// Move the mouse across the page\n// to change its value\n\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction mouseMoved() {\n  value = value + 5;\n  if (value > 255) {\n    value = 0;\n  }\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\nfunction mouseMoved() {\n  ellipse(mouseX, mouseY, 5, 5);\n  // prevent default\n  return false;\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\n// returns a MouseEvent object\n// as a callback argument\nfunction mouseMoved(event) {\n  console.log(event);\n}\n</code>\n</div>'],alt:"black 50x50 rect becomes lighter with mouse movements until white then resets\nno image displayed",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:487,description:'<p>The <a href="#/p5/mouseDragged">mouseDragged()</a> function is called once every time the mouse moves and\na mouse button is pressed. If no <a href="#/p5/mouseDragged">mouseDragged()</a> function is defined, the\n<a href="#/p5/touchMoved">touchMoved()</a> function will be called instead if it is defined.<br><br>\nBrowsers may have different default\nbehaviors attached to various mouse events. To prevent any default\nbehavior for this event, add &quot;return false&quot; to the end of the method.</p>\n',itemtype:"method",name:"mouseDragged",params:[{name:"event",description:"<p>optional MouseEvent callback argument.</p>\n",type:"Object",optional:!0}],example:['\n<div>\n<code>\n// Drag the mouse across the page\n// to change its value\n\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction mouseDragged() {\n  value = value + 5;\n  if (value > 255) {\n    value = 0;\n  }\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\nfunction mouseDragged() {\n  ellipse(mouseX, mouseY, 5, 5);\n  // prevent default\n  return false;\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\n// returns a MouseEvent object\n// as a callback argument\nfunction mouseDragged(event) {\n  console.log(event);\n}\n</code>\n</div>'],alt:"black 50x50 rect turns lighter with mouse click and drag until white, resets\nno image displayed",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/mouse.js",line:568,description:'<p>The <a href="#/p5/mousePressed">mousePressed()</a> function is called once after every time a mouse button\nis pressed. The mouseButton variable (see the related reference entry)\ncan be used to determine which button has been pressed. If no\n<a href="#/p5/mousePressed">mousePressed()</a> function is defined, the <a href="#/p5/touchStarted">touchStarted()</a> function will be\ncalled instead if it is defined.<br><br>\nBrowsers may have different default\nbehaviors attached to various mouse events. To prevent any default\nbehavior for this event, add &quot;return false&quot; to the end of the method.</p>\n',itemtype:"method",name:"mousePressed",params:[{name:"event",description:"<p>optional MouseEvent callback argument.</p>\n",type:"Object",optional:!0}],example:['\n<div>\n<code>\n// Click within the image to change\n// the value of the rectangle\n\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction mousePressed() {\n  if (value === 0) {\n    value = 255;\n  } else {\n    value = 0;\n  }\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\nfunction mousePressed() {\n  ellipse(mouseX, mouseY, 5, 5);\n  // prevent default\n  return false;\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\n// returns a MouseEvent object\n// as a callback argument\nfunction mousePressed(event) {\n  console.log(event);\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:650,description:'<p>The <a href="#/p5/mouseReleased">mouseReleased()</a> function is called every time a mouse button is\nreleased. If no <a href="#/p5/mouseReleased">mouseReleased()</a> function is defined, the <a href="#/p5/touchEnded">touchEnded()</a>\nfunction will be called instead if it is defined.<br><br>\nBrowsers may have different default\nbehaviors attached to various mouse events. To prevent any default\nbehavior for this event, add &quot;return false&quot; to the end of the method.</p>\n',itemtype:"method",name:"mouseReleased",params:[{name:"event",description:"<p>optional MouseEvent callback argument.</p>\n",type:"Object",optional:!0}],example:['\n<div>\n<code>\n// Click within the image to change\n// the value of the rectangle\n/
21/ after the mouse has been clicked\n\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction mouseReleased() {\n  if (value === 0) {\n    value = 255;\n  } else {\n    value = 0;\n  }\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\nfunction mouseReleased() {\n  ellipse(mouseX, mouseY, 5, 5);\n  // prevent default\n  return false;\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\n// returns a MouseEvent object\n// as a callback argument\nfunction mouseReleased(event) {\n  console.log(event);\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:728,description:'<p>The <a href="#/p5/mouseClicked">mouseClicked()</a> 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 <a href="#/p5/mousePressed">mousePressed()</a> or <a href="#/p5/mouseReleased">mouseReleased()</a>.<br><br>\nBrowsers may have different default\nbehaviors attached to various mouse events. To prevent any default\nbehavior for this event, add &quot;return false&quot; to the end of the method.</p>\n',itemtype:"method",name:"mouseClicked",params:[{name:"event",description:"<p>optional MouseEvent callback argument.</p>\n",type:"Object",optional:!0}],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\nlet 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>\n\n<div class="norender">\n<code>\n// returns a MouseEvent object\n// as a callback argument\nfunction mouseClicked(event) {\n  console.log(event);\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:798,description:'<p>The <a href="#/p5/doubleClicked">doubleClicked()</a> function is executed every time a event\nlistener has detected a dblclick event which is a part of the\nDOM L3 specification. The doubleClicked event is fired when a\npointing device button (usually a mouse&#39;s primary button)\nis clicked twice on a single element. For more info on the\ndblclick event refer to mozilla&#39;s documentation here:\n<a href="https://developer.mozilla.org/en-US/docs/Web/Events/dblclick">https://developer.mozilla.org/en-US/docs/Web/Events/dblclick</a></p>\n',itemtype:"method",name:"doubleClicked",params:[{name:"event",description:"<p>optional MouseEvent callback argument.</p>\n",type:"Object",optional:!0}],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\nlet 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>\n\n<div class="norender">\n<code>\n// returns a MouseEvent object\n// as a callback argument\nfunction doubleClicked(event) {\n  console.log(event);\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:883,description:'<p>The function <a href="#/p5/mouseWheel">mouseWheel()</a> is executed every time a vertical mouse wheel\nevent is detected either triggered by an actual mouse wheel or by a\ntouchpad.<br><br>\nThe event.delta property returns the amount the mouse wheel\nhave scrolled. The values can be positive or negative depending on the\nscroll direction (on OS X with &quot;natural&quot; scrolling enabled, the signs\nare inverted).<br><br>\nBrowsers may have different default behaviors attached to various\nmouse events. To prevent any default behavior for this event, add\n&quot;return false&quot; to the end of the method.<br><br>\nDue to the current support of the &quot;wheel&quot; event on Safari, the function\nmay only work as expected if &quot;return false&quot; is included while using Safari.</p>\n',itemtype:"method",name:"mouseWheel",params:[{name:"event",description:"<p>optional WheelEvent callback argument.</p>\n",type:"Object",optional:!0}],example:["\n<div>\n<code>\nlet 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>
21"],alt:"black 50x50 rect moves up and down with vertical scroll. fuchsia background",class:"p5",module:"Events",submodule:"Mouse"},{file:"src/events/touch.js",line:12,description:"<p>The system variable touches[] contains an array of the positions of all\ncurrent touch points, relative to (0, 0) of the canvas, and IDs identifying a\nunique touch as it moves. Each element in the array is an object with x, y,\nand id properties.</p>\n<p>The touches[] array is not supported on Safari and IE on touch-based\ndesktops (laptops).</p>\n",itemtype:"property",name:"touches",type:"Object[]",readonly:"",example:["\n<div>\n<code>\n// On a touchscreen device, touch\n// the canvas using one or more fingers\n// at the same time\nfunction draw() {\n  clear();\n  let display = touches.length + ' touches';\n  text(display, 5, 10);\n}\n</code>\n</div>"],alt:"Number of touches currently registered are displayed on the canvas",class:"p5",module:"Events",submodule:"Touch"},{file:"src/events/touch.js",line:74,description:'<p>The touchStarted() function is called once after every time a touch is\nregistered. If no <a href="#/p5/touchStarted">touchStarted()</a> function is defined, the <a href="#/p5/mousePressed">mousePressed()</a>\nfunction will be called instead if it is defined.<br><br>\nBrowsers may have different default behaviors attached to various touch\nevents. To prevent any default behavior for this event, add &quot;return false&quot;\nto the end of the method.</p>\n',itemtype:"method",name:"touchStarted",params:[{name:"event",description:"<p>optional TouchEvent callback argument.</p>\n",type:"Object",optional:!0}],example:['\n<div>\n<code>\n// Touch within the image to change\n// the value of the rectangle\n\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction touchStarted() {\n  if (value === 0) {\n    value = 255;\n  } else {\n    value = 0;\n  }\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\nfunction touchStarted() {\n  ellipse(mouseX, mouseY, 5, 5);\n  // prevent default\n  return false;\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\n// returns a TouchEvent object\n// as a callback argument\nfunction touchStarted(event) {\n  console.log(event);\n}\n</code>\n</div>'],alt:"50x50 black rect turns white with touch event.\nno image displayed",class:"p5",module:"Events",submodule:"Touch"},{file:"src/events/touch.js",line:154,description:'<p>The <a href="#/p5/touchMoved">touchMoved()</a> function is called every time a touch move is registered.\nIf no <a href="#/p5/touchMoved">touchMoved()</a> function is defined, the <a href="#/p5/mouseDragged">mouseDragged()</a> function will\nbe called instead if it is defined.<br><br>\nBrowsers may have different default behaviors attached to various touch\nevents. To prevent any default behavior for this event, add &quot;return false&quot;\nto the end of the method.</p>\n',itemtype:"method",name:"touchMoved",params:[{name:"event",description:"<p>optional TouchEvent callback argument.</p>\n",type:"Object",optional:!0}],example:['\n<div>\n<code>\n// Move your finger across the page\n// to change its value\n\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction touchMoved() {\n  value = value + 5;\n  if (value > 255) {\n    value = 0;\n  }\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\nfunction touchMoved() {\n  ellipse(mouseX, mouseY, 5, 5);\n  // prevent default\n  return false;\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\n// returns a TouchEvent object\n// as a callback argument\nfunction touchMoved(event) {\n  console.log(event);\n}\n</code>\n</div>'],alt:"50x50 black rect turns lighter with touch until white. resets\nno image displayed",class:"p5",module:"Events",submodule:"Touch"},{file:"src/events/touch.js",line:227,description:'<p>The <a href="#/p5/touchEnded">touchEnded()</a> function is called every time a touch ends. If no\n<a href="#/p5/touchEnded">touchEnded()</a> function is defined, the <a href="#/p5/mouseReleased">mouseReleased()</a> function will be\ncalled instead if it is defined.<br><br>\nBrowsers may have different default behaviors attached to various touch\nevents. To prevent any default behavior for this event, add &quot;return false&quot;\nto the end of the method.</p>\n',itemtype:"method",name:"touchEnded",params:[{name:"event",description:"<p>optional TouchEvent callback argument.</p>\n",type:"Object",optional:!0}],example:['\n<div>\n<code>\n// Release touch within the image to\n// change the value of the rectangle\n\nlet value = 0;\nfunction draw() {\n  fill(value);\n  rect(25, 25, 50, 50);\n}\nfunction touchEnded() {\n  if (value === 0) {\n    value = 255;\n  } else {\n    value = 0;\n  }\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\nfunction touchEnded() {\n  ellipse(mouseX, mouseY, 5, 5);\n  // prevent default\n  return false;\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\n// returns a TouchEvent object\n// as a callback argument\nfunction touchEnded(event) {\n  console.log(event);\n}\n</code>\n</div>'],alt:"50x50 black rect turns white with touch.\nno image displayed",class:"p5",module:"Events",submodule:"Touch"},{file:"src/image/filters.js",line:3,description:'<p>This module defines the filters for use with image buffers.</p>\n<p>This module is basically a collection of functions stored in an object\nas opposed to modules. The functions are destructive, modifying\nthe passed in canvas rather than creating a copy.</p>\n<p>Generally speaking users of this module will use the Filters.apply method\non a canvas to create an effect.</p>\n<p>A number of functions are borrowed/adapted from\n<a href="http://www.html5rocks.com/en/tutorials/canvas/imagefilters/">http://www.html5rocks.com/en/tutorials/canvas/imagefilters/</a>\nor the java processing implementation.</p>\n',class:"p5",module:"Events"},{file:"src/image/image.js",line:8,description:'<p>This module defines the p5 methods for the <a href="#/p5.Image">p5.Image</a> class\nfor drawing images to the main display canvas.</p>\n',class:"p5",module:"Image",submodule:"Image"},{file:"src/image/image.js",line:22,description:'<p>Creates a new <a href="#/p5.Image">p5.Image</a> (the datatype for storing images). This provides a\nfresh buffer of pixels to play with. Set the size of the buffer with the\nwidth and height parameters.\n<br><br>\n.<a href="#/p5.Image/pixels">pixels</a> gives access to an array containing the values for all the pixels\nin the display window.\nThese values are numbers. This array is the size (including an appropriate\nfactor for the <a href="#/p5/pixelDensity">pixelDensity</a>) of the display window x4,\nrepresenting the R, G, B, A values in order for each pixel, mov
21ing from\nleft to right across each row, then down each column. See .<a href="#/p5.Image/pixels">pixels</a> for\nmore info. It may also be simpler to use <a href="#/p5.Image/set">set()</a> or <a href="#/p5.Image/get">get()</a>.\n<br><br>\nBefore accessing the pixels of an image, the data must loaded with the\n<a href="#/p5.Image/loadPixels">loadPixels()</a> function. After the array data has been modified, the\n<a href="#/p5.Image/updatePixels">updatePixels()</a> function must be run to update the changes.</p>\n',itemtype:"method",name:"createImage",params:[{name:"width",description:"<p>width in pixels</p>\n",type:"Integer"},{name:"height",description:"<p>height in pixels</p>\n",type:"Integer"}],return:{description:'the <a href="#/p5.Image">p5.Image</a> object',type:"p5.Image"},example:["\n<div>\n<code>\nlet img = createImage(66, 66);\nimg.loadPixels();\nfor (let i = 0; i < img.width; i++) {\n  for (let j = 0; j < img.height; j++) {\n    img.set(i, j, color(0, 90, 102));\n  }\n}\nimg.updatePixels();\nimage(img, 17, 17);\n</code>\n</div>\n\n<div>\n<code>\nlet img = createImage(66, 66);\nimg.loadPixels();\nfor (let i = 0; i < img.width; i++) {\n  for (let j = 0; j < img.height; j++) {\n    img.set(i, j, color(0, 90, 102, (i % img.width) * 2));\n  }\n}\nimg.updatePixels();\nimage(img, 17, 17);\nimage(img, 34, 34);\n</code>\n</div>\n\n<div>\n<code>\nlet pink = color(255, 102, 204);\nlet img = createImage(66, 66);\nimg.loadPixels();\nlet d = pixelDensity();\nlet halfImage = 4 * (img.width * d) * (img.height / 2 * d);\nfor (let i = 0; i < halfImage; i += 4) {\n  img.pixels[i] = red(pink);\n  img.pixels[i + 1] = green(pink);\n  img.pixels[i + 2] = blue(pink);\n  img.pixels[i + 3] = alpha(pink);\n}\nimg.updatePixels();\nimage(img, 17, 17);\n</code>\n</div>"],alt:"66x66 dark turquoise rect in center of canvas.\n2 gradated dark turquoise rects fade left. 1 center 1 bottom right of canvas\nno image displayed",class:"p5",module:"Image",submodule:"Image"},{file:"src/image/image.js",line:102,description:"<p>Save the current canvas as an image. The browser will either save the\nfile immediately, or prompt the user with a dialogue window.</p>\n",itemtype:"method",name:"saveCanvas",example:["\n <div class='norender notest'><code>\n function setup() {\n let c = createCanvas(100, 100);\n background(255, 0, 0);\n saveCanvas(c, 'myCanvas', 'jpg');\n }\n </code></div>\n <div class='norender notest'><code>\n // note that this example has the same result as above\n // if no canvas is specified, defaults to main canvas\n function setup() {\n let c = createCanvas(100, 100);\n background(255, 0, 0);\n saveCanvas('myCanvas', 'jpg');\n\n // all of the following are valid\n saveCanvas(c, 'myCanvas', 'jpg');\n saveCanvas(c, 'myCanvas.jpg');\n saveCanvas(c, 'myCanvas');\n saveCanvas(c);\n saveCanvas('myCanvas', 'png');\n saveCanvas('myCanvas');\n saveCanvas();\n }\n </code></div>"],alt:"no image displayed\n no image displayed\n no image displayed",class:"p5",module:"Image",submodule:"Image",overloads:[{line:102,params:[{name:"selectedCanvas",description:"<p>a variable\n                                representing a specific html5 canvas (optional)</p>\n",type:"p5.Element|HTMLCanvasElement"},{name:"filename",description:"",type:"String",optional:!0},{name:"extension",description:"<p>&#39;jpg&#39; or &#39;png&#39;</p>\n",type:"String",optional:!0}]},{line:144,params:[{name:"filename",description:"",type:"String",optional:!0},{name:"extension",description:"",type:"String",optional:!0}]}]},{file:"src/image/image.js",line:195,description:'<p>Capture a sequence of frames that can be used to create a movie.\nAccepts a callback. For example, you may wish to send the frames\nto a server where they can be stored or converted into a movie.\nIf no callback is provided, the browser will pop up save dialogues in an\nattempt to download all of the images that have just been created. With the\ncallback provided the image data isn&#39;t saved by default but instead passed\nas an argument to the callback function as an array of objects, with the\nsize of array equal to the total number of frames.</p>\n<p>Note that <a href="#/p5.Image/saveFrames">saveFrames()</a> will only save the first 15 frames of an animation.\nTo export longer animations, you might look into a library like\n<a href="https://github.com/spite/ccapture.
21js/">ccapture.js</a>.</p>\n',itemtype:"method",name:"saveFrames",params:[{name:"filename",description:"",type:"String"},{name:"extension",description:"<p>&#39;jpg&#39; or &#39;png&#39;</p>\n",type:"String"},{name:"duration",description:"<p>Duration in seconds to save the frames for.</p>\n",type:"Number"},{name:"framerate",description:"<p>Framerate to save the frames in.</p>\n",type:"Number"},{name:"callback",description:"<p>A callback function that will be executed\n                                to handle the image data. This function\n                                should accept an array as argument. The\n                                array will contain the specified number of\n                                frames of objects. Each object has three\n                                properties: imageData - an\n                                image/octet-stream, filename and extension.</p>\n",type:"Function(Array)",optional:!0}],example:["\n<div><code>\n function draw() {\n background(mouseX);\n }\n\n function mousePressed() {\n saveFrames('out', 'png', 1, 25, data => {\n   print(data);\n });\n }\n</code></div>"],alt:"canvas background goes from light to dark with mouse x.",class:"p5",module:"Image",submodule:"Image"},{file:"src/image/loading_displaying.js",line:17,description:'<p>Loads an image from a path and creates a <a href="#/p5.Image">p5.Image</a> from it.\n<br><br>\nThe image may not be immediately available for rendering\nIf you want to ensure that the image is ready before doing\nanything with it, place the <a href="#/p5/loadImage">loadImage()</a> call in <a href="#/p5/preload">preload()</a>.\nYou may also supply a callback function to handle the image when it&#39;s ready.\n<br><br>\nThe path to the image should be relative to the HTML file\nthat links in your sketch. Loading an image from a URL or other\nremote location may be blocked due to your browser&#39;s built-in\nsecurity.</p>\n',itemtype:"method",name:"loadImage",params:[{name:"path",description:"<p>Path of the image to be loaded</p>\n",type:"String"},{name:"successCallback",description:'<p>Function to be called once\n                               the image is loaded. Will be passed the\n                               <a href="#/p5.Image">p5.Image</a>.</p>\n',type:"function(p5.Image)",optional:!0},{name:"failureCallback",description:"<p>called with event error if\n                               the image fails to load.</p>\n",type:"Function(Event)",optional:!0}],return:{description:'the <a href="#/p5.Image">p5.Image</a> object',type:"p5.Image"},example:["\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/laDefense.jpg');\n}\nfunction setup() {\n  image(img, 0, 0);\n}\n</code>\n</div>\n<div>\n<code>\nfunction setup() {\n  // here we use a callback to display the image after loading\n  loadImage('assets/laDefense.jpg', img => {\n    image(img, 0, 0);\n  });\n}\n</code>\n</div>"],alt:"image of the underside of a white umbrella and grided ceililng above\nimage of the underside of a white umbrella and grided ceililng above",class:"p5",module:"Image",submodule:"Loading & Displaying"},{file:"src/image/loading_displaying.js",line:127,description:'<p>Draw an image to the p5.js canvas.</p>\n<p>This function can be used with different numbers of parameters. The\nsimplest use requires only three parameters: img, x, and y—where (x, y) is\nthe position of the image. Two more parameters can optionally be added to\nspecify the width and height of the image.</p>\n<p>This function can also be used with all eight Number parameters. To\ndifferentiate between all these parameters, p5.js uses the language of\n&quot;destination rectangle&quot; (which corresponds to &quot;dx&quot;, &quot;dy&quot;, etc.) and &quot;source\nimage&quot; (which corresponds to &quot;sx&quot;, &quot;sy&quot;, etc.) below. Specifying the\n&quot;source image&quot; dimensions can be useful when you want to display a\nsubsection of the source image instead of the whole thing. Here&#39;s a diagram\nto explain further:\n<img src="assets/drawImage.png"></img></p>\n',itemtype:"method",name:"image",example:["\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/laDefense.jpg');\n}\nfunction setup() {\n  // Top-left corner of the img is at (0, 0)\n  // Width and height are the img's original width and height\n  image(img, 0, 0);\n}\n</code>\n</div>\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/laDefense.jpg');\n}\nfunction setup() {\n  background(50);\n  // Top-left corner of the img is at (10, 10)\n  // Width and height are 50 x 50\n  image(img, 
2110, 10, 50, 50);\n}\n</code>\n</div>\n<div>\n<code>\nfunction setup() {\n  // Here, we use a callback to display the image after loading\n  loadImage('assets/laDefense.jpg', img => {\n    image(img, 0, 0);\n  });\n}\n</code>\n</div>\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/gradient.png');\n}\nfunction setup() {\n  // 1. Background image\n  // Top-left corner of the img is at (0, 0)\n  // Width and height are the img's original width and height, 100 x 100\n  image(img, 0, 0);\n  // 2. Top right image\n  // Top-left corner of destination rectangle is at (50, 0)\n  // Destination rectangle width and height are 40 x 20\n  // The next parameters are relative to the source image:\n  // - Starting at position (50, 50) on the source image, capture a 50 x 50\n  // subsection\n  // - Draw this subsection to fill the dimensions of the destination rectangle\n  image(img, 50, 0, 40, 20, 50, 50, 50, 50);\n}\n</code>\n</div>"],alt:"image of the underside of a white umbrella and gridded ceiling above\nimage of the underside of a white umbrella and gridded ceiling above",class:"p5",module:"Image",submodule:"Loading & Displaying",overloads:[{line:127,params:[{name:"img",description:"<p>the image to display</p>\n",type:"p5.Image|p5.Element"},{name:"x",description:"<p>the x-coordinate of the top-left corner of the image</p>\n",type:"Number"},{name:"y",description:"<p>the y-coordinate of the top-left corner of the image</p>\n",type:"Number"},{name:"width",description:"<p>the width to draw the image</p>\n",type:"Number",optional:!0},{name:"height",description:"<p>the height to draw the image</p>\n",type:"Number",optional:!0}]},{line:215,params:[{name:"img",description:"",type:"p5.Image|p5.Element"},{name:"dx",description:"<p>the x-coordinate of the destination\n                          rectangle in which to draw the source image</p>\n",type:"Number"},{name:"dy",description:"<p>the y-coordinate of the destination\n                          rectangle in which to draw the source image</p>\n",type:"Number"},{name:"dWidth",description:"<p>the width of the destination rectangle</p>\n",type:"Number"},{name:"dHeight",description:"<p>the height of the destination rectangle</p>\n",type:"Number"},{name:"sx",description:"<p>the x-coordinate of the subsection of the source\nimage to draw into the destination rectangle</p>\n",type:"Number"},{name:"sy",description:"<p>the y-coordinate of the subsection of the source\nimage to draw into the destination rectangle</p>\n",type:"Number"},{name:"sWidth",description:"<p>the width of the subsection of the\n                          source image to draw into the destination\n                          rectangle</p>\n",type:"Number",optional:!0},{name:"sHeight",description:"<p>the height of the subsection of the\n                           source image to draw into the destination rectangle</p>\n",type:"Number",optional:!0}]}]},{file:"src/image/loading_displaying.js",line:298,description:'<p>Sets the fill value for displaying images. Images can be tinted to\nspecified colors or made transparent by including an alpha value.\n<br><br>\nTo apply transparency to an image without affecting its color, use\nwhite as the tint color and specify an alpha value. For instance,\ntint(255, 128) will make an image 50% transparent (assuming the default\nalpha range of 0-255, which can be changed with <a href="#/p5/colorMode">colorMode()</a>).\n<br><br>\nThe value for the gray parameter must be less than or equal to the current\nmaximum value as specified by <a href="#/p5/colorMode">colorMode()</a>. The default maximum value is\n255.</p>\n',itemtype:"method",name:"tint",example:["\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/laDefense.jpg');\n}\nfunction setup() {\n  image(img, 0, 0);\n  tint(0, 153, 204); // Tint blue\n  image(img, 50, 0);\n}\n</code>\n</div>\n\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/laDefense.jpg');\n}\nfunction setup() {\n  image(img, 0, 0);\n  tint(0, 153, 204, 126); // Tint blue and set transparency\n  image(img, 50, 0);\n}\n</code>\n</div>\n\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/laDefense.jpg');\n}\nfunction setup() {\n  image(img, 0, 0);\n  tint(255, 126); // Apply transparency without changing color\n  image(img, 50, 0);\n}\n</code>\n</div>"],alt:"2 side by side images of umbrella and ceiling, one image with blue tint\nImages of umbrella and ceiling, one half of image with blue tint\n2 side by side images of umbrella and ceiling, one image translucent",class:"p5",module:"Image",submodule:"Loading & Displaying",overloads:[{line:298,params:[{name:"v1",description:"<p>red or hue value relative to\n                                the current color range</p>\n",type:"Number"},{name:"v2",description:"<p>
21green or saturation value\n                                relative to the current color range</p>\n",type:"Number"},{name:"v3",description:"<p>blue or brightness value\n                                relative to the current color range</p>\n",type:"Number"},{name:"alpha",description:"",type:"Number",optional:!0}]},{line:371,params:[{name:"value",description:"<p>a color string</p>\n",type:"String"}]},{line:376,params:[{name:"gray",description:"<p>a gray value</p>\n",type:"Number"},{name:"alpha",description:"",type:"Number",optional:!0}]},{line:382,params:[{name:"values",description:"<p>an array containing the red,green,blue &amp;\n                                and alpha components of the color</p>\n",type:"Number[]"}]},{line:388,params:[{name:"color",description:"<p>the tint color</p>\n",type:"p5.Color"}]}]},{file:"src/image/loading_displaying.js",line:398,description:"<p>Removes the current fill value for displaying images and reverts to\ndisplaying images with their original hues.</p>\n",itemtype:"method",name:"noTint",example:["\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/bricks.jpg');\n}\nfunction setup() {\n  tint(0, 153, 204); // Tint blue\n  image(img, 0, 0);\n  noTint(); // Disable tint\n  image(img, 50, 0);\n}\n</code>\n</div>"],alt:"2 side by side images of bricks, left image with blue tint",class:"p5",module:"Image",submodule:"Loading & Displaying"},{file:"src/image/loading_displaying.js",line:464,description:'<p>Set image mode. Modifies the location from which images are drawn by\nchanging the way in which parameters given to <a href="#/p5/image">image()</a> are interpreted.\nThe default mode is imageMode(CORNER), which interprets the second and\nthird parameters of <a href="#/p5/image">image()</a> as the upper-left corner of the image. If\ntwo additional parameters are specified, they are used to set the image&#39;s\nwidth and height.\n<br><br>\nimageMode(CORNERS) interprets the second and third parameters of <a href="#/p5/image">image()</a>\nas the location of one corner, and the fourth and fifth parameters as the\nopposite corner.\n<br><br>\nimageMode(CENTER) interprets the second and third parameters of <a href="#/p5/image">image()</a>\nas the image&#39;s center point. If two additional parameters are specified,\nthey are used to set the image&#39;s width and height.</p>\n',itemtype:"method",name:"imageMode",params:[{name:"mode",description:"<p>either CORNER, CORNERS, or CENTER</p>\n",type:"Constant"}],example:["\n\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/bricks.jpg');\n}\nfunction setup() {\n  imageMode(CORNER);\n  image(img, 10, 10, 50, 50);\n}\n</code>\n</div>\n\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/bricks.jpg');\n}\nfunction setup() {\n  imageMode(CORNERS);\n  image(img, 10, 10, 90, 40);\n}\n</code>\n</div>\n\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/bricks.jpg');\n}\nfunction setup() {\n  imageMode(CENTER);\n  image(img, 50, 50, 80, 80);\n}\n</code>\n</div>"],alt:"small square image of bricks\nhorizontal rectangle image of bricks\nlarge square image of bricks",class:"p5",module:"Image",submodule:"Loading & Displaying"},{file:"src/image/p5.Image.js",line:9,description:'<p>This module defines the <a href="#/p5.Image">p5.Image</a> class and P5 methods for\ndrawing images to the main display canvas.</p>\n',class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:90,description:"<p>Image width.</p>\n",itemtype:"property",name:"width",type:"Number",readonly:"",example:["\n<div><code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n  createCanvas(100, 100);\n  image(img, 0, 0);\n  for (let i = 0; i < img.width; i++) {\n    let c = img.get(i, img.height / 2);\n    stroke(c);\n    line(i, height / 2, i, height);\n  }\n}\n</code></div>"],alt:"rocky mountains in top and horizontal lines in corresponding colors in bottom.",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:117,description:"<p>Image height.</p>\n",itemtype:"property",name:"height",type:"Number",readonly:"",example:["\n<div><code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n  createCanvas(100, 100);\n  image(img, 0, 0);\n  for (let i = 0;
21 i < img.height; i++) {\n    let c = img.get(img.width / 2, i);\n    stroke(c);\n    line(0, i, width / 2, i);\n  }\n}\n</code></div>"],alt:"rocky mountains on right and vertical lines in corresponding colors on left.",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:153,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">let d = pixelDensity();\nfor (let i = 0; i &lt; d; i++) {\n  for (let j = 0; j &lt; d; j++) {\n    // loop over\n    index = 4 * ((y * d + j) * width * d + (x * d + i
21));\n    pixels[index] = r;\n    pixels[index+1] = g;\n    pixels[index+2] = b;\n    pixels[index+3] = a;\n  }\n}\n</code></pre>\n<p><br><br>\nBefore accessing this array, the data must loaded with the <a href="#/p5.Image/loadPixels">loadPixels()</a>\nfunction. After the array data has been modified, the <a href="#/p5.Image/updatePixels">updatePixels()</a>\nfunction must be run to update the changes.</p>\n',itemtype:"property",name:"pixels",type:"Number[]",example:["\n<div>\n<code>\nlet img = createImage(66, 66);\nimg.loadPixels();\nfor (let i = 0; i < img.width; i++) {\n  for (let 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>\nlet pink = color(255, 102, 204);\nlet img = createImage(66, 66);\nimg.loadPixels();\nfor (let 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:223,description:"<p>Helper fxn for sharing pixel methods</p>\n",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:232,description:"<p>Loads the pixels data for this image into the [pixels] attribute.</p>\n",itemtype:"method",name:"loadPixels",example:["\n<div><code>\nlet myImage;\nlet halfImage;\n\nfunction preload() {\n  myImage = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n  myImage.loadPixels();\n  halfImage = 4 * myImage.width * myImage.height / 2;\n  for (let 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, width, height);\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:268,description:"<p>Updates the backing canvas for this image with the contents of\nthe [pixels] array.</p>\n",itemtype:"method",name:"updatePixels",example:["\n<div><code>\nlet myImage;\nlet halfImage;\n\nfunction preload() {\n  myImage = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n  myImage.loadPixels();\n  halfImage = 4 * myImage.width * myImage.height / 2;\n  for (let 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, width, height);\n}\n</code></div>"],alt:"2 images of rocky mountains vertically stacked",class:"p5.Image",module:"Image",submodule:"Image",overloads:[{line:268,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:308,params:[]}]},{file:"src/image/p5.Image.js",line:316,description:'<p>Get a region of pixels from an image.</p>\n<p>If no params are passed, the 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 <a href="#/p5.Image">p5.Image</a>\nis returned.</p>\n',itemtype:"method",name:"get",return:{description:'the rectangle <a href="#/p5.Image">p5.Image</a>',type:"p5.Image"},example:["\n<div><code>\nlet myImage;\nlet c;\n\nfunction preload() {\n  myImage = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n  background(myImage);\n  noStroke();\n  c = myImage.get(60, 90);\n  fill(c);\n  rect(25, 25, 50, 50);\n}\n\n//get() returns color here\n</code></div>"],alt:"image of rocky mountains with 50x50 green rect in front",class:"p5.Image",module:"Image",submodule:"Image",overloads:[{line:316,params:[{name:"x",description:"<p>x-coordinate of the pixel</p>\n",type:"Number"},{name:"y",description:"<p>y-coordinate of the pixel</p>\n",type:"Number"},{name:"w",description:"<p>width</p>\n",type:"Number"}
21,{name:"h",description:"<p>height</p>\n",type:"Number"}],return:{description:'the rectangle <a href="#/p5.Image">p5.Image</a>',type:"p5.Image"}},{line:354,params:[],return:{description:'the whole <a href="#/p5.Image">p5.Image</a>',type:"p5.Image"}},{line:358,params:[{name:"x",description:"",type:"Number"},{name:"y",description:"",type:"Number"}],return:{description:"color of pixel at x,y in array format [R, G, B, A]",type:"Number[]"}}]},{file:"src/image/p5.Image.js",line:371,description:'<p>Set the color of a single pixel or write an image into\nthis <a href="#/p5.Image">p5.Image</a>.</p>\n<p>Note that for a large number of pixels this will\nbe slower than directly manipulating the pixels array\nand then calling <a href="#/p5.Image/updatePixels">updatePixels()</a>.</p>\n',itemtype:"method",name:"set",params:[{name:"x",description:"<p>x-coordinate of the pixel</p>\n",type:"Number"},{name:"y",description:"<p>y-coordinate of the pixel</p>\n",type:"Number"},{name:"a",description:'<p>grayscale value | pixel array |\n                               a <a href="#/p5.Color">p5.Color</a> | image to copy</p>\n',type:"Number|Number[]|Object"}],example:["\n<div>\n<code>\nlet img = createImage(66, 66);\nimg.loadPixels();\nfor (let i = 0; i < img.width; i++) {\n  for (let j = 0; j < img.height; j++) {\n    img.set(i, j, color(0, 90, 102, (i % img.width) * 2));\n  }\n}\nimg.updatePixels();\nimage(img, 17, 17);\nimage(img, 34, 34);\n</code>\n</div>"],alt:"2 gradated dark turquoise rects fade left. 1 center 1 bottom right of canvas",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:409,description:"<p>Resize the image to a new width and height. To make the image scale\nproportionally, use 0 as the value for the wide or high parameter.\nFor instance, to make the width of an image 150 pixels, and change\nthe height using the same proportion, use resize(150, 0).</p>\n",itemtype:"method",name:"resize",params:[{name:"width",description:"<p>the resized image width</p>\n",type:"Number"},{name:"height",description:"<p>the resized image height</p>\n",type:"Number"}],example:["\n<div><code>\nlet img;\n\nfunction preload() {\n  img = loadImage('assets/rockies.jpg');\n}\n\nfunction draw() {\n  image(img, 0, 0);\n}\n\nfunction mousePressed() {\n  img.resize(50, 100);\n}\n</code></div>"],alt:"image of rocky mountains. zoomed in",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:494,description:"<p>Copies a region of pixels from one image to another. If no\nsrcImage is specified this is used as the source. If the source\nand destination regions aren&#39;t the same size, it will\nautomatically resize source pixels to fit the specified\ntarget region.</p>\n",itemtype:"method",name:"copy",example:["\n<div><code>\nlet photo;\nlet bricks;\nlet x;\nlet y;\n\nfunction preload() {\n  photo = loadImage('assets/rockies.jpg');\n  bricks = loadImage('assets/bricks.jpg');\n}\n\nfunction setup() {\n  x = bricks.width / 2;\n  y = bricks.height / 2;\n  photo.copy(bricks, 0, 0, x, y, 0, 0, x, y);\n  image(photo, 0, 0);\n}\n</code></div>"],alt:"image of rocky mountains and smaller image on top of bricks at top left",class:"p5.Image",module:"Image",submodule:"Image",overloads:[{line:494,params:[{name:"srcImage",description:"<p>source image</p>\n",type:"p5.Image|p5.Element"},{name:"sx",description:"<p>X coordinate of the source&#39;s upper left corner</p>\n",type:"Integer"},{name:"sy",description:"<p>Y coordinate of the source&#39;s upper left corner</p>\n",type:"Integer"},{name:"sw",description:"<p>source image width</p>\n",type:"Integer"},{name:"sh",description:"<p>source image height</p>\n",type:"Integer"},{name:"dx",description:"<p>X coordinate of the destination&#39;s upper left corner</p>\n",type:"Integer"},{name:"dy",description:"<p>Y coordinate of the destination&#39;s upper left corner</p>\n",type:"Integer"},{name:"dw",description:"<p>destination image width</p>\n",type:"Integer"},{name:"dh",description:"<p>destination image height</p>\n",type:"Integer"}]},{line:535,params:[{name:"sx",description:"",type:"Integer"},{name:"sy",description:"",type:"Integer"},{name:"sw",description:"",type:"Integer"},{name:"sh",description:"",type:"Integer"},{name:"dx",description:"",type:"Integer"},{name:"dy",description:"",type:"Integer"}
21,{name:"dw",description:"",type:"Integer"},{name:"dh",description:"",type:"Integer"}]}]},{file:"src/image/p5.Image.js",line:575,description:"<p>Masks part of an image from displaying by loading another\nimage and using it&#39;s alpha channel as an alpha channel for\nthis image.</p>\n",itemtype:"method",name:"mask",params:[{name:"srcImage",description:"<p>source image</p>\n",type:"p5.Image"}],example:["\n<div><code>\nlet photo, maskImage;\nfunction preload() {\n  photo = loadImage('assets/rockies.jpg');\n  maskImage = loadImage('assets/mask2.png');\n}\n\nfunction setup() {\n  createCanvas(100, 100);\n  photo.mask(maskImage);\n  image(photo, 0, 0);\n}\n</code></div>"],alt:"image of rocky mountains with white at right\n\n\nhttp://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:638,description:'<p>Applies an image filter to a <a href="#/p5.Image">p5.Image</a></p>\n',itemtype:"method",name:"filter",params:[{name:"filterType",description:"<p>either THRESHOLD, GRAY, OPAQUE, INVERT,\n                               POSTERIZE, BLUR, ERODE, DILATE or BLUR.\n                               See Filters.js for docs on\n                               each available filter</p>\n",type:"Constant"},{name:"filterParam",description:"<p>an optional parameter unique\n                               to each filter, see above</p>\n",type:"Number",optional:!0}],example:["\n<div><code>\nlet photo1;\nlet photo2;\n\nfunction preload() {\n  photo1 = loadImage('assets/rockies.jpg');\n  photo2 = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n  photo2.filter(GRAY);\n  image(photo1, 0, 0);\n  image(photo2, width / 2, 0);\n}\n</code></div>"],alt:"2 images of rocky mountains left one in color, right in black and white",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/p5.Image.js",line:674,description:"<p>Copies a region of pixels from one image to another, using a specified\nblend mode to do the operation.</p>\n",itemtype:"method",name:"blend",example:["\n<div><code>\nlet mountains;\nlet bricks;\n\nfunction preload() {\n  mountains = loadImage('assets/rockies.jpg');\n  bricks = loadImage('assets/bricks_third.jpg');\n}\n\nfunction setup() {\n  mountains.blend(bricks, 0, 0, 33, 100, 67, 0, 33, 100, ADD);\n  image(mountains, 0, 0);\n  image(bricks, 0, 0);\n}\n</code></div>\n<div><code>\nlet mountains;\nlet bricks;\n\nfunction preload() {\n  mountains = loadImage('assets/rockies.jpg');\n  bricks = loadImage('assets/bricks_third.jpg');\n}\n\nfunction setup() {\n  mountains.blend(bricks, 0, 0, 33, 100, 67, 0, 33, 100, DARKEST);\n  image(mountains, 0, 0);\n  image(bricks, 0, 0);\n}\n</code></div>\n<div><code>\nlet mountains;\nlet bricks;\n\nfunction preload() {\n  mountains = loadImage('assets/rockies.jpg');\n  bricks = loadImage('assets/bricks_third.jpg');\n}\n\nfunction setup() {\n  mountains.blend(bricks, 0, 0, 33, 100, 67, 0, 33, 100, LIGHTEST);\n  image(mountains, 0, 0);\n  image(bricks, 0, 0);\n}\n</code></div>"],alt:"image of rocky mountains. Brick images on left and right. Right overexposed\nimage of rockies. Brickwall images on left and right. Right mortar transparent\nimage of rockies. Brickwall images on left and right. Right translucent",class:"p5.Image",module:"Image",submodule:"Image",overloads:[{line:674,params:[{name:"srcImage",description:"<p>source image</p>\n",type:"p5.Image"},{name:"sx",description:"<p>X coordinate of the source&#39;s upper left corner</p>\n",type:"Integer"},{name:"sy",description:"<p>Y coordinate of the source&#39;s upper left corner</p>\n",type:"Integer"},{name:"sw",description:"<p>source image width</p>\n",type:"Integer"},{name:"sh",description:"<p>source image height</p>\n",type:"Integer"},{name:"dx",description:"<p>X coordinate of the destination&#39;s upper left corner</p>\n",type:"Integer"},{name:"dy",description:"<p>Y coordinate of the destination&#39;s upper left corner</p>\n",type:"Integer"},{name:"dw",description:"<p>destination image width</p>\n",type:"Integer"},{name:"dh",description:"<p>destination image height</p>\n",type:"Integer"},{name:"blendMode",description:'<p>the blend mode. either\n    BLEND, DARKEST, LIGHTEST, DIFFERENCE,\n    MULTIPLY, EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\n    SOFT_LIGHT, DODGE, BURN, ADD or NORMAL.</p>\n<p>Available blend modes are: normal | multiply | screen | overlay |\n           darken | lighten | color-dodge | color-burn | hard-light |\n           soft-light | difference | exclusion | hue | saturation |\n           color | luminosity</p>\n<p><a href="http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/">http://blogs.adobe.com/webplatform/2013/01/28/blending-features-in-canvas/</a></p>\n',type:"Constant"}]},{line:753,params:[{name:"sx",description:"",type:"Integer"},{name:"sy",description:"",type:"Integer"},{name:"sw",description:"",type:"Integer"},{name:"sh",description:"",type:"Integer"},{name:"dx",description:"",type:"Integer"},{name:"dy",description:"",type:"Integer"}
21,{name:"dw",description:"",type:"Integer"},{name:"dh",description:"",type:"Integer"},{name:"blendMode",description:"",type:"Constant"}]}]},{file:"src/image/p5.Image.js",line:796,description:"<p>Saves the image to a file and force the browser to download it.\nAccepts two strings for filename and file extension\nSupports png (default) and jpg.</p>\n",itemtype:"method",name:"save",params:[{name:"filename",description:"<p>give your file a name</p>\n",type:"String"},{name:"extension",description:"<p>&#39;png&#39; or &#39;jpg&#39;</p>\n",type:"String"}],example:["\n<div><code>\nlet photo;\n\nfunction preload() {\n  photo = loadImage('assets/rockies.jpg');\n}\n\nfunction draw() {\n  image(photo, 0, 0);\n}\n\nfunction keyTyped() {\n  if (key === 's') {\n    photo.save('photo', 'png');\n  }\n}\n</code></div>"],alt:"image of rocky mountains.",class:"p5.Image",module:"Image",submodule:"Image"},{file:"src/image/pixels.js",line:14,description:'<p><a href=\'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference\n/Global_Objects/Uint8ClampedArray\' target=\'_blank\'>Uint8ClampedArray</a>\ncontaining the values for all the pixels in the display window.\nThese values are numbers. This array is the size (include an appropriate\nfactor for <a href="#/p5/pixelDensity">pixelDensity</a>) of the display window x4,\nrepresenting the R, G, B, A values in order for each pixel, moving from\nleft to right across each row, then down each column. Retina and other\nhigh density displays will have more pixels[] (by a factor of\npixelDensity^2).\nFor example, if the image is 100x100 pixels, there will be 40,000. On a\nretina display, there will be 160,000.\n<br><br>\nThe first four values (indices 0-3) in the array will be the R, G, B, A\nvalues of the pixel at (0, 0). The second four values (indices 4-7) will\ncontain the R, G, B, A values of the pixel at (1, 0). More generally, to\nset values for a pixel at (x, y):</p>\n<pre><code class="lang-javascript">let d = pixelDensity();\nfor (let i = 0; i &lt; d; i++) {\n  for (let j = 0; j &lt; d; j++) {\n    // loop over\n    index = 4 * ((y * d + j) * width * d + (x * d + i
21));\n    pixels[index] = r;\n    pixels[index+1] = g;\n    pixels[index+2] = b;\n    pixels[index+3] = a;\n  }\n}\n</code></pre>\n<p>While the above method is complex, it is flexible enough to work with\nany pixelDensity. Note that <a href="#/p5/set">set()</a> will automatically take care of\nsetting all the appropriate values in <a href="#/p5/pixels">pixels[]</a> for a given (x, y) at\nany pixelDensity, but the performance may not be as fast when lots of\nmodifications are made to the pixel array.\n<br><br>\nBefore accessing this array, the data must loaded with the <a href="#/p5/loadPixels">loadPixels()</a>\nfunction. After the array data has been modified, the <a href="#/p5/updatePixels">updatePixels()</a>\nfunction must be run to update the changes.\n<br><br>\nNote that this is not a standard javascript array.  This means that\nstandard javascript functions such as <a href="#/p5/slice">slice()</a> or\n<a href="#/p5/arrayCopy">arrayCopy()</a> do not\nwork.</p>',itemtype:"property",name:"pixels",type:"Number[]",example:["\n<div>\n<code>\nlet pink = color(255, 102, 204);\nloadPixels();\nlet d = pixelDensity();\nlet halfImage = 4 * (width * d) * (height / 2 * d);\nfor (let i = 0; i < halfImage; i += 4) {\n  pixels[i] = red(pink);\n  pixels[i + 1] = green(pink);\n  pixels[i + 2] = blue(pink);\n  pixels[i + 3] = alpha(pink);\n}\nupdatePixels();\n</code>\n</div>"],alt:"top half of canvas pink, bottom grey",class:"p5",module:"Image",submodule:"Pixels"},{file:"src/image/pixels.js",line:83,description:"<p>Copies a region of pixels from one image to another, using a specified\nblend mode to do the operation.</p>\n",itemtype:"method",name:"blend",example:["\n<div><code>\nlet img0;\nlet img1;\n\nfunction preload() {\n  img0 = loadImage('assets/rockies.jpg');\n  img1 = loadImage('assets/bricks_third.jpg');\n}\n\nfunction setup() {\n  background(img0);\n  image(img1, 0, 0);\n  blend(img1, 0, 0, 33, 100, 67, 0, 33, 100, LIGHTEST);\n}\n</code></div>\n<div><code>\nlet img0;\nlet img1;\n\nfunction preload() {\n  img0 = loadImage('assets/rockies.jpg');\n  img1 = loadImage('assets/bricks_third.jpg');\n}\n\nfunction setup() {\n  background(img0);\n  image(img1, 0, 0);\n  blend(img1, 0, 0, 33, 100, 67, 0, 33, 100, DARKEST);\n}\n</code></div>\n<div><code>\nlet img0;\nlet img1;\n\nfunction preload() {\n  img0 = loadImage('assets/rockies.jpg');\n  img1 = loadImage('assets/bricks_third.jpg');\n}\n\nfunction setup() {\n  background(img0);\n  image(img1, 0, 0);\n  blend(img1, 0, 0, 33, 100, 67, 0, 33, 100, ADD);\n}\n</code></div>"],alt:"image of rocky mountains. Brick images on left and right. Right overexposed\nimage of rockies. Brickwall images on left and right. Right mortar transparent\nimage of rockies. Brickwall images on left and right. Right translucent",class:"p5",module:"Image",submodule:"Pixels",overloads:[{line:83,params:[{name:"srcImage",description:"<p>source image</p>\n",type:"p5.Image"},{name:"sx",description:"<p>X coordinate of the source&#39;s upper left corner</p>\n",type:"Integer"},{name:"sy",description:"<p>Y coordinate of the source&#39;s upper left corner</p>\n",type:"Integer"},{name:"sw",description:"<p>source image width</p>\n",type:"Integer"},{name:"sh",description:"<p>source image height</p>\n",type:"Integer"},{name:"dx",description:"<p>X coordinate of the destination&#39;s upper left corner</p>\n",type:"Integer"},{name:"dy",description:"<p>Y coordinate of the destination&#39;s upper left corner</p>\n",type:"Integer"},{name:"dw",description:"<p>destination image width</p>\n",type:"Integer"},{name:"dh",description:"<p>destination image height</p>\n",type:"Integer"},{name:"blendMode",description:"<p>the blend mode. either\n    BLEND, DARKEST, LIGHTEST, DIFFERENCE,\n    MULTIPLY, EXCLUSION, SCREEN, REPLACE, OVERLAY, HARD_LIGHT,\n    SOFT_LIGHT, DODGE, BURN, ADD or NORMAL.</p>\n",type:"Constant"}]},{line:156,params:[{name:"sx",description:"",type:"Integer"},{name:"sy",description:"",type:"Integer"},{name:"sw",description:"",type:"Integer"},{name:"sh",description:"",type:"Integer"},{name:"dx",description:"",type:"Integer"},{name:"dy",description:"",type:"Integer"}
21,{name:"dw",description:"",type:"Integer"},{name:"dh",description:"",type:"Integer"},{name:"blendMode",description:"",type:"Constant"}]}]},{file:"src/image/pixels.js",line:177,description:"<p>Copies a region of the canvas to another region of the canvas\nand copies a region of pixels from an image used as the srcImg parameter\ninto the canvas srcImage is specified this is used as the source. If\nthe source and destination regions aren&#39;t the same size, it will\nautomatically resize source pixels to fit the specified\ntarget region.</p>\n",itemtype:"method",name:"copy",example:["\n<div><code>\nlet img;\n\nfunction preload() {\n  img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n  background(img);\n  copy(img, 7, 22, 10, 10, 35, 25, 50, 50);\n  stroke(255);\n  noFill();\n  // Rectangle shows area being copied\n  rect(7, 22, 10, 10);\n}\n</code></div>"],alt:"image of rocky mountains. Brick images on left and right. Right overexposed\nimage of rockies. Brickwall images on left and right. Right mortar transparent\nimage of rockies. Brickwall images on left and right. Right translucent",class:"p5",module:"Image",submodule:"Pixels",overloads:[{line:177,params:[{name:"srcImage",description:"<p>source image</p>\n",type:"p5.Image|p5.Element"},{name:"sx",description:"<p>X coordinate of the source&#39;s upper left corner</p>\n",type:"Integer"},{name:"sy",description:"<p>Y coordinate of the source&#39;s upper left corner</p>\n",type:"Integer"},{name:"sw",description:"<p>source image width</p>\n",type:"Integer"},{name:"sh",description:"<p>source image height</p>\n",type:"Integer"},{name:"dx",description:"<p>X coordinate of the destination&#39;s upper left corner</p>\n",type:"Integer"},{name:"dy",description:"<p>Y coordinate of the destination&#39;s upper left corner</p>\n",type:"Integer"},{name:"dw",description:"<p>destination image width</p>\n",type:"Integer"},{name:"dh",description:"<p>destination image height</p>\n",type:"Integer"}]},{line:220,params:[{name:"sx",description:"",type:"Integer"},{name:"sy",description:"",type:"Integer"},{name:"sw",description:"",type:"Integer"},{name:"sh",description:"",type:"Integer"},{name:"dx",description:"",type:"Integer"},{name:"dy",description:"",type:"Integer"},{name:"dw",description:"",type:"Integer"},{name:"dh",description:"",type:"Integer"}]}]},{file:"src/image/pixels.js",line:236,description:"<p>Applies a filter to the canvas.\n<br><br></p>\n<p>The presets options are:\n<br><br></p>\n<p>THRESHOLD\nConverts the image to black and white pixels depending if they are above or\nbelow the threshold defined by the level parameter. The parameter must be\nbetween 0.0 (black) and 1.0 (white). If no level is specified, 0.5 is used.\n<br><br></p>\n<p>GRAY\nConverts any colors in the image to grayscale equivalents. No parameter\nis used.\n<br><br></p>\n<p>OPAQUE\nSets the alpha channel to entirely opaque. No parameter is used.\n<br><br></p>\n<p>INVERT\nSets each pixel to its inverse value. No parameter is used.\n<br><br></p>\n<p>POSTERIZE\nLimits each channel of the image to the number of colors specified as the\nparameter. The parameter can be set to values between 2 and 255, but\nresults are most noticeable in the lower ranges.\n<br><br></p>\n<p>BLUR\nExecutes a Gaussian blur with the level parameter specifying the extent\nof the blurring. If no parameter is used, the blur is equivalent to\nGaussian blur of radius 1. Larger values increase the blur.\n<br><br></p>\n<p>ERODE\nReduces the light areas. No parameter is used.\n<br><br></p>\n<p>DILATE\nIncreases the light areas. No parameter is used.</p>\n",itemtype:"method",name:"filter",params:[{name:"filterType",description:"<p>either THRESHOLD, GRAY, OPAQUE, INVERT,\n                               POSTERIZE, BLUR, ERODE, DILATE or BLUR.\n                               See Filters.js for docs on\n                               each available filter</p>\n",type:"Constant"},{name:"filterParam",description:"<p>an optional parameter unique\n                               to each filter, see above</p>\n",type:"Number",optional:!0}],example:["\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/bricks.jpg');\n}\nfunction setup() {\n  image(img, 0, 0);\n  filter(THRESHOLD);\n}\n</code>\n</div>\n\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/bricks.jpg');\n}\nfunction setup() {\n  image(img, 0, 0);\n  filter(GRAY);\n}\n</code>\n</div>\n\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/bricks.jpg');\n}\nfunction setup() {\n  image(img, 0, 0);\n  filter(OPAQUE);\n}\n</code>\n</div>\n\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/bricks.jpg');\n}\nfunction setup() {\n  image(img, 0, 0);\n  filter(INVERT);\n}\n</code>\n</div>\n\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/bricks.jpg');\n}\nfunction setup() {\n  image(img, 0, 0);\n  filter(POSTERIZE, 3);\n}\n</code>\n</div>\n\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/bricks.jpg');\n}\nfunction setup() {\n  image(img, 0, 0);\n  filter(DILATE);\n}\n</code>\n</div>\n\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/bricks.jpg');\n}\nfunction setup() {\n  image(img, 0, 0);
21\n  filter(BLUR, 3);\n}\n</code>\n</div>\n\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/bricks.jpg');\n}\nfunction setup() {\n  image(img, 0, 0);\n  filter(ERODE);\n}\n</code>\n</div>"],alt:"black and white image of a brick wall.\ngreyscale image of a brickwall\nimage of a brickwall\njade colored image of a brickwall\nred and pink image of a brickwall\nimage of a brickwall\nblurry image of a brickwall\nimage of a brickwall\nimage of a brickwall with less detail",class:"p5",module:"Image",submodule:"Pixels"},{file:"src/image/pixels.js",line:415,description:'<p>Get a region of pixels, or a single pixel, from the canvas.</p>\n<p>Returns an array of [R,G,B,A] values for any pixel or grabs a section of\nan image. If no parameters are specified, the entire image is returned.\nUse the x and y parameters to get the value of one pixel. Get a section of\nthe display window by specifying additional w and h parameters. When\ngetting an image, the x and y parameters define the coordinates for the\nupper-left corner of the image, regardless of the current <a href="#/p5/imageMode">imageMode()</a>.\n<br><br>\nGetting the color of a single pixel with get(x, y) is easy, but not as fast\nas grabbing the data directly from <a href="#/p5/pixels">pixels[]</a>. The equivalent statement to\nget(x, y) using <a href="#/p5/pixels">pixels[]</a> with pixel density d is</p>\n<pre><code class="lang-javascript">let x, y, d; // set these to the coordinates\nlet off = (y * width + x) * d * 4;\nlet components = [\n  pixels[off],\n  pixels[off + 1],\n  pixels[off + 2],\n  pixels[off + 3]\n];\nprint(components);\n</code></pre>\n<p><br><br></p>\n<p>See the reference for <a href="#/p5/pixels">pixels[]</a> for more information.</p>\n<p>If you want to extract an array of colors or a subimage from an p5.Image object,\ntake a look at <a href="#/p5.Image/get">p5.Image.get()</a></p>\n',itemtype:"method",name:"get",return:{description:'the rectangle <a href="#/p5.Image">p5.Image</a>',type:"p5.Image"},example:["\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/rockies.jpg');\n}\nfunction setup() {\n  image(img, 0, 0);\n  let c = get();\n  image(c, width / 2, 0);\n}\n</code>\n</div>\n\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/rockies.jpg');\n}\nfunction setup() {\n  image(img, 0, 0);\n  let c = get(50, 90);\n  fill(c);\n  noStroke();\n  rect(25, 25, 50, 50);\n}\n</code>\n</div>"],alt:"2 images of the rocky mountains, side-by-side\nImage of the rocky mountains with 50x50 green rect in center of canvas",class:"p5",module:"Image",submodule:"Pixels",overloads:[{line:415,params:[{name:"x",description:"<p>x-coordinate of the pixel</p>\n",type:"Number"},{name:"y",description:"<p>y-coordinate of the pixel</p>\n",type:"Number"},{name:"w",description:"<p>width</p>\n",type:"Number"},{name:"h",description:"<p>height</p>\n",type:"Number"}],return:{description:'the rectangle <a href="#/p5.Image">p5.Image</a>',type:"p5.Image"}},{line:488,params:[],return:{description:'the whole <a href="#/p5.Image">p5.Image</a>',type:"p5.Image"}},{line:492,params:[{name:"x",description:"",type:"Number"},{name:"y",description:"",type:"Number"}],return:{description:"color of pixel at x,y in array format [R, G, B, A]",type:"Number[]"}}]},{file:"src/image/pixels.js",line:503,description:'<p>Loads the pixel data for the display window into the <a href="#/p5/pixels">pixels[]</a> array. This\nfunction must always be called before reading from or writing to <a href="#/p5/pixels">pixels[]</a>.\nNote that only changes made with <a href="#/p5/set">set()</a> or direct manipulation of <a href="#/p5/pixels">pixels[]</a>\nwill occur.</p>\n',itemtype:"method",name:"loadPixels",example:["\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n  image(img, 0, 0, width, height);\n  let d = pixelDensity();\n  let halfImage = 4 * (width * d) * (height * d / 2);\n  loadPixels();\n  for (let i = 0; i < halfImage; i++) {\n    pixels[i + halfImage] = pixels[i];\n  }\n  updatePixels();\n}\n</code>\n</div>"],alt:"two images of the rocky mountains. one on top, one on bottom of canvas.",class:"p5",module:"Image",submodule:"Pixels"},{file:"src/image/pixels.js",line:540,description:'<p>Changes the color of any pixel, or writes an image directly to the\ndisplay window.</p>\n<p>The x and y parameters specify the pixel to change and the c parameter\nspecifies the color value. This can be a <a href="#/p5.Color">p5.Color</a> object, or [R, G, B, A]\npixel array. It can also be a single grayscale value.\nWhen setting an image, the x and y parameters define the coordinates for\nthe upper-left corner of the image, regardless of the current <a href="#/p5/imageMode">imageMode()</a>.\n</p>\n<p>
21\nAfter using <a href="#/p5/set">set()</a>, you must call <a href="#/p5/updatePixels">updatePixels()</a> for your changes to appear.\nThis should be called once all pixels have been set, and must be called before\ncalling .<a href="#/p5/get">get()</a> or drawing the image.\n</p>\n<p>Setting the color of a single pixel with set(x, y) is easy, but not as\nfast as putting the data directly into <a href="#/p5/pixels">pixels[]</a>. Setting the <a href="#/p5/pixels">pixels[]</a>\nvalues directly may be complicated when working with a retina display,\nbut will perform better when lots of pixels need to be set directly on\nevery loop.</p>\n<p>See the reference for <a href="#/p5/pixels">pixels[]</a> for more information.</p>',itemtype:"method",name:"set",params:[{name:"x",description:"<p>x-coordinate of the pixel</p>\n",type:"Number"},{name:"y",description:"<p>y-coordinate of the pixel</p>\n",type:"Number"},{name:"c",description:'<p>insert a grayscale value | a pixel array |\n                               a <a href="#/p5.Color">p5.Color</a> object | a <a href="#/p5.Image">p5.Image</a> to copy</p>\n',type:"Number|Number[]|Object"}],example:["\n<div>\n<code>\nlet black = color(0);\nset(30, 20, black);\nset(85, 20, black);\nset(85, 75, black);\nset(30, 75, black);\nupdatePixels();\n</code>\n</div>\n\n<div>\n<code>\nfor (let i = 30; i < width - 15; i++) {\n  for (let j = 20; j < height - 25; j++) {\n    let c = color(204 - j, 153 - i, 0);\n    set(i, j, c);\n  }\n}\nupdatePixels();\n</code>\n</div>\n\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n  set(0, 0, img);\n  updatePixels();\n  line(0, 0, width, height);\n  line(0, height, width, 0);\n}\n</code>\n</div>"],alt:"4 black points in the shape of a square middle-right of canvas.\nsquare with orangey-brown gradient lightening at bottom right.\nimage of the rocky mountains. with lines like an 'x' through the center.",class:"p5",module:"Image",submodule:"Pixels"},{file:"src/image/pixels.js",line:614,description:'<p>Updates the display window with the data in the <a href="#/p5/pixels">pixels[]</a> array.\nUse in conjunction with <a href="#/p5/loadPixels">loadPixels()</a>. If you&#39;re only reading pixels from\nthe array, there&#39;s no need to call <a href="#/p5/updatePixels">updatePixels()</a> — updating is only\nnecessary to apply changes. <a href="#/p5/updatePixels">updatePixels()</a> should be called anytime the\npixels array is manipulated or <a href="#/p5/set">set()</a> is called, and only changes made with\n<a href="#/p5/set">set()</a> or direct changes to <a href="#/p5/pixels">pixels[]</a> will occur.</p>\n',itemtype:"method",name:"updatePixels",params:[{name:"x",description:"<p>x-coordinate of the upper-left corner of region\n                        to update</p>\n",type:"Number",optional:!0},{name:"y",description:"<p>y-coordinate of the upper-left corner of region\n                        to update</p>\n",type:"Number",optional:!0},{name:"w",description:"<p>width of region to update</p>\n",type:"Number",optional:!0},{name:"h",description:"<p>height of region to update</p>\n",type:"Number",optional:!0}],example:["\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/rockies.jpg');\n}\n\nfunction setup() {\n  image(img, 0, 0, width, height);\n  let d = pixelDensity();\n  let halfImage = 4 * (width * d) * (height * d / 2);\n  loadPixels();\n  for (let i = 0; i < halfImage; i++) {\n    pixels[i + halfImage] = pixels[i];\n  }\n  updatePixels();\n}\n</code>\n</div>"],alt:"two images of the rocky mountains. one on top, one on bottom of canvas.",class:"p5",module:"Image",submodule:"Pixels"},{file:"src/io/files.js",line:19,description:'<p>Loads a JSON file from a file or a URL, and returns an Object.\nNote that even if the JSON file contains an Array, an Object will be\nreturned with index numbers as keys.</p>\n<p>This method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed. JSONP is supported via a polyfill and you\ncan pass in as the second argument an object with definitions of the json\ncallback following the syntax specified <a href="https://github.com/camsong/\nfetch-jsonp">here</a>.</p>\n<p>This method is suitable for fetching files up to size of 64MB.</p>\n',itemtype:"method",name:"loadJSON",return:{description:"JSON data",type:"Object|Array"},example:["\n\n<p>Calling <a href=\"#/p5/loadJSON\">loadJSON()</a> inside <a href=\"#/p5/preload\">preload()</a> guarantees to complete the\noperation before <a href=\"#/p5/setup\">setup()</a> and <a href=\"#/p5/draw\">draw()</a> are called.</p>\n\n<div><code>\n// Examples use USGS Earthquake API:\n//   https://earthquake.usgs.gov/fdsnws/event/1/#methods\nlet earthquakes;\nfunction preload() {\n  // Get the most recent earthquake in the database\n  let url =\n   'https://earthquake.usgs.gov/earthquakes/feed/v1.0/' +\n    'summary/all_day.geojson';\n  earthquakes = loadJSON(url);\n}\n\nfunction setup() {\n  noLoop();\n}\n\nfunction draw() {\n  background(200);\n  // Get the magnitude and name of the earthquake out of the loaded JSON\n  let earthquakeMag = earthquakes.features[0].properties.mag;\n  let earthquakeName = earthquakes.features[0].properties.place;\n  ellipse(width / 2, height / 2, earthquakeMag * 10, earthquakeMag * 10);\n  textAlign(CENTER);
21\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  let url =\n   'https://earthquake.usgs.gov/earthquakes/feed/v1.0/' +\n    'summary/all_day.geojson';\n  loadJSON(url, drawEarthquake);\n}\n\nfunction draw() {\n  background(200);\n}\n\nfunction drawEarthquake(earthquakes) {\n  // Get the magnitude and name of the earthquake out of the loaded JSON\n  let earthquakeMag = earthquakes.features[0].properties.mag;\n  let earthquakeName = earthquakes.features[0].properties.place;\n  ellipse(width / 2, height / 2, earthquakeMag * 10, earthquakeMag * 10);\n  textAlign(CENTER);\n  text(earthquakeName, 0, height - 30, width, 30);\n}\n</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",overloads:[{line:19,params:[{name:"path",description:"<p>name of the file or url to load</p>\n",type:"String"},{name:"jsonpOptions",description:"<p>options object for jsonp related settings</p>\n",type:"Object",optional:!0},{name:"datatype",description:"<p>&quot;json&quot; or &quot;jsonp&quot;</p>\n",type:"String",optional:!0},{name:"callback",description:'<p>function to be executed after\n                                   <a href="#/p5/loadJSON">loadJSON()</a> 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"}},{line:105,params:[{name:"path",description:"",type:"String"},{name:"datatype",description:"",type:"String"},{name:"callback",description:"",type:"Function",optional:!0},{name:"errorCallback",description:"",type:"Function",optional:!0}],return:{description:"",type:"Object|Array"}},{line:113,params:[{name:"path",description:"",type:"String"},{name:"callback",description:"",type:"Function"},{name:"errorCallback",description:"",type:"Function",optional:!0}],return:{description:"",type:"Object|Array"}}]},{file:"src/io/files.js",line:184,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<p>This method is suitable for fetching files up to size of 64MB.</p>\n",itemtype:"method",name:"loadStrings",params:[{name:"filename",description:"<p>name of the file or url to load</p>\n",type:"String"},{name:"callback",description:'<p>function to be executed after <a href="#/p5/loadStrings">loadStrings()</a>\n                              completes, Array is passed in as first\n                              argument</p>\n',type:"Function",optional:!0},{name:"errorCallback",description:"<p>function to be executed if\n                              there is an error, response is passed\n                              in as first argument</p>\n",type:"Function",optional:!0}],return:{description:"Array of Strings",type:"String[]"},example:['\n\n<p>Calling loadStrings() inside <a href="#/p5/preload">preload()</a> guarantees to complete the\noperation before <a href="#/p5/setup">setup()</a> and <a href="#/p5/draw">draw()</a> are called.</p>\n\n<div><code>\nlet result;\nfunction preload() {\n  result = loadStrings(\'assets/test.txt\');\n}\n\nfunction setup() {\n  background(200);\n  let ind = floor(random(result.length));\n  text(result[ind], 10, 10, 80, 80);\n}\n</code></div>\n\n<p>Outside of preload(), you may supply a callback function to handle the\nobject:</p>\n\n<div><code>\nfunction setup() {\n  loadStrings(\'assets/test.txt\', pickString);\n}\n\nfunction pickString(result) {\n  background(200);\n  let ind = floor(random(result.length));\n  text(result[ind], 10, 10, 80, 80);\n}\n</code></div>'],alt:'randomly generated text from a file, for example "i smell like butter"\nrandomly generated text from a file, for example "i have three feet"',class:"p5",module:"IO",submodule:"Input"},{file:"src/io/files.js",line:297,description:'<p>Reads the contents of a file or URL and creates a <a href="#/p5.Table">p5.Table</a> object with\nits values. If a file is specified, it must be located in the sketch&#39;s\n&quot;data&quot; folder. The filename parameter can also be a URL to a file found\nonline. By default, the file is assumed to be comma-separated (in CSV\nformat). Table only looks for a header row if the &#39;header&#39; option is\nincluded.</p>\n\n<p>Possible options include:\n<ul>\n<li>csv - parse the table as comma-separated values</li>\n<li>tsv - parse the table as tab-separated values</li>\n<li>header - this table has a header (title) row</li>\n</ul>\n</p>\n\n<p>When passing in multiple options, pass them in as separate parameters,\nseperated by commas. For example:\n<br><br>\n<code>\nloadTable(&#39;my_csv_file.csv&#39;, &#39;csv&#39;, &#39;header&#39;);\n</code>\n</p>\n\n<p> All files loaded and saved use UTF-8 encoding.</p>\n\n<p>This method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed. Calling <a href="#/p5/loadTable">loadTable()</a> inside <a href="#/p5/preload">preload()</a>\nguarantees to complete the operation before <a href="#/p5/setup">setup()</a> and <a href="#/p5/draw">draw()</a> are called.\n<p>Outside of <a href="#/p5/preload">preload()</a>, you may supply a callback function to handle the\nobject:</p>\n</p>\n\n<p>This method is suitable for fetching files up to size of 64MB.</p>\n',itemtype:"method",name:"loadTable",return:{description:'<a href="#/p5.Table">Table</a>
21 object containing data',type:"Object"},example:['\n<div class=\'norender\'>\n<code>\n// Given the following CSV file called "mammals.csv"\n// located in the project\'s "assets" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n  //my table is comma separated value "csv"\n  //and has a header specifying the columns labels\n  table = loadTable(\'assets/mammals.csv\', \'csv\', \'header\');\n  //the file can be remote\n  //table = loadTable("http://p5js.org/reference/assets/mammals.csv",\n  //                  "csv", "header");\n}\n\nfunction setup() {\n  //count the columns\n  print(table.getRowCount() + \' total rows in table\');\n  print(table.getColumnCount() + \' total columns in table\');\n\n  print(table.getColumn(\'name\'));\n  //["Goat", "Leopard", "Zebra"]\n\n  //cycle through the table\n  for (let r = 0; r < table.getRowCount(); r++)\n    for (let c = 0; c < table.getColumnCount(); c++) {\n      print(table.getString(r, c));\n    }\n}\n</code>\n</div>'],alt:'randomly generated text from a file, for example "i smell like butter"\nrandomly generated text from a file, for example "i have three feet"',class:"p5",module:"IO",submodule:"Input",overloads:[{line:297,params:[{name:"filename",description:"<p>name of the file or URL to load</p>\n",type:"String"},{name:"options",description:"<p>&quot;header&quot; &quot;csv&quot; &quot;tsv&quot;</p>\n",type:"String"},{name:"callback",description:'<p>function to be executed after\n                                    <a href="#/p5/loadTable">loadTable()</a> completes. On success, the\n                                    <a href="#/p5.Table">Table</a> object is passed in as the\n                                    first argument.</p>\n',type:"Function",optional:!0},{name:"errorCallback",description:"<p>function to be executed if\n                                    there is an error, response is passed\n                                    in as first argument</p>\n",type:"Function",optional:!0}],return:{description:'<a href="#/p5.Table">Table</a> object containing data',type:"Object"}},{line:387,params:[{name:"filename",description:"",type:"String"},{name:"callback",description:"",type:"Function",optional:!0},{name:"errorCallback",description:"",type:"Function",optional:!0}],return:{description:"",type:"Object"}}]},{file:"src/io/files.js",line:607,description:'<p>Reads the contents of a file and creates an XML object with its values.\nIf the name of the file is used as the parameter, as in the above example,\nthe file must be located in the sketch directory/folder.</p>\n<p>Alternatively, the file maybe be loaded from anywhere on the local\ncomputer using an absolute path (something that starts with / on Unix and\nLinux, or a drive letter on Windows), or the filename parameter can be a\nURL for a file found on a network.</p>\n<p>This method is asynchronous, meaning it may not finish before the next\nline in your sketch is executed. Calling <a href="#/p5/loadXML">loadXML()</a> inside <a href="#/p5/preload">preload()</a>\nguarantees to complete the operation before <a href="#/p5/setup">setup()</a> and <a href="#/p5/draw">draw()</a> are called.</p>\n<p>Outside of <a href="#/p5/preload">preload()</a>, you may supply a callback function to handle the\nobject.</p>\n<p>This method is suitable for fetching files up to size of 64MB.</p>\n',itemtype:"method",name:"loadXML",params:[{name:"filename",description:"<p>name of the file or URL to load</p>\n",type:"String"},{name:"callback",description:'<p>function to be executed after <a href="#/p5/loadXML">loadXML()</a>\n                              completes, XML object is passed in as\n                              first argument</p>\n',type:"Function",optional:!0},{name:"errorCallback",description:"<p>function to be executed if\n                              there is an error, response is passed\n                              in as first argument</p>\n",type:"Function",optional:!0}],return:{description:"XML object containing data",type:"Object"},example:['\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">
21Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  let children = xml.getChildren(\'animal\');\n\n  for (let i = 0; i < children.length; i++) {\n    let id = children[i].getNum(\'id\');\n    let coloring = children[i].getString(\'species\');\n    let name = children[i].getContent();\n    print(id + \', \' + coloring + \', \' + name);\n  }\n}\n\n// Sketch prints:\n// 0, Capra hircus, Goat\n// 1, Panthera pardus, Leopard\n// 2, Equus zebra, Zebra\n</code></div>'],alt:"no image displayed",class:"p5",module:"IO",submodule:"Input"},{file:"src/io/files.js",line:718,description:"<p>This method is suitable for fetching files up to size of 64MB.</p>\n",itemtype:"method",name:"loadBytes",params:[{name:"file",description:"<p>name of the file or URL to load</p>\n",type:"String"},{name:"callback",description:'<p>function to be executed after <a href="#/p5/loadBytes">loadBytes()</a>\n                                   completes</p>\n',type:"Function",optional:!0},{name:"errorCallback",description:"<p>function to be executed if there\n                                   is an error</p>\n",type:"Function",optional:!0}],return:{description:"an object whose 'bytes' property will be the loaded buffer",type:"Object"},example:["\n<div class='norender'><code>\nlet data;\n\nfunction preload() {\n  data = loadBytes('assets/mammals.xml');\n}\n\nfunction setup() {\n  for (let i = 0; i < 5; i++) {\n    console.log(data.bytes[i].toString(16));\n  }\n}\n</code></div>"],alt:"no image displayed",class:"p5",module:"IO",submodule:"Input"},{file:"src/io/files.js",line:778,description:"<p>Method for executing an HTTP GET request. If data type is not specified,\np5 will try to guess based on the URL, defaulting to text. This is equivalent to\ncalling <code>httpDo(path, &#39;GET&#39;)</code>. The &#39;binary&#39; datatype will return\na Blob object, and the &#39;arrayBuffer&#39; datatype will return an ArrayBuffer\nwhich can be used to initialize typed arrays (such as Uint8Array).</p>\n",itemtype:"method",name:"httpGet",return:{description:"A promise that resolves with the data when the operation\n                  completes successfully or rejects with the error after\n                  one occurs.",type:"Promise"},example:["\n<div class='norender'><code>\n// Examples use USGS Earthquake API:\n//   https://earthquake.usgs.gov/fdsnws/event/1/#methods\nlet earthquakes;\nfunction preload() {\n  // Get the most recent earthquake in the database\n  let url =\n   'https://earthquake.usgs.gov/fdsnws/event/1/query?' +\n    'format=geojson&limit=1&orderby=time';\n  httpGet(url, 'jsonp', false, function(response) {\n    // when the HTTP request completes, populate the variable that holds the\n    // earthquake data used in the visualization.\n    earthquakes = response;\n  });\n}\n\nfunction draw() {\n  if (!earthquakes) {\n    // Wait until the earthquake data has loaded before drawing.\n    return;\n  }\n  background(200);\n  // Get the magnitude and name of the earthquake out of the loaded JSON\n  let earthquakeMag = earthquakes.features[0].properties.mag;\n  let earthquakeName = earthquakes.features[0].properties.place;\n  ellipse(width / 2, height / 2, earthquakeMag * 10, earthquakeMag * 10);\n  textAlign(CENTER);\n  text(earthquakeName, 0, height - 30, width, 30);\n  noLoop();\n}\n</code></div>"],class:"p5",module:"IO",submodule:"Input",overloads:[{line:778,params:[{name:"path",description:"<p>name of the file or url to load</p>\n",type:"String"},{name:"datatype",description:"<p>&quot;json&quot;, &quot;jsonp&quot;, &quot;binary&quot;, &quot;arrayBuffer&quot;,\n                                   &quot;xml&quot;, or &quot;text&quot;</p>\n",type:"String",optional:!0},{name:"data",description:"<p>param data passed sent with request</p>\n",type:"Object|Boolean",optional:!0},{name:"callback",description:'<p>function to be executed after\n                                   <a href="#/p5/httpGet">httpGet()</a> completes, data is passed in\n                                   as first argument</p>\n',type:"Function",optional:!0},{name:"errorCallback",description:"<p>function to be executed if\n                                   there is an error, response is passed\n                                   in as first argument</p>\n",type:"Function",optional:!0}],return:{description:"A promise that resolves with the data when the operation\n                  completes successfully or rejects with the error after\n                  one occurs.",type:"Promise"}},{line:832,params:[{name:"path",description:"",type:"String"},{name:"data",description:"",type:"Object|Boolean"},{name:"callback",description:"",type:"Function",optional:!0},{name:"errorCallback",description:"",type:"Function",optional:!0}],return:{description:"",type:"Promise"}},{line:840,params:[{name:"path",description:"",type:"String"},{name:"callback",description:"",type:"Function"},{name:"errorCallback",description:"",type:"Function",optional:!0}],return:{description:"",type:"Promise"}}]},{file:"src/io/files.js",line:855,description:"<p>Method for executing an HTTP POST request. If data type is not specified,\np5 will try to guess based on the URL, defaulting to text. This is equivalent to\ncalling <code>httpDo(path, &#39;POST&#39;)</code>.</p>\n",itemtype:"method",name:"httpPost",return:{description:"A promise that resolves with the data when the operation\n                  completes successfully or rejects with the error after\n                  one occurs.",type:"Promise"},example:["\n<div>\n<code>\n// Examples use jsonplaceholder.typicode.com for a Mock Data API\n\nlet url = 'https://jsonplaceholder.typicode.com/posts';\nlet postData = { userId: 1, title: 'p5 Clicked!', body: 'p5.js is way cool.' };\n\nfunction setup() {\n  createCanvas(800, 800);\n}\n\nfunction mousePressed() {\n  // Pick new random color values\n  let r = random(255);\n  let g = random(255);\n  let b = random(255);\n\n  httpPost(url, 'json', postData, function(result) {\n    strokeWeight(2);\n    stroke(r, g, b);\n    fill(r, g, b, 127);\n    ellipse(mouseX, mouseY, 200, 200);\n    text(result.body, mouseX, mouseY);\n  });\n}\n</code>\n</div>\n\n\n<div><code>\nlet url = 'https://invalidURL'; // A bad URL that will cause errors\nlet postData = { title: 'p5 Clicked!', body: 'p5.js is way cool.' };\n\nfunction setup() {\n  createCanvas(800, 800);\n}\n\nfunction mousePressed() {\n  // Pick new random color values\n  let r = random(255);\n  let g = random(255);\n  let b = random(255);\n\n  httpPost(\n    url,\n    'json',\n    postData,\n    function(result) {\n      // ... won't be called\n    },\n    function(error) {\n      strokeWeight(2);\n      stroke(r, g, b);\n      fill(r, g, b, 127);\n      text(error.toString(), mouseX, mouseY);\n    }\n  );\n}\n</code></div>\n"],class:"p5",module:"IO",submodule:"Input",overloads:[{line:855,params:[{name:"path",description:"<p>name of the file or url to load</p>\n",type:"String"},{name:"datatype",description:'<p>&quot;json&quot;, &quot;jsonp&quot;, &quot;xml&quot;, or &quot;text&quot;.\n                                   If omitted, <a href="#/p5/httpPost">httpPost()</a> will guess.</p>\n',type:"String",optional:!0},{name:"data",description:"<p>param data passed sent with request</p>\n",type:"Object|Boolean",optional:!0},{name:"callback",description:'<p>function to be executed after\n                                   <a href="#/p5/httpPost">httpPost()</a> completes, data is passed in\n                                   as first argument</p>\n',type:"Function",optional:!0},{name:"errorCallback",description:"<p>function to be executed if\n                                   there is an error, response is passed\n                                   in as first argument</p>\n",type:"Function",optional:!0}],return:{description:"A promise that resolves with the data when the operation\n                  completes successfully or rejects with the error after\n                  one occurs.",type:"Promise"}},{line:937,params:[{name:"path",description:"",type:"String"},{name:"data",description:"",type:"Object|Boolean"},{name:"callback",description:"",type:"Function",optional:!0},{name:"errorCallback",description:"",type:"Function",optional:!0}],return:{description:"",type:"Promise"}},{line:945,params:[{name:"path",description:"",type:"String"},{name:"callback",description:"",type:"Function"},{name:"errorCallback",description:"",type:"Function",optional:!0}],return:{description:"",type:"Promise"}}]},{file:"src/io/files.js",line:960,description:"<p>Method for executing an HTTP request. If data type is not specified,\np5 will try to guess based on the URL, defaulting to text.<br><br>\nFor more advanced use, you may also pass in the path as the first argument\nand a object as the second argument, the signature follows the one specified\nin the Fetch API specification.\nThis method is suitable for fetching files up to size of 64MB when &quot;GET&quot; is used.</p>\n",itemtype:"method",name:"httpDo",return:{description:"A promise that resolves with the data when the operation\n                  completes successfully or rejects with the error after\n                  one occurs.",type:"Promise"},example:["\n<div>\n<code>\n// Examples use USGS Earthquake API:\n// https://earthquake.usgs.gov/fdsnws/event/1/#methods\n\n// dis
21plays an animation of all USGS earthquakes\nlet earthquakes;\nlet eqFeatureIndex = 0;\n\nfunction preload() {\n  let url = 'https://earthquake.usgs.gov/fdsnws/event/1/query?format=geojson';\n  httpDo(\n    url,\n    {\n      method: 'GET',\n      // Other Request options, like special headers for apis\n      headers: { authorization: 'Bearer secretKey' }\n    },\n    function(res) {\n      earthquakes = res;\n    }\n  );\n}\n\nfunction draw() {\n  // wait until the data is loaded\n  if (!earthquakes || !earthquakes.features[eqFeatureIndex]) {\n    return;\n  }\n  clear();\n\n  let feature = earthquakes.features[eqFeatureIndex];\n  let mag = feature.properties.mag;\n  let rad = mag / 11 * ((width + height) / 2);\n  fill(255, 0, 0, 100);\n  ellipse(width / 2 + random(-2, 2), height / 2 + random(-2, 2), rad, rad);\n\n  if (eqFeatureIndex >= earthquakes.features.length) {\n    eqFeatureIndex = 0;\n  } else {\n    eqFeatureIndex += 1;\n  }\n}\n</code>\n</div>"],class:"p5",module:"IO",submodule:"Input",overloads:[{line:960,params:[{name:"path",description:"<p>name of the file or url to load</p>\n",type:"String"},{name:"method",description:"<p>either &quot;GET&quot;, &quot;POST&quot;, or &quot;PUT&quot;,\n                                   defaults to &quot;GET&quot;</p>\n",type:"String",optional:!0},{name:"datatype",description:"<p>&quot;json&quot;, &quot;jsonp&quot;, &quot;xml&quot;, or &quot;text&quot;</p>\n",type:"String",optional:!0},{name:"data",description:"<p>param data passed sent with request</p>\n",type:"Object",optional:!0},{name:"callback",description:'<p>function to be executed after\n                                   <a href="#/p5/httpGet">httpGet()</a> completes, data is passed in\n                                   as first argument</p>\n',type:"Function",optional:!0},{name:"errorCallback",description:"<p>function to be executed if\n                                   there is an error, response is passed\n                                   in as first argument</p>\n",type:"Function",optional:!0}],return:{description:"A promise that resolves with the data when the operation\n                  completes successfully or rejects with the error after\n                  one occurs.",type:"Promise"}},{line:1031,params:[{name:"path",description:"",type:"String"},{name:"options",description:'<p>Request object options as documented in the\n                                   &quot;fetch&quot; API\n<a href="https://developer.mozilla.org/en/docs/Web/API/Fetch_API">reference</a></p>\n',type:"Object"},{name:"callback",description:"",type:"Function",optional:!0},{name:"errorCallback",description:"",type:"Function",optional:!0}],return:{description:"",type:"Promise"}}]},{file:"src/io/files.js",line:1193,itemtype:"method",name:"createWriter",params:[{name:"name",description:"<p>name of the file to be created</p>\n",type:"String"},{name:"extension",description:"",type:"String",optional:!0}],return:{description:"",type:"p5.PrintWriter"},example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100);\n  background(200);\n  text('click here to save', 10, 10, 70, 80);\n}\n\nfunction mousePressed() {\n  if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n    var writer = createWriter('squares.txt');\n    for (let i = 0; i < 10; i++) {\n      writer.print(i * i);\n    }\n    writer.close();\n    writer.clear();\n  }\n}\n</code>\n</div>"],class:"p5",module:"IO",submodule:"Output"},{file:"src/io/files.js",line:1248,description:"<p>Writes data to the PrintWriter stream</p>\n",itemtype:"method",name:"write",params:[{name:"data",description:"<p>all data to be written by the PrintWriter</p>\n",type:"Array"}],example:["\n<div class=\"norender notest\">\n<code>\n// creates a file called 'newFile.txt'\nlet writer = createWriter('newFile.txt');\n// write 'Hello world!'' to the file\nwriter.write(['Hello world!']);\n// close the PrintWriter and save the file\nwriter.close();\n</code>\n</div>\n<div class='norender notest'>\n<code>\n// creates a file called 'newFile2.txt'\nlet writer = createWriter('newFile2.txt');\n// write 'apples,bananas,123' to the file\nwriter.write(['apples', 'bananas', 123]);\n// close the PrintWriter and save the file\nwriter.close();\n</code>\n</div>\n<div class='norender notest'>\n<code>\n// creates a file called 'newFile3.txt'\nlet writer = createWriter('newFile3.txt');\n// write 'My name is: Teddy' to the file\nwriter.write('My name is:');\nwriter.write(' Teddy');\n// close the PrintWriter and save the file\nwriter.close();\n</code>\n</div>"],class:"p5.PrintWriter",module:"IO",submodule:"Output"},{file:"src/io/files.js",line:1288,description:"<p>Writes data to the PrintWriter stream, and adds a new line at the end</p>\n",itemtype:"method",name:"print",params:[{name:"data",description:"<p>all data to be printed by the PrintWriter</p>\n",type:"Array"}],example:["\n<div class='norender notest'>\n<code>\n// creates a file called 'newFile.txt'\nlet writer = createWriter('newFile.txt');
21\n// creates a file containing\n//  My name is:\n//  Teddy\nwriter.print('My name is:');\nwriter.print('Teddy');\n// close the PrintWriter and save the file\nwriter.close();\n</code>\n</div>\n<div class='norender notest'>\n<code>\nlet writer;\n\nfunction setup() {\n  createCanvas(400, 400);\n  // create a PrintWriter\n  writer = createWriter('newFile.txt');\n}\n\nfunction draw() {\n  // print all mouseX and mouseY coordinates to the stream\n  writer.print([mouseX, mouseY]);\n}\n\nfunction mouseClicked() {\n  // close the PrintWriter and save the file\n  writer.close();\n}\n</code>\n</div>"],class:"p5.PrintWriter",module:"IO",submodule:"Output"},{file:"src/io/files.js",line:1331,description:"<p>Clears the data already written to the PrintWriter object</p>\n",itemtype:"method",name:"clear",example:["\n<div class =\"norender notest\"><code>\n// create writer object\nlet writer = createWriter('newFile.txt');\nwriter.write(['clear me']);\n// clear writer object here\nwriter.clear();\n// close writer\nwriter.close();\n</code></div>\n"],class:"p5.PrintWriter",module:"IO",submodule:"Output"},{file:"src/io/files.js",line:1349,description:"<p>Closes the PrintWriter</p>\n",itemtype:"method",name:"close",example:["\n<div class=\"norender notest\">\n<code>\n// create a file called 'newFile.txt'\nlet writer = createWriter('newFile.txt');\n// close the PrintWriter and save the file\nwriter.close();\n</code>\n</div>\n<div class='norender notest'>\n<code>\n// create a file called 'newFile2.txt'\nlet writer = createWriter('newFile2.txt');\n// write some data to the file\nwriter.write([100, 101, 102]);\n// close the PrintWriter and save the file\nwriter.close();\n</code>\n</div>"],class:"p5.PrintWriter",module:"IO",submodule:"Output"},{file:"src/io/files.js",line:1398,description:"<p>Save an image, text, json, csv, wav, or html. Prompts download to\nthe client&#39;s computer. <b>Note that it is not recommended to call <a href=\"#/p5/save\">save()</a>\nwithin draw if it&#39;s looping, as the <a href=\"#/p5/save\">save()</a> function will open a new save\ndialog every frame.</b></p>\n<p>The default behavior is to save the canvas as an image. You can\noptionally specify a filename.\nFor example:</p>\n <pre class='language-javascript'><code>\n save();\n save(&#39;myCanvas.jpg&#39;); // save a specific canvas with a filename\n </code></pre>\n\n<p>Alternately, the first parameter can be a pointer to a canvas\n<a href=\"#/p5.Element\">p5.Element</a>, an Array of Strings,\nan Array of JSON, a JSON object, a <a href=\"#/p5.Table\">p5.Table</a>, a <a href=\"#/p5.Image\">p5.Image</a>, or a\np5.SoundFile (requires p5.sound). The second parameter is a filename\n(including extension). The third parameter is for options specific\nto this type of object. This method will save a file that fits the\ngiven parameters. For example:</p>\n\n <pre class='language-javascript'><code>\n // Saves canvas as an image\n save('myCanvas.jpg');\n\n // Saves pImage as a png image\n let img = createImage(10, 10);\n save(img, 'my.png');\n\n // Saves canvas as an image\n let cnv = createCanvas(100, 100);\n save(cnv, 'myCanvas.jpg');\n\n // Saves p5.Renderer object as an image\n let gb = createGraphics(100, 100);\n save(gb, 'myGraphics.jpg');\n\n let myTable = new p5.Table();\n\n // Saves table as html file\n save(myTable, 'myTable.html');\n\n // Comma Separated Values\n save(myTable, 'myTable.csv');\n\n // Tab Separated Values\n save(myTable, 'myTable.tsv');\n\n let myJSON = { a: 1, b: true };\n\n // Saves pretty JSON\n save(myJSON, 'my.json');\n\n // Optimizes JSON filesize\n save(myJSON, 'my.json', true);\n\n // Saves array of strings to a text file with line breaks after each item\n let arrayOfStrings = ['a', 'b'];\n save(arrayOfStrings, 'my.txt');\n </code></pre>",itemtype:"method",name:"save",params:[{name:"objectOrFilename",description:"<p>If filename is provided, will\n                                           save canvas as an image with\n                                           either png or jpg extension\n                                           depending on the filename.\n                                           If object is provided, will\n                                           save depending on the object\n                                           and filename (see examples\n                                           above).</p>\n",type:"Object|String",optional:!0},{name:"filename",description:"<p>If an object is provided as the first\n                             parameter, then the second parameter\n                             indicates the filename,\n                             and should include an appropriate\n                             file extension (see examples above).</p>\n",type:"String",optional:!0},{name:"options",description:"<p>Additional options depend on\n                          filetype. For example, when saving JSON,\n                          <code>true</code> indicates that the\n                          output will be optimized for filesize,\n                          rather than readability.</p>\n",type:"Boolean|String",optional:!0}],class:"p5",module:"IO",submodule:"Output"},{file:"src/io/files.js",line:1526,description:"<p>Writes the contents of an Array or a JSON object to a .json file.\nThe file saving process and location of the saved file will\nvary between web browsers.</p>\n",itemtype:"method",name:"saveJSON",params:[{name:"json",description:"",type:"Array|Object"},{name:"filename",description:"",type:"String"},{name:"optimize",description:"<p>If true, removes line breaks\n                               and spaces from the output\n                               file to optimize filesize\n                               (but not readability).</p>\n",type:"Boolean",optional:!0}],example:['\n <div><code>\n let json = {}; // new  JSON Object\n\n json.id = 0;\n json.species = \'Panthera leo\';\n json.name = \'Lion\';\n\n function setup() {\n createCanvas(100, 100);\n background(200);\n text(\'click here to save\', 10, 10, 70, 80);\n }\n\n function mousePressed() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n   saveJSON(json, \'lion.json\');\n }\n }\n\n // saves the following to a file called "lion.json":\n // {\n //   "id": 0,\n //   "species": "Panthera leo",\n //   "name": "Lion"\n // }\n </code></div>'],alt:"no image displayed",class:"p5",module:"IO",submodule:"Output"},{file:"src/io/files.js",line:1584,description:"<p>Writes an array of Strings to a text file, one line per String.\nThe file saving process and location of the saved file will\nvary between web browsers.</p>\n",itemtype:"method",name:"saveStrings",params:[{name:"list",description:"<p>string array to be written</p>\n",type:"String[]"},{name:"filename",description:"<p>filename for output</p>\n",type:"String"},{name:"extension",description:"<p>the filename&#39;s extension</p>\n",type:"String",optional:!0}],example:["\n <div><code>\n let words = 'apple bear cat dog';\n\n // .split() outputs an Array\n let list = split(words, ' ');\n\n function setup() {\n createCanvas(100, 100);\n background(200);\n text('click here to save', 10, 10, 70, 80);\n }\n\n function mousePressed() {\n if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n   saveStrings(list, 'nouns.txt');\n }\n }\n\n // Saves the following to a file called 'nouns.txt':\n //\n // apple\n // bear\n // cat\n // dog\n </code></div>"],alt:"no image displayed",class:"p5",module:"IO",submodule:"Output"},{file:"src/io/files.js",line:1652,description:'<p>Writes the contents of a <a href="#/p5.Table">Table</a> object to a file. Defaults to a\ntext file with comma-separated-values (&#39;csv&#39;) but can also\nuse tab separation (&#39;tsv&#39;), or generate an HTML table (&#39;html&#39;).\nThe file saving process and location of the saved file will\nvary between web browsers.</p>\n',itemtype:"method",name:"saveTable",params:[{name:"Table",description:'<p>the <a href="#/p5.Table">Table</a> object to save to a file</p>\n',type:"p5.Table"},{name:"filename",description:"<p>the filename to which the Table should be saved</p>\n",type:"String"},{name:"options",description:"<p>can be one of &quot;tsv&quot;, &quot;csv&quot;, or &quot;html&quot;</p>\n",type:"String",optional:!0}],example:["\n<div><code>\n let table;\n\n function setup() {\n table = new p5.Table();\n\n table.addColumn('id');\n table.addColumn('species');\n table.addColumn('name');\n\n let newRow = table.addRow();\n newRow.setNum('id', table.getRowCount() - 1);\n newRow.setString('species', 'Panthera leo');\n newRow.setString('name', 'Lion');\n\n // To save, un-comment next line then click 'run'\n // saveTable(table, 'new.csv');\n }\n\n // Saves the following to a file called 'new.csv':\n // id,species,name\n // 0,Panthera leo,Lion\n </code></div>"],alt:"no image displayed",class:"p5",module:"IO",submodule:"Output"},{file:"src/io/p5.Table.js",line:11,description:'<p>Table Options</p>\n<p>Generic class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.</p>\n<p>CSV files are\n<a href="http://en.wikipedia.org/wiki/Comma-separated_values">\ncomma separated values</a>, often with the data in quotes. TSV\nfiles use tabs as separators, and usually don&#39;t bother with the\nquotes.</p>\n<p>File names should end with .csv if they&#39;re comma separated.</p>\n<p>A rough &quot;spec&quot; for CSV can be found\n<a href="http://tools.ietf.org/html/rfc4180">here</a>.</p>\n<p>To load files, use the <a href="#/p5/loadTable">loadTable</a> method.</p>\n<p>To save tables to your computer, use the <a href="#/p5/save">save</a> method\n or the <a href="#/p5/saveTable">saveTable</a> method.</p>\n\n<p>Possible options include:</p>\n<ul>\n<li>csv - parse the table as comma-separated values\n<li>tsv - parse the table as tab-separated values\n<li>header - this table has a header (title) row\n</ul>',class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:45,itemtype:"property",name:"columns",type:"String[]",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:50,itemtype:"property",name:"rows",type:"p5.TableRow[]",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:56,description:'<p>Use <a href="#/p5/addRow">addRow()</a> to add a new row of data to a <a href="#/p5.Table">p5.Table</a> object. By default,\nan empty row is created. Typically, you would store a reference to\nthe new row in a TableRow object (see newRow in the example above),\nand then set individual values using <a href="#/p5/set">set()</a>.</p>\n<p>If a <a href="#/p5.TableRow">p5.TableRow</a> object is included as a parameter, then that row is\nduplicated and added to the table.</p>\n',itemtype:"method",name:"addRow",params:[{name:"row",description:"<p>row to be added to the table</p>\n",type:"p5.TableRow",optional:!0}],return:{description:"the row that was added",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 let table;\n\n function preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n }\n\n function setup() {\n //add a row\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Canis Lupus');\n newRow.setString('name', 'Wolf');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n   for (let c = 0; c < table.getColumnCount(); c++)\n     print(table.getString(r, c));\n }\n </code>\n </div>"],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:120,description:"<p>Removes a row from the table object.</p>\n",itemtype:"method",name:"removeRow",params:[{name:"id",description:"<p>ID number of the row to remove</p>\n",type:"Integer"}],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\nlet table;\n\nfunction preload() {\n  //my table is comma separated value "csv"\n  //and has a header specifying the columns labels\n  table = loadTable(\'assets/mammals.csv\', \'csv\', \'header\');\n}\n\nfunction setup() {\n  //remove the first row\n  table.removeRow(0);\n\n  //print the results\n  for (let r = 0; r < table.getRowCount(); r++)\n    for (let c = 0; c < table.getColumnCount(); c++)\n      print(table.getString(r, c));\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:168,description:'<p>Returns a reference to the specified <a href="#/p5.TableRow">p5.TableRow</a>. The reference\ncan then be used to get and set values of the selected row.</p>\n',itemtype:"method",name:"getRow",params:[{name:"rowID",description:"<p>ID number of the row to get</p>\n",type:"Integer"}],return:{description:'<a href="#/p5.TableRow">p5.TableRow</a> object',type:"p5.TableRow"},example:['\n<div class="norender">\n<code>\n// Given the CSV file "mammals.csv"\n// in the project\'s "assets" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n  //my table is comma separated value "csv"\n  //and has a header specifying the columns labels\n  table = loadTable(\'assets/mammals.csv\', \'csv\', \'header\');\n}\n\nfunction setup() {\n  let row = table.getRow(1);\n  //print it column by column\n  //note: a row is an object, not an array\n  for (let c = 0; c < table.getColumnCount(); c++) {\n    print(row.getString(c));\n  }\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"}
21,{file:"src/io/p5.Table.js",line:214,description:'<p>Gets all rows from the table. Returns an array of <a href="#/p5.TableRow">p5.TableRow</a>s.</p>\n',itemtype:"method",name:"getRows",return:{description:'Array of <a href="#/p5.TableRow">p5.TableRow</a>s',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 let 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 let rows = table.getRows();\n\n //warning: rows is an array of objects\n for (let r = 0; r < rows.length; r++) {\n   rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n   for (let c = 0; c < table.getColumnCount(); c++)\n     print(table.getString(r, c));\n }\n </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:"Integer|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 let 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 let 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:328,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:"Integer|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 let table;\n\n function preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n }\n\n function setup() {\n //add another goat\n let newRow = table.addRow();\n newRow.setString('id', table.getRowCount() - 1);\n newRow.setString('species', 'Scape Goat');\n newRow.setString('name', 'Goat');\n\n //find the rows containing animals named Goat\n let rows = table.findRows('Goat', 'name');\n print(rows.length + ' Goats found');\n }\n </code>\n </div>"],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:397,description:"<p>Finds the first row in the Table that matches the regular\nexpression provided, and returns a reference to that row.\nEven if multiple rows are possible matches, only the first\nmatching row is returned. The column to search may be\nspecified by either its ID or title.</p>\n",itemtype:"method",name:"matchRow",params:[{name:"regexp",description:"<p>The regular expression to match</p>\n",type:"String|RegExp"},{name:"column",description:"<p>The column ID (number) or\n                                 title (string)</p>\n",type:"String|Integer"}],return:{description:"TableRow object",type:"p5.TableRow"},example:['\n<div class="norender">\n<code>\n// Given the CSV file "mammals.csv"\n// in the project\'s "assets" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n  //my table is comma separated value "csv"\n  //and has a header specifying the columns labels\n  table = loadTable(\'assets/mammals.csv\', \'csv\', \'header\');\n}\n\nfunction setup() {\n  //Search using specified regex on a given column, return TableRow object\n  let mammal = table.matchRow(new RegExp(\'ant\'), 1);\n  print(mammal.getString(1));\n  //Output "Panthera pardus"\n}\n</code>\n</div>\n'],class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:456,description:"<p>Finds the rows in the Table that match the regular expression provided,\nand returns references to those rows. Returns an array, so for must be\nused to iterate through all the rows, as shown in the example. The\ncolumn to search may be specified by either its ID or title.</p>\n",itemtype:"method",name:"matchRows",params:[{name:"regexp",description:"<p>The regular expression to match</p>\n",type:"String"},{name:"column",description:"<p>The column ID (number) or\n                                 title (string)</p>\n",type:"String|Integer",optional:!0}],return:{description:"An Array of TableRow objects",type:"p5.TableRow[]"},example:["\n<div class=\"norender\">\n<code>\nlet table;\n\nfunction setup() {\n  table = new p5.Table();\n\n  table.addColumn('name');\n  table.addColumn('type');\n\n  let newRow = table.addRow();\n  newRow.setString('name', 'Lion');\n  newRow.setString('type', 'Mammal');\n\n  newRow = table.addRow();\n  newRow.setString('name', 'Snake');\n  newRow.setString('type', 'Reptile');\n\n  newRow = table.addRow();\n  newRow.setString('name', 'Mosquito');\n  newRow.setString('type', 'Insect');\n\n  newRow = table.addRow();\n  newRow.setString('name', 'Lizard');\n  newRow.setString('type', 'Reptile');\n\n  let rows = table.matchRows('R.*', 'type');\n  for (let i = 0; i < rows.length;
21 i++) {\n    print(rows[i].getString('name') + ': ' + rows[i].getString('type'));\n  }\n}\n// Sketch prints:\n// Snake: Reptile\n// Lizard: Reptile\n</code>\n</div>"],class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:523,description:"<p>Retrieves all values in the specified column, and returns them\nas an array. The column may be specified by either its ID or title.</p>\n",itemtype:"method",name:"getColumn",params:[{name:"column",description:"<p>String or Number of the column to return</p>\n",type:"String|Number"}],return:{description:"Array of column values",type:"Array"},example:['\n <div class="norender">\n <code>\n // Given the CSV file "mammals.csv"\n // in the project\'s "assets" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n let table;\n\n function preload() {\n //my table is comma separated value "csv"\n //and has a header specifying the columns labels\n table = loadTable(\'assets/mammals.csv\', \'csv\', \'header\');\n }\n\n function setup() {\n //getColumn returns an array that can be printed directly\n print(table.getColumn(\'species\'));\n //outputs ["Capra hircus", "Panthera pardus", "Equus zebra"]\n }\n </code>\n </div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:576,description:"<p>Removes all rows from a Table. While all rows are removed,\ncolumns and column titles are maintained.</p>\n",itemtype:"method",name:"clearRows",example:["\n <div class=\"norender\">\n <code>\n // Given the CSV file \"mammals.csv\"\n // in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n let table;\n\n function preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n }\n\n function setup() {\n table.clearRows();\n print(table.getRowCount() + ' total rows in table');\n print(table.getColumnCount() + ' total columns in table');\n }\n </code>\n </div>"],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:618,description:'<p>Use <a href="#/p5/addColumn">addColumn()</a> to add a new column to a <a href="#/p5.Table">Table</a> object.\nTypically, you will want to specify a title, so the column\nmay be easily referenced later by name. (If no title is\nspecified, the new column&#39;s title will be null.)</p>\n',itemtype:"method",name:"addColumn",params:[{name:"title",description:"<p>title of the given column</p>\n",type:"String",optional:!0}],example:["\n <div class=\"norender\">\n <code>\n // Given the CSV file \"mammals.csv\"\n // in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n let table;\n\n function preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n }\n\n function setup() {\n table.addColumn('carnivore');\n table.set(0, 'carnivore', 'no');\n table.set(1, 'carnivore', 'yes');\n table.set(2, 'carnivore', 'no');\n\n //print the results\n for (let r = 0; r < table.getRowCount(); r++)\n   for (let 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:669,description:"<p>Returns the total number of columns in a Table.</p>\n",itemtype:"method",name:"getColumnCount",return:{description:"Number of columns in this table",type:"Integer"},example:["\n <div>\n <code>\n // given the cvs file \"blobs.csv\" in /assets directory\n // ID, Name, Flavor, Shape, Color\n // Blob1, Blobby, Sweet, Blob, Pink\n // Blob2, Saddy, Savory, Blob, Blue\n\n let table;\n\n function preload() {\n table = loadTable('assets/blobs.csv');\n }\n\n function setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n }\n\n function draw() {\n let numOfColumn = table.getColumnCount();\n text('There are ' + numOfColumn + ' columns in the table.', 100, 50);\n }\n </code>\n </div>"],class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:705,description:"<p>Returns the total number of rows in a Table.</p>\n",itemtype:"method",name:"getRowCount",return:{description:"Number of rows in this table",type:"Integer"},example:["\n <div>\n <code>\n // given the cvs file \"blobs.csv\" in /assets directory\n //\n // ID, Name, Flavor, Shape, Color\n // Blob1, Blobby, Sweet, Blob, Pink\n // Blob2, Saddy, Savory, Blob, Blue\n\n let table;\n\n function preload() {\n table = loadTable('assets/blobs.csv');\n }\n\n function setup() {\n createCanvas(200, 100);\n textAlign(CENTER);\n background(255);\n }\n\n function draw() {\n text('There are ' + table.getRowCount() + ' rows in the table.', 100, 50);\n }\n </code>\n </div>"],class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:741,description:"<p>Removes any of the specified characters (or &quot;tokens&quot;).</p>\n\n<p>If no column is specified, then the values in all columns and\nrows are processed. A specific column may be referenced by\neither its ID or title.</p>",itemtype:"method",name:"removeTokens",params:[{name:"chars",description:"<p>String listing characters to be removed</p>\n",type:"String"},{name:"column",description:"<p>Column ID (number)\n                                 or name (string)</p>\n",type:"String|Integer",optional:!0}],example:["\n <div class=\"norender\"><code>\n function setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', '   $Lion  ,');\n newRow.setString('type', ',,,Mammal');\n\n newRow = table.addRow();\n newRow.setString('name', '$Snake  ');\n newRow.setString('type', ',,,Reptile');\n\n table.removeTokens(',$ ');\n print(table.getArray());\n }\n\n // prints:\n //  0  \"Lion\"   \"Mamal\"\n //  1  \"Snake\"  \"Reptile\"\n </code></div>"],class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:815,description:"<p>Trims leading and trailing whitespace, such as spaces and tabs,\nfrom String table values. If no column is specified, then the\nvalues in all columns and rows are trimmed. A specific column\nmay be referenced by either its ID or title.</p>\n",itemtype:"method",name:"trim",params:[{name:"column",description:"<p>Column ID (number)\n                                 or name (string)</p>\n",type:"String|Integer",optional:!0}],example:["\n <div class=\"norender\"><code>\n function setup() {\n let table = new p5.Table();\n\n table.addColumn('name');\n table.addColumn('type');\n\n let newRow = table.addRow();\n newRow.setString('name', '   Lion  ,');\n newRow.setString('type', ' Mammal  ');\n\n newRow = table.addRow();\n newRow.setString('name', '  Snake  ');\n newRow.setString('type', '  Reptile  ');\n\n table.trim();\n print(table.getArray());\n }\n\n // prints:\n //  0  \"Lion\"   \"Mamal\"\n //  1  \"Snake\"  \"Reptile\"\n </code></div>"],class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:879,description:'<p>
21Use <a href="#/p5/removeColumn">removeColumn()</a> to remove an existing column from a Table\nobject. The column to be removed may be identified by either\nits title (a String) or its index value (an int).\nremoveColumn(0) would remove the first column, removeColumn(1)\nwould remove the second column, and so on.</p>\n',itemtype:"method",name:"removeColumn",params:[{name:"column",description:"<p>columnName (string) or ID (number)</p>\n",type:"String|Integer"}],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 let table;\n\n function preload() {\n //my table is comma separated value \"csv\"\n //and has a header specifying the columns labels\n table = loadTable('assets/mammals.csv', 'csv', 'header');\n }\n\n function setup() {\n table.removeColumn('id');\n print(table.getColumnCount());\n }\n </code>\n </div>"],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:944,description:"<p>Stores a value in the Table&#39;s specified row and column.\nThe row is specified by its ID, while the column may be specified\nby either its ID or title.</p>\n",itemtype:"method",name:"set",params:[{name:"row",description:"<p>row ID</p>\n",type:"Integer"},{name:"column",description:"<p>column ID (Number)\n                              or title (String)</p>\n",type:"String|Integer"},{name:"value",description:"<p>value to assign</p>\n",type:"String|Number"}],example:["\n<div class=\"norender\">\n<code>\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n  //my table is comma separated value \"csv\"\n  //and has a header specifying the columns labels\n  table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n  table.set(0, 'species', 'Canis Lupus');\n  table.set(0, 'name', 'Wolf');\n\n  //print the results\n  for (let r = 0; r < table.getRowCount(); r++)\n    for (let c = 0; c < table.getColumnCount(); c++)\n      print(table.getString(r, c));\n}\n</code>\n</div>"],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:994,description:"<p>Stores a Float value in the Table&#39;s specified row and column.\nThe row is specified by its ID, while the column may be specified\nby either its ID or title.</p>\n",itemtype:"method",name:"setNum",params:[{name:"row",description:"<p>row ID</p>\n",type:"Integer"},{name:"column",description:"<p>column ID (Number)\n                              or title (String)</p>\n",type:"String|Integer"},{name:"value",description:"<p>value to assign</p>\n",type:"Number"}],example:['\n<div class="norender">\n<code>\n// Given the CSV file "mammals.csv"\n// in the project\'s "assets" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n  //my table is comma separated value "csv"\n  //and has a header specifying the columns labels\n  table = loadTable(\'assets/mammals.csv\', \'csv\', \'header\');\n}\n\nfunction setup() {\n  table.setNum(1, \'id\', 1);\n\n  print(table.getColumn(0));\n  //["0", 1, "2"]\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:1040,description:"<p>Stores a String value in the Table&#39;s specified row and column.\nThe row is specified by its ID, while the column may be specified\nby either its ID or title.</p>\n",itemtype:"method",name:"setString",params:[{name:"row",description:"<p>row ID</p>\n",type:"Integer"},{name:"column",description:"<p>column ID (Number)\n                              or title (String)</p>\n",type:"String|Integer"},{name:"value",description:"<p>value to assign</p>\n",type:"String"}],example:["\n<div class=\"norender\"><code>\n// Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n  //my table is comma separated value \"csv\"\n  //and has a header specifying the columns labels\n  table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n  //add a row\n  let newRow = table.addRow();\n  newRow.setString('id', table.getRowCount() - 1);\n  newRow.setString('species', 'Canis Lupus');\n  newRow.setString('name', 'Wolf');\n\n  print(table.getArray());\n}\n</code></div>"],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:1085,description:"<p>Retrieves a value from the Table&#39;s specified row and column.\nThe row is specified by its ID, while the column may be specified by\neither its ID or title.</p>\n",itemtype:"method",name:"get",params:[{name:"row",description:"<p>row ID</p>\n",type:"Integer"},{name:"column",description:"<p>columnName (string) or\n                                  ID (number)</p>\n",type:"String|Integer"}],return:{description:"",type:"String|Number"},example:["\n<div class=\"norender\">\n<code>\n// Given the CSV file \"mammals.csv\"\n// in the project's \"assets\" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n  //my table is comma separated value \"csv\"\n  //and has a header specifying the columns labels\n  table = loadTable('assets/mammals.csv', 'csv', 'header');\n}\n\nfunction setup() {\n  print(table.get(0, 1));\n  //Capra hircus\n  print(table.get(0, 'species'));\n  //Capra hircus\n}\n</code>\n</div>"],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:1132,description:"<p>Retrieves a Float value from the Table&#39;s specified row and column.\nThe row is specified by its ID, while the column may be specified by\neither its ID or title.</p>\n",itemtype:"method",name:"getNum",params:[{name:"row",description:"<p>row ID</p>\n",type:"Integer"},{name:"column",description:"<p>columnName (string) or\n                                  ID (number)</p>\n",type:"String|Integer"}],return:{description:"",type:"Number"},example:['\n<div class="norender">\n<code>\n// Given the CSV file "mammals.csv"\n// in the project\'s "assets" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n  //my table is comma separated value "csv"\n  //and has a header specifying the columns labels\n  table = loadTable(\'assets/mammals.csv\', \'csv\', \'header\');\n}\n\nfunction setup() {\n  print(table.getNum(1, 0) + 100);\n  //id 1 + 100 = 101\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:1177,description:"<p>Retrieves a String value from the Table&#39;s specified row and column.\nThe row is specified by its ID, while the column may be specified by\neither its ID or title.</p>\n",itemtype:"method",name:"getString",params:[{name:"row",description:"<p>row ID</p>\n",type:"Integer"},{name:"column",description:"<p>columnName (string) or\n                                  ID (number)</p>\n",type:"String|Integer"}],return:{description:"",type:"String"},example:['\n<div class="norender">\n<code>\n// Given the CSV file "mammals.csv"\n// in the project\'s "assets" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n  // table is comma separated value "CSV"\n  // and has specifiying header for column labels\n  table = loadTable(\'assets/mammals.csv\', \'csv\', \'header\');\n}\n\nfunction setup() {\n  print(table.getString(0, 0)); // 0\n  print(table.getString(0, 1)); // Capra hircus\n  print(table.getString(0, 2)); // Goat\n  print(table.getString(1, 0)); // 1\n  print(table.getString(1, 1)); // Panthera pardus\n  print(table.getString(1, 2)); // Leopard\n  print(table.getString(2, 0)); // 2\n  print(table.getString(2, 1)); // Equus zebra\n  print(table.getString(2, 2)); // Zebra\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:1230,description:"<p>Retrieves all table data and returns as an object. If a column name is\npassed in, each row object will be stored with that attribute as its\ntitle.</p>\n",itemtype:"method",name:"getObject",params:[{name:"headerColumn",description:"<p>Name of the column which should be used to\n                             title each row object (optional)</p>\n",type:"String",optional:!0}],return:{description:"",type:"Object"},example:['\n<div class="norender">\n<code>\n// Given the CSV file "mammals.csv"\n// in the project\'s "assets" folder:\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leopard\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n  //my table is comma separated value "csv"\n  //and has a header specifying the columns labels\n  table = loadTable(\'assets/mammals.csv\', \'csv\', \'header\');\n}\n\nfunction setup() {\n  let tableObject = table.getObject();\n\n  print(tableObject);\n  //outputs an object\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.Table.js",line:1296,description:"<p>Retrieves all table data and returns it as a multidimensional array.</p>\n",itemtype:"method",name:"getArray",return:{description:"",type:"Array"},example:['\n<div class="norender">\n<code>\n// Given the CSV file "mammals.csv"\n// in the project\'s "assets" folder\n//\n// id,species,name\n// 0,Capra hircus,Goat\n// 1,Panthera pardus,Leoperd\n// 2,Equus zebra,Zebra\n\nlet table;\n\nfunction preload() {\n  // table is comma separated value "CSV"\n  // and has specifiying header for column labels\n  table = loadTable(\'assets/mammals.csv\', \'csv\', \'header\');\n}\n\nfunction setup() {\n  let tableArray = table.getArray();\n  for (let i = 0; i < tableArray.length;
21 i++) {\n    print(tableArray[i]);\n  }\n}\n</code>\n</div>'],alt:"no image displayed",class:"p5.Table",module:"IO",submodule:"Table"},{file:"src/io/p5.TableRow.js",line:42,description:"<p>Stores a value in the TableRow&#39;s specified column.\nThe column may be specified by either its ID or title.</p>\n",itemtype:"method",name:"set",params:[{name:"column",description:"<p>Column ID (Number)\n                              or Title (String)</p>\n",type:"String|Integer"},{name:"value",description:"<p>The value to be stored</p>\n",type:"String|Number"}],example:["\n <div class=\"norender\"><code>\n // Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n let 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 let rows = table.getRows();\n for (let r = 0; r < rows.length; r++) {\n   rows[r].set('name', 'Unicorn');\n }\n\n //print the results\n print(table.getArray());\n }\n </code></div>"],alt:"no image displayed",class:"p5.TableRow",module:"IO",submodule:"Table"},{file:"src/io/p5.TableRow.js",line:106,description:"<p>Stores a Float value in the TableRow&#39;s specified column.\nThe column may be specified by either its ID or title.</p>\n",itemtype:"method",name:"setNum",params:[{name:"column",description:"<p>Column ID (Number)\n                              or Title (String)</p>\n",type:"String|Integer"},{name:"value",description:"<p>The value to be stored\n                              as a Float</p>\n",type:"Number|String"}],example:["\n <div class=\"norender\"><code>\n // Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n let 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 let rows = table.getRows();\n for (let r = 0; r < rows.length; r++) {\n   rows[r].setNum('id', r + 10);\n }\n\n print(table.getArray());\n }\n </code></div>"],alt:"no image displayed",class:"p5.TableRow",module:"IO",submodule:"Table"},{file:"src/io/p5.TableRow.js",line:150,description:"<p>Stores a String value in the TableRow&#39;s specified column.\nThe column may be specified by either its ID or title.</p>\n",itemtype:"method",name:"setString",params:[{name:"column",description:"<p>Column ID (Number)\n                              or Title (String)</p>\n",type:"String|Integer"},{name:"value",description:"<p>The value to be stored\n                              as a String</p>\n",type:"String|Number|Boolean|Object"}],example:["\n <div class=\"norender\"><code>\n // Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n let 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 let rows = table.getRows();\n for (let r = 0; r < rows.length; r++) {\n   let name = rows[r].getString('name');\n   rows[r].setString('name', 'A ' + name + ' named George');\n }\n\n print(table.getArray());\n }\n </code></div>"],alt:"no image displayed",class:"p5.TableRow",module:"IO",submodule:"Table"},{file:"src/io/p5.TableRow.js",line:195,description:"<p>Retrieves a value from the TableRow&#39;s specified column.\nThe column may be specified by either its ID or title.</p>\n",itemtype:"method",name:"get",params:[{name:"column",description:"<p>columnName (string) or\n                                 ID (number)</p>\n",type:"String|Integer"}],return:{description:"",type:"String|Number"},example:["\n <div class=\"norender\"><code>\n // Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n let 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 let names = [];\n let rows = table.getRows();\n for (let r = 0; r < rows.length; r++) {\n   names.push(rows[r].get('name'));\n }\n\n print(names);\n }\n </code></div>"],alt:"no image displayed",class:"p5.TableRow",module:"IO",submodule:"Table"},{file:"src/io/p5.TableRow.js",line:243,description:"<p>Retrieves a Float value from the TableRow&#39;s specified\ncolumn. The column may be specified by either its ID or\ntitle.</p>\n",itemtype:"method",name:"getNum",params:[{name:"column",description:"<p>columnName (string) or\n                                 ID (number)</p>\n",type:"String|Integer"}],return:{description:"Float Floating point number",type:"Number"},example:["\n <div class=\"norender\"><code>\n // Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n let 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 let rows = table.getRows();\n let minId = Infinity;\n let maxId = -Infinity;\n for (let r = 0; r < rows.length; r++) {\n   let id = rows[r].getNum('id');\n   minId = min(minId, id);\n   maxId = min(maxId, id);\n }\n print('minimum id = ' + minId + ', maximum id = ' + maxId);\n }\n </code></div>"],alt:"no image displayed",class:"p5.TableRow",module:"IO",submodule:"Table"},{file:"src/io/p5.TableRow.js",line:299,description:"<p>Retrieves an String value from the TableRow&#39;s specified\ncolumn. The column may be specified by either its ID or\ntitle.</p>\n",itemtype:"method",name:"getString",params:[{name:"column",description:"<p>columnName (string) or\n                                 ID (number)</p>\n",type:"String|Integer"}],return:{description:"String",type:"String"},example:["\n <div class=\"norender\"><code>\n // Given the CSV file \"mammals.csv\" in the project's \"assets\" folder:\n //\n // id,species,name\n // 0,Capra hircus,Goat\n // 1,Panthera pardus,Leopard\n // 2,Equus zebra,Zebra\n\n let 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 let rows = table.getRows();\n let longest = '';\n for (let r = 0; r < rows.length; r++) {\n   let species = rows[r].getString('species');\n   if (longest.length < species.length) {\n     longest = species;\n   }\n }\n\n print('longest: ' + longest);\n }\n </code></div>"],alt:"no image displayed",class:"p5.TableRow",module:"IO",submodule:"Table"},{file:"src/io/p5.XML.js",line:65,description:'<p>Gets a copy of the element&#39;s parent. Returns the parent as another\n<a href="#/p5.XML">p5.XML</a> object.</p>\n',itemtype:"method",name:"getParent",return:{description:"element parent",type:"p5.XML"},example:['\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">
21Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  let children = xml.getChildren(\'animal\');\n  let parent = children[1].getParent();\n  print(parent.getName());\n}\n\n// Sketch prints:\n// mammals\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:103,description:"<p>Gets the element&#39;s full name, which is returned as a String.</p>\n",itemtype:"method",name:"getName",return:{description:"the name of the node",type:"String"},example:['&lt;animal\n <div class=\'norender\'><code>\n // The following short XML file called "mammals.xml" is parsed\n // in the code below.\n //\n // <?xml version="1.0"?>\n // &lt;mammals&gt;\n //   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n //   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n //   &lt;animal id="2" species="Equus zebra">Zebra&lt;/animal&gt;\n // &lt;/mammals&gt;\n\n let xml;\n\n function preload() {\n xml = loadXML(\'assets/mammals.xml\');\n }\n\n function setup() {\n print(xml.getName());\n }\n\n // Sketch prints:\n // mammals\n </code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:138,description:"<p>Sets the element&#39;s name, which is specified as a String.</p>\n",itemtype:"method",name:"setName",params:[{name:"the",description:"<p>new name of the node</p>\n",type:"String"}],example:['&lt;animal\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  print(xml.getName());\n  xml.setName(\'fish\');\n  print(xml.getName());\n}\n\n// Sketch prints:\n// mammals\n// fish\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:184,description:"<p>Checks whether or not the element has any children, and returns the result\nas a boolean.</p>\n",itemtype:"method",name:"hasChildren",return:{description:"",type:"Boolean"},example:['&lt;animal\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  print(xml.hasChildren());\n}\n\n// Sketch prints:\n// true\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:220,description:'<p>Get the names of all of the element&#39;s children, and returns the names as an\narray of Strings. This is the same as looping through and calling <a href="#/p5.XML/getName">getName()</a>\non each child element individually.</p>\n',itemtype:"method",name:"listChildren",return:{description:"names of the children of the element",type:"String[]"},example:['&lt;animal\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  print(xml.listChildren());\n}\n\n// Sketch prints:\n// ["animal", "animal", "animal"]\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:261,description:'<p>Returns all of the element&#39;s children as an array of <a href="#/p5.XML">p5.XML</a> objects. When\nthe name parameter is specified, then it will return all children that match\nthat name.</p>\n',itemtype:"method",name:"getChildren",params:[{name:"name",description:"<p>element name</p>\n",type:"String",optional:!0}],return:{description:"children of the element",type:"p5.XML[]"},example:['&lt;animal\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">
21Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  let animals = xml.getChildren(\'animal\');\n\n  for (let i = 0; i < animals.length; i++) {\n    print(animals[i].getContent());\n  }\n}\n\n// Sketch prints:\n// "Goat"\n// "Leopard"\n// "Zebra"\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:317,description:"<p>Returns the first of the element&#39;s children that matches the name parameter\nor the child of the given index.It returns undefined if no matching\nchild is found.</p>\n",itemtype:"method",name:"getChild",params:[{name:"name",description:"<p>element name or index</p>\n",type:"String|Integer"}],return:{description:"",type:"p5.XML"},example:['&lt;animal\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  let firstChild = xml.getChild(\'animal\');\n  print(firstChild.getContent());\n}\n\n// Sketch prints:\n// "Goat"\n</code></div>\n<div class=\'norender\'><code>\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  let secondChild = xml.getChild(1);\n  print(secondChild.getContent());\n}\n\n// Sketch prints:\n// "Leopard"\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:378,description:'<p>Appends a new child to the element. The child can be specified with\neither a String, which will be used as the new tag&#39;s name, or as a\nreference to an existing <a href="#/p5.XML">p5.XML</a> object.\nA reference to the newly created child is returned as an <a href="#/p5.XML">p5.XML</a> object.</p>\n',itemtype:"method",name:"addChild",params:[{name:"node",description:'<p>a <a href="#/p5.XML">p5.XML</a> Object which will be the child to be added</p>\n',type:"p5.XML"}],example:['\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  let child = new p5.XML();\n  child.setName(\'animal\');\n  child.setAttribute(\'id\', \'3\');\n  child.setAttribute(\'species\', \'Ornithorhynchus anatinus\');\n  child.setContent(\'Platypus\');\n  xml.addChild(child);\n\n  let animals = xml.getChildren(\'animal\');\n  print(animals[animals.length - 1].getContent());\n}\n\n// Sketch prints:\n// "Goat"\n// "Leopard"\n// "Zebra"\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:430,description:"<p>Removes the element specified by name or index.</p>\n",itemtype:"method",name:"removeChild",params:[{name:"name",description:"<p>element name or index</p>\n",type:"String|Integer"}],example:['\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  xml.removeChild(\'animal\');\n  let children = xml.getChildren();\n  for (let i = 0; i < children.length; i++) {\n    print(children[i].getContent());\n  }\n}\n\n// Sketch prints:\n// "Leopard"\n// "Zebra"\n</code></div>\n<div class=\'norender\'><code>\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  xml.removeChild(1);\n  let children = xml.getChildren();\n  for (let i = 0; i < children.length;
21 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:502,description:"<p>Counts the specified element&#39;s number of attributes, returned as an Number.</p>\n",itemtype:"method",name:"getAttributeCount",return:{description:"",type:"Integer"},example:['\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  let firstChild = xml.getChild(\'animal\');\n  print(firstChild.getAttributeCount());\n}\n\n// Sketch prints:\n// 2\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:538,description:"<p>Gets all of the specified element&#39;s attributes, and returns them as an\narray of Strings.</p>\n",itemtype:"method",name:"listAttributes",return:{description:"an array of strings containing the names of attributes",type:"String[]"},example:['\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  let firstChild = xml.getChild(\'animal\');\n  print(firstChild.listAttributes());\n}\n\n// Sketch prints:\n// ["id", "species"]\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:580,description:"<p>Checks whether or not an element has the specified attribute.</p>\n",itemtype:"method",name:"hasAttribute",params:[{name:"the",description:"<p>attribute to be checked</p>\n",type:"String"}],return:{description:"true if attribute found else false",type:"Boolean"},example:['\n <div class=\'norender\'><code>\n // The following short XML file called "mammals.xml" is parsed\n // in the code below.\n //\n // <?xml version="1.0"?>\n // &lt;mammals&gt;\n //   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n //   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n //   &lt;animal id="2" species="Equus zebra">Zebra&lt;/animal&gt;\n // &lt;/mammals&gt;\n\n let xml;\n\n function preload() {\n xml = loadXML(\'assets/mammals.xml\');\n }\n\n function setup() {\n let firstChild = xml.getChild(\'animal\');\n print(firstChild.hasAttribute(\'species\'));\n print(firstChild.hasAttribute(\'color\'));\n }\n\n // Sketch prints:\n // true\n // false\n </code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:624,description:"<p>Returns an attribute value of the element as an Number. If the defaultValue\nparameter is specified and the attribute doesn&#39;t exist, then defaultValue\nis returned. If no defaultValue is specified and the attribute doesn&#39;t\nexist, the value 0 is returned.</p>\n",itemtype:"method",name:"getNum",params:[{name:"name",description:"<p>the non-null full name of the attribute</p>\n",type:"String"},{name:"defaultValue",description:"<p>the default value of the attribute</p>\n",type:"Number",optional:!0}],return:{description:"",type:"Number"},example:['\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">
21Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  let firstChild = xml.getChild(\'animal\');\n  print(firstChild.getNum(\'id\'));\n}\n\n// Sketch prints:\n// 0\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:670,description:"<p>Returns an attribute value of the element as an String. If the defaultValue\nparameter is specified and the attribute doesn&#39;t exist, then defaultValue\nis returned. If no defaultValue is specified and the attribute doesn&#39;t\nexist, null is returned.</p>\n",itemtype:"method",name:"getString",params:[{name:"name",description:"<p>the non-null full name of the attribute</p>\n",type:"String"},{name:"defaultValue",description:"<p>the default value of the attribute</p>\n",type:"Number",optional:!0}],return:{description:"",type:"String"},example:['\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  let firstChild = xml.getChild(\'animal\');\n  print(firstChild.getString(\'species\'));\n}\n\n// Sketch prints:\n// "Capra hircus"\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:716,description:"<p>Sets the content of an element&#39;s attribute. The first parameter specifies\nthe attribute name, while the second specifies the new content.</p>\n",itemtype:"method",name:"setAttribute",params:[{name:"name",description:"<p>the full name of the attribute</p>\n",type:"String"},{name:"value",description:"<p>the value of the attribute</p>\n",type:"Number|String|Boolean"}],example:['\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  let firstChild = xml.getChild(\'animal\');\n  print(firstChild.getString(\'species\'));\n  firstChild.setAttribute(\'species\', \'Jamides zebra\');\n  print(firstChild.getString(\'species\'));\n}\n\n// Sketch prints:\n// "Capra hircus"\n// "Jamides zebra"\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:757,description:"<p>Returns the content of an element. If there is no such content,\ndefaultValue is returned if specified, otherwise null is returned.</p>\n",itemtype:"method",name:"getContent",params:[{name:"defaultValue",description:"<p>value returned if no content is found</p>\n",type:"String",optional:!0}],return:{description:"",type:"String"},example:['\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  let firstChild = xml.getChild(\'animal\');\n  print(firstChild.getContent());\n}\n\n// Sketch prints:\n// "Goat"\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:798,description:"<p>Sets the element&#39;s content.</p>\n",itemtype:"method",name:"setContent",params:[{name:"text",description:"<p>the new content</p>\n",type:"String"}],example:['\n<div class=\'norender\'><code>\n// The following short XML file called "mammals.xml" is parsed\n// in the code below.\n//\n// <?xml version="1.0"?>\n// &lt;mammals&gt;\n//   &lt;animal id="0" species="Capra hircus">Goat&lt;/animal&gt;\n//   &lt;animal id="1" species="Panthera pardus">Leopard&lt;/animal&gt;\n//   &lt;animal id="2" species="Equus zebra">
21Zebra&lt;/animal&gt;\n// &lt;/mammals&gt;\n\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  let firstChild = xml.getChild(\'animal\');\n  print(firstChild.getContent());\n  firstChild.setContent(\'Mountain Goat\');\n  print(firstChild.getContent());\n}\n\n// Sketch prints:\n// "Goat"\n// "Mountain Goat"\n</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/io/p5.XML.js",line:839,description:"<p>Serializes the element into a string. This function is useful for preparing\nthe content to be sent over a http request or saved to file.</p>\n",itemtype:"method",name:"serialize",return:{description:"Serialized string of the element",type:"String"},example:['\n<div class=\'norender\'><code>\nlet xml;\n\nfunction preload() {\n  xml = loadXML(\'assets/mammals.xml\');\n}\n\nfunction setup() {\n  print(xml.serialize());\n}\n\n// Sketch prints:\n// <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</code></div>'],class:"p5.XML",module:"IO",submodule:"XML"},{file:"src/math/calculation.js",line:12,description:"<p>Calculates the absolute value (magnitude) of a number. Maps to Math.abs().\nThe absolute value of a number is always positive.</p>\n",itemtype:"method",name:"abs",params:[{name:"n",description:"<p>number to compute</p>\n",type:"Number"}],return:{description:"absolute value of given number",type:"Number"},example:['\n<div class = "norender"><code>\nfunction setup() {\n  let x = -3;\n  let y = abs(x);\n\n  print(x); // -3\n  print(y); // 3\n}\n</code></div>'],alt:"no image displayed",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:36,description:"<p>Calculates the closest int value that is greater than or equal to the\nvalue of the parameter. Maps to Math.ceil(). For example, ceil(9.03)\nreturns the value 10.</p>\n",itemtype:"method",name:"ceil",params:[{name:"n",description:"<p>number to round up</p>\n",type:"Number"}],return:{description:"rounded up number",type:"Integer"},example:["\n<div><code>\nfunction draw() {\n  background(200);\n  // map, mouseX between 0 and 5.\n  let ax = map(mouseX, 0, 100, 0, 5);\n  let ay = 66;\n\n  //Get the ceiling of the mapped number.\n  let bx = ceil(map(mouseX, 0, 100, 0, 5));\n  let by = 33;\n\n  // Multiply the mapped numbers by 20 to more easily\n  // see the changes.\n  stroke(0);\n  fill(0);\n  line(0, ay, ax * 20, ay);\n  line(0, by, bx * 20, by);\n\n  // Reformat the float returned by map and draw it.\n  noStroke();\n  text(nfc(ax, 2), ax, ay - 5);\n  text(nfc(bx, 1), bx, by - 5);\n}\n</code></div>"],alt:"2 horizontal lines & number sets. increase with mouse x. bottom to 2 decimals",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:76,description:"<p>Constrains a value between a minimum and maximum value.</p>\n",itemtype:"method",name:"constrain",params:[{name:"n",description:"<p>number to constrain</p>\n",type:"Number"},{name:"low",description:"<p>minimum limit</p>\n",type:"Number"},{name:"high",description:"<p>maximum limit</p>\n",type:"Number"}],return:{description:"constrained number",type:"Number"},example:["\n<div><code>\nfunction draw() {\n  background(200);\n\n  let leftWall = 25;\n  let rightWall = 75;\n\n  // xm is just the mouseX, while\n  // xc is the mouseX, but constrained\n  // between the leftWall and rightWall!\n  let xm = mouseX;\n  let xc = constrain(mouseX, leftWall, rightWall);\n\n  // Draw the walls.\n  stroke(150);\n  line(leftWall, 0, leftWall, height);\n  line(rightWall, 0, rightWall, height);\n\n  // Draw xm and xc as circles.\n  noStroke();\n  fill(150);\n  ellipse(xm, 33, 9, 9); // Not Constrained\n  fill(0);\n  ellipse(xc, 66, 9, 9); // Constrained\n}\n</code></div>"],alt:"2 vertical lines. 2 ellipses move with mouse X 1 does not move passed lines",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:121,description:"<p>Calculates the distance between two points, in either two or three dimensions.</p>\n",itemtype:"method",name:"dist",return:{description:"distance between the two points",type:"Number"},example:["\n<div><code>\n// Move your mouse inside the canvas to see the\n// change in distance between two points!\nfunction draw() {\n  background(200);\n  fill(0);\n\n  let x1 = 10;\n  let y1 = 90;\n  let x2 = mouseX;\n  let y2 = mouseY;\n\n  line(x1, y1, x2, y2);\n  ellipse(x1, y1, 7, 7);\n  ellipse(x2, y2, 7, 7);\n\n  // d is the length of the line\n  // the distance from point 1 to point 2.\n  let d = int(dist(x1, y1, x2, y2));\n\n  // Let's write d along the line we are drawing!\n  push();\n  translate((x1 + x2) / 2, (y1 + y2) / 2);\n  rotate(atan2(y2 - y1, x2 - x1));
21\n  text(nfc(d, 1), 0, -5);\n  pop();\n  // Fancy!\n}\n</code></div>"],alt:"2 ellipses joined by line. 1 ellipse moves with mouse X&Y. Distance displayed.",class:"p5",module:"Math",submodule:"Calculation",overloads:[{line:121,params:[{name:"x1",description:"<p>x-coordinate of the first point</p>\n",type:"Number"},{name:"y1",description:"<p>y-coordinate of the first point</p>\n",type:"Number"},{name:"x2",description:"<p>x-coordinate of the second point</p>\n",type:"Number"},{name:"y2",description:"<p>y-coordinate of the second point</p>\n",type:"Number"}],return:{description:"distance between the two points",type:"Number"}},{line:165,params:[{name:"x1",description:"",type:"Number"},{name:"y1",description:"",type:"Number"},{name:"z1",description:"<p>z-coordinate of the first point</p>\n",type:"Number"},{name:"x2",description:"",type:"Number"},{name:"y2",description:"",type:"Number"},{name:"z2",description:"<p>z-coordinate of the second point</p>\n",type:"Number"}],return:{description:"distance between the two points",type:"Number"}}]},{file:"src/math/calculation.js",line:190,description:"<p>Returns Euler&#39;s number e (2.71828...) raised to the power of the n\nparameter. Maps to Math.exp().</p>\n",itemtype:"method",name:"exp",params:[{name:"n",description:"<p>
21exponent to raise</p>\n",type:"Number"}],return:{description:"e^n",type:"Number"},example:["\n<div><code>\nfunction draw() {\n  background(200);\n\n  // Compute the exp() function with a value between 0 and 2\n  let xValue = map(mouseX, 0, width, 0, 2);\n  let yValue = exp(xValue);\n\n  let y = map(yValue, 0, 8, height, 0);\n\n  let legend = 'exp (' + nfc(xValue, 3) + ')\\n= ' + nf(yValue, 1, 4);\n  stroke(150);\n  line(mouseX, y, mouseX, height);\n  fill(0);\n  text(legend, 5, 15);\n  noStroke();\n  ellipse(mouseX, y, 7, 7);\n\n  // Draw the exp(x) curve,\n  // over the domain of x from 0 to 2\n  noFill();\n  stroke(0);\n  beginShape();\n  for (let x = 0; x < width; x++) {\n    xValue = map(x, 0, width, 0, 2);\n    yValue = exp(xValue);\n    y = map(yValue, 0, 8, height, 0);\n    vertex(x, y);\n  }\n\n  endShape();\n  line(0, 0, 0, height);\n  line(0, height - 1, width, height - 1);\n}\n</code></div>"],alt:"ellipse moves along a curve with mouse x. e^n displayed.",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:240,description:"<p>Calculates the closest int value that is less than or equal to the\nvalue of the parameter. Maps to Math.floor().</p>\n",itemtype:"method",name:"floor",params:[{name:"n",description:"<p>number to round down</p>\n",type:"Number"}],return:{description:"rounded down number",type:"Integer"},example:["\n<div><code>\nfunction draw() {\n  background(200);\n  //map, mouseX between 0 and 5.\n  let ax = map(mouseX, 0, 100, 0, 5);\n  let ay = 66;\n\n  //Get the floor of the mapped number.\n  let bx = floor(map(mouseX, 0, 100, 0, 5));\n  let by = 33;\n\n  // Multiply the mapped numbers by 20 to more easily\n  // see the changes.\n  stroke(0);\n  fill(0);\n  line(0, ay, ax * 20, ay);\n  line(0, by, bx * 20, by);\n\n  // Reformat the float returned by map and draw it.\n  noStroke();\n  text(nfc(ax, 2), ax, ay - 5);\n  text(nfc(bx, 1), bx, by - 5);\n}\n</code></div>"],alt:"2 horizontal lines & number sets. increase with mouse x. bottom to 2 decimals",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:279,description:"<p>Calculates a number between two numbers at a specific increment. The amt\nparameter is the amount to interpolate between the two values where 0.0\nequal to the first point, 0.1 is very near the first point, 0.5 is\nhalf-way in between, and 1.0 is equal to the second point. If the\nvalue of amt is more than 1.0 or less than 0.0, the number will be\ncalculated accordingly in the ratio of the two given numbers. The lerp\nfunction is convenient for creating motion along a straight\npath and for drawing dotted lines.</p>\n",itemtype:"method",name:"lerp",params:[{name:"start",description:"<p>first value</p>\n",type:"Number"},{name:"stop",description:"<p>second value</p>\n",type:"Number"},{name:"amt",description:"<p>number</p>\n",type:"Number"}],return:{description:"lerped value",type:"Number"},example:["\n<div><code>\nfunction setup() {\n  background(200);\n  let a = 20;\n  let b = 80;\n  let c = lerp(a, b, 0.2);\n  let d = lerp(a, b, 0.5);\n  let e = lerp(a, b, 0.8);\n\n  let y = 50;\n\n  strokeWeight(5);\n  stroke(0); // Draw the original points in black\n  point(a, y);\n  point(b, y);\n\n  stroke(100); // Draw the lerp points in gray\n  point(c, y);\n  point(d, y);\n  point(e, y);\n}\n</code></div>"],alt:"5 points horizontally staggered mid-canvas. mid 3 are grey, outer black",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:327,description:"<p>Calculates the natural logarithm (the base-e logarithm) of a number. This\nfunction expects the n parameter to be a value greater than 0.0. Maps to\nMath.log().</p>\n",itemtype:"method",name:"log",params:[{name:"n",description:"<p>number greater than 0</p>\n",type:"Number"}],return:{description:"natural logarithm of n",type:"Number"},example:["\n<div><code>\nfunction draw() {\n  background(200);\n  let maxX = 2.8;\n  let maxY = 1.5;\n\n  // Compute the natural log of a value between 0 and maxX\n  let xValue = map(mouseX, 0, width, 0, maxX);\n  let yValue, y;\n  if (xValue > 0) {\n   // Cannot take the log of a negative number.\n    yValue = log(xValue);\n    y = map(yValue, -maxY, maxY, height, 0);\n\n    // Display the calculation occurring.\n    let legend = 'log(' + nf(xValue, 1, 2) + ')\\n= ' + nf(yValue, 1, 3);\n    stroke(150);\n    line(mouseX, y, mouseX, height);\n    fill(0);\n    text(legend, 5, 15);\n    noStroke();\n    ellipse(mouseX, y, 7, 7);\n  }\n\n  // Draw the log(x) curve,\n  // over the domain of x from 0 to maxX\n  noFill();\n  stroke(0);\n  beginShape();\n  for (let x = 0; x < width; x++) {\n    xValue = map(x, 0, width, 0, maxX);\n    yValue = log(xValue);\n    y = map(yValue, -maxY, maxY, height, 0);\n    vertex(x, y);\n  }\n  endShape();\n  line(0, 0, 0, height);\n  line(0, height / 2, width, height / 2);\n}\n</code></div>"],alt:"ellipse moves along a curve with mouse x. natural logarithm of n displayed.",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:383,description:'<p>Calculates the magnitude (or length) of a vector. A vector is a direction\nin space commonly used in computer graphics and linear algebra. Because it\nhas no &quot;start&quot; position, the magnitude of a vector can be thought of as\nthe distance from the coordinate 0,0 to its x,y value. Therefore, <a href="#/p5/mag">mag()</a> is\na shortcut for writing dist(0, 0, x, y).</p>\n',itemtype:"method",name:"mag",params:[{name:"a",description:"<p>first value</p>\n",type:"Number"},{name:"b",description:"<p>second value</p>\n",type:"Number"}],return:{description:"magnitude of vector from (0,0) to (a,b)",type:"Number"},example:['\n<div><code>\nfunction setup() {\n  let x1 = 20;\n  let x2 = 80;\n  let y1 = 30;\n  let y2 = 70;\n\n  line(0, 0, x1, y1);\n  print(mag(x1, y1)); // Prints "36.05551275463989"\n  line(0, 0, x2, y1);\n  print(mag(x2, y1)); // Prints "85.44003745317531"\n  line(0, 0, x1, y2);\n  print(mag(x1, y2)); // Prints "72.80109889280519"\n  line(0, 0, x2, y2);\n  print(mag(x2, y2)); // Prints "106.3014581273465"\n}\n</code></div>'],alt:"4 lines of different length radiate from top left of canvas.",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:422,description:"<p>Re-maps a number from one range to another.\n<br><br>\nIn the first example above, the number 25 is converted from a value in the\nrange of 0 to 100 into a value that ranges from the left edge of the\nwindow (0) to the right edge (width).</p>\n",itemtype:"method",name:"map",params:[{name:"value",description:"<p>the incoming value to be converted</p>\n",type:"Number"},{name:"start1",description:"<p>lower bound of the value&#39;s current range</p>\n",type:"Number"},{name:"stop1",description:"<p>upper bound of the value&#39;s current range</p>\n",type:"Number"},{name:"start2",description:"<p>lower bound of the value&#39;s target range</p>\n",type:"Number"},{name:"stop2",description:"<p>upper bound of the value&#39;s target range</p>\n",type:"Number"},{name:"withinBounds",description:"<p>constrain the value to the newly mapped range</p>\n",type:"Boolean",optional:!0}],return:{description:"remapped number",type:"Number"},example:["\n  <div><code>\nlet value = 25;\nlet m = map(value, 0, 100, 0, width);\nellipse(m, 50, 10, 10);\n</code></div>\n\n  <div><code>\nfunction setup() {\n  noStroke();\n}\n\nfunction draw() {\n  background(204);\n  let x1 = map(mouseX, 0, width, 25, 75);\n  ellipse(x1, 25, 25, 25);\n  //This ellipse is constrained to the 0-100 range\n  //after setting withinBounds to true\n  let x2 = map(mouseX, 0, width, 0, 100, true);\n  ellipse(x2, 75, 25, 25);\n}\n</code></div>"],alt:"10 by 10 white ellipse with in mid left canvas\n2 25 by 25 white ellipses move with mouse x. Bottom has more range from X",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:478,description:'<p>Determines the largest value in a sequence of numbers, and then returns\nthat value. <a href="#/p5/max">max()</a> accepts any number of Number parameters, or an Array\nof any length.</p>\n',itemtype:"method",name:"max",return:{description:"maximum Number",type:"Number"},example:["\n<div><code>\nfunction setup() {\n  // Change the elements in the array and run the sketch\n  // to show how max() works!\n  let numArray = [2, 1, 5, 4, 8, 9];\n  fill(0);\n  noStroke();\n  text('Array Elements', 0, 10);\n  // Draw all numbers in the array\n  let spacing = 15;\n  let elemsY = 25;\n  for (let i = 0; i < numArray.length;
21 i++) {\n    text(numArray[i], i * spacing, elemsY);\n  }\n  let maxX = 33;\n  let maxY = 80;\n  // Draw the Maximum value in the array.\n  textSize(32);\n  text(max(numArray), maxX, maxY);\n}\n</code></div>"],alt:"Small text at top reads: Array Elements 2 1 5 4 8 9. Large text at center: 9",class:"p5",module:"Math",submodule:"Calculation",overloads:[{line:478,params:[{name:"n0",description:"<p>Number to compare</p>\n",type:"Number"},{name:"n1",description:"<p>Number to compare</p>\n",type:"Number"}],return:{description:"maximum Number",type:"Number"}},{line:514,params:[{name:"nums",description:"<p>Numbers to compare</p>\n",type:"Number[]"}],return:{description:"",type:"Number"}}]},{file:"src/math/calculation.js",line:528,description:'<p>Determines the smallest value in a sequence of numbers, and then returns\nthat value. <a href="#/p5/min">min()</a> accepts any number of Number parameters, or an Array\nof any length.</p>\n',itemtype:"method",name:"min",return:{description:"minimum Number",type:"Number"},example:["\n<div><code>\nfunction setup() {\n  // Change the elements in the array and run the sketch\n  // to show how min() works!\n  let numArray = [2, 1, 5, 4, 8, 9];\n  fill(0);\n  noStroke();\n  text('Array Elements', 0, 10);\n  // Draw all numbers in the array\n  let spacing = 15;\n  let elemsY = 25;\n  for (let i = 0; i < numArray.length; i++) {\n    text(numArray[i], i * spacing, elemsY);\n  }\n  let maxX = 33;\n  let maxY = 80;\n  // Draw the Minimum value in the array.\n  textSize(32);\n  text(min(numArray), maxX, maxY);\n}\n</code></div>"],alt:"Small text at top reads: Array Elements 2 1 5 4 8 9. Large text at center: 1",class:"p5",module:"Math",submodule:"Calculation",overloads:[{line:528,params:[{name:"n0",description:"<p>Number to compare</p>\n",type:"Number"},{name:"n1",description:"<p>Number to compare</p>\n",type:"Number"}],return:{description:"minimum Number",type:"Number"}},{line:564,params:[{name:"nums",description:"<p>Numbers to compare</p>\n",type:"Number[]"}],return:{description:"",type:"Number"}}]},{file:"src/math/calculation.js",line:578,description:"<p>Normalizes a number from another range into a value between 0 and 1.\nIdentical to map(value, low, high, 0, 1).\nNumbers outside of the range are not clamped to 0 and 1, because\nout-of-range values are often intentional and useful. (See the example above.)</p>\n",itemtype:"method",name:"norm",params:[{name:"value",description:"<p>incoming value to be normalized</p>\n",type:"Number"},{name:"start",description:"<p>lower bound of the value&#39;s current range</p>\n",type:"Number"},{name:"stop",description:"<p>upper bound of the value&#39;s current range</p>\n",type:"Number"}],return:{description:"normalized number",type:"Number"},example:["\n<div><code>\nfunction draw() {\n  background(200);\n  let currentNum = mouseX;\n  let lowerBound = 0;\n  let upperBound = width; //100;\n  let normalized = norm(currentNum, lowerBound, upperBound);\n  let lineY = 70;\n  stroke(3);\n  line(0, lineY, width, lineY);\n  //Draw an ellipse mapped to the non-normalized value.\n  noStroke();\n  fill(50);\n  let s = 7; // ellipse size\n  ellipse(currentNum, lineY, s, s);\n\n  // Draw the guide\n  let guideY = lineY + 15;\n  text('0', 0, guideY);\n  textAlign(RIGHT);\n  text('100', width, guideY);
21\n\n  // Draw the normalized value\n  textAlign(LEFT);\n  fill(0);\n  textSize(32);\n  let normalY = 40;\n  let normalX = 20;\n  text(normalized, normalX, normalY);\n}\n</code></div>"],alt:"ellipse moves with mouse. 0 shown left & 100 right and updating values center",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:631,description:'<p>Facilitates exponential expressions. The <a href="#/p5/pow">pow()</a> function is an efficient\nway of multiplying numbers by themselves (or their reciprocals) in large\nquantities. For example, pow(3, 5) is equivalent to the expression\n3<em>3</em>3<em>3</em>3 and pow(3, -5) is equivalent to 1 / 3<em>3</em>3<em>3</em>3. Maps to\nMath.pow().</p>\n',itemtype:"method",name:"pow",params:[{name:"n",description:"<p>base of the exponential expression</p>\n",type:"Number"},{name:"e",description:"<p>power by which to raise the base</p>\n",type:"Number"}],return:{description:"n^e",type:"Number"},example:["\n<div><code>\nfunction setup() {\n  //Exponentially increase the size of an ellipse.\n  let eSize = 3; // Original Size\n  let eLoc = 10; // Original Location\n\n  ellipse(eLoc, eLoc, eSize, eSize);\n\n  ellipse(eLoc * 2, eLoc * 2, pow(eSize, 2), pow(eSize, 2));\n\n  ellipse(eLoc * 4, eLoc * 4, pow(eSize, 3), pow(eSize, 3));\n\n  ellipse(eLoc * 8, eLoc * 8, pow(eSize, 4), pow(eSize, 4));\n}\n</code></div>"],alt:"small to large ellipses radiating from top left of canvas",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:665,description:"<p>Calculates the integer closest to the n parameter. For example,\nround(133.8) returns the value 134. Maps to Math.round().</p>\n",itemtype:"method",name:"round",params:[{name:"n",description:"<p>number to round</p>\n",type:"Number"}],return:{description:"rounded number",type:"Integer"},example:["\n<div><code>\nfunction draw() {\n  background(200);\n  //map, mouseX between 0 and 5.\n  let ax = map(mouseX, 0, 100, 0, 5);\n  let ay = 66;\n\n  // Round the mapped number.\n  let bx = round(map(mouseX, 0, 100, 0, 5));\n  let by = 33;\n\n  // Multiply the mapped numbers by 20 to more easily\n  // see the changes.\n  stroke(0);\n  fill(0);\n  line(0, ay, ax * 20, ay);\n  line(0, by, bx * 20, by);\n\n  // Reformat the float returned by map and draw it.\n  noStroke();\n  text(nfc(ax, 2), ax, ay - 5);\n  text(nfc(bx, 1), bx, by - 5);\n}\n</code></div>"],alt:"horizontal center line squared values displayed on top and regular on bottom.",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:704,description:"<p>Squares a number (multiplies a number by itself). The result is always a\npositive number, as multiplying two negative numbers always yields a\npositive result. For example, -1 * -1 = 1.</p>\n",itemtype:"method",name:"sq",params:[{name:"n",description:"<p>number to square</p>\n",type:"Number"}],return:{description:"squared number",type:"Number"},example:["\n<div><code>\nfunction draw() {\n  background(200);\n  let eSize = 7;\n  let x1 = map(mouseX, 0, width, 0, 10);\n  let y1 = 80;\n  let x2 = sq(x1);\n  let y2 = 20;\n\n  // Draw the non-squared.\n  line(0, y1, width, y1);\n  ellipse(x1, y1, eSize, eSize);\n\n  // Draw the squared.\n  line(0, y2, width, y2);\n  ellipse(x2, y2, eSize, eSize);\n\n  // Draw dividing line.\n  stroke(100);\n  line(0, height / 2, width, height / 2);\n\n  // Draw text.\n  let spacing = 15;\n  noStroke();\n  fill(0);\n  text('x = ' + x1, 0, y1 + spacing);\n  text('sq(x) = ' + x2, 0, y2 + spacing);\n}\n</code></div>"],alt:"horizontal center line squared values displayed on top and regular on bottom.",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/calculation.js",line:751,description:"<p>Calculates the square root of a number. The square root of a number is\nalways positive, even though there may be a valid negative root. The\nsquare root s of number a is such that s*s = a. It is the opposite of\nsquaring. Maps to Math.sqrt().</p>\n",itemtype:"method",name:"sqrt",params:[{name:"n",description:"<p>non-negative number to square root</p>\n",type:"Number"}],return:{description:"square root of number",type:"Number"},example:["\n<div><code>\nfunction draw() {\n  background(200);\n  let eSize = 7;\n  let x1 = mouseX;\n  let y1 = 80;\n  let x2 = sqrt(x1);\n  let y2 = 20;\n\n  // Draw the non-squared.\n  line(0, y1, width, y1);\n  ellipse(x1, y1, eSize, eSize);\n\n  // Draw the squared.\n  line(0, y2, width, y2);\n  ellipse(x2, y2, eSize, eSize);\n\n  // Draw dividing line.\n  stroke(100);\n  line(0, height / 2, width, height / 2);\n\n  // Draw text.\n  noStroke();\n  fill(0);\n  let spacing = 15;\n  text('x = ' + x1, 0, y1 + spacing);\n  text('sqrt(x) = ' + x2, 0, y2 + spacing);\n}\n</code></div>"],alt:"horizontal center line squareroot values displayed on top and regular on bottom.",class:"p5",module:"Math",submodule:"Calculation"},{file:"src/math/math.js",line:12,description:'<p>Creates a new <a href="#/p5.Vector">p5.Vector</a> (the datatype for storing vectors). This provides a\ntwo or three dimensional vector, specifically a Euclidean (also known as\ngeometric) vector. A vector is an entity that has both magnitude and\ndirection.</p>\n',itemtype:"method",name:"createVector",params:[{name:"x",description:"<p>x component of the vector</p>\n",type:"Number",optional:!0},{name:"y",description:"<p>y component of the vector</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>z component of the vector</p>\n",type:"Number",optional:!0}],return:{description:"",type:"p5.Vector"},example:["\n<div modernizr='webgl'><code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  noStroke();\n  fill(255, 102, 204);\n}\n\nfunction draw() {\n  background(255);\n  pointLight(color(255), createVector(sin(millis() / 1000) * 20, -40, -10));\n  scale(0.75);\n  sphere();\n}\n</code></div>"],alt:"a purple sphere lit by a point light oscillating horizontally",class:"p5",module:"Math",submodule:"Math"},{file:"src/math/noise.js",line:40,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>
21 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 <a href="#/p5/noiseSeed">noiseSeed()</a> function). p5.js can compute 1D, 2D and 3D noise,\ndepending on the number of coordinates given. The resulting value will\nalways be between 0.0 and 1.0. The noise value can be animated by moving\nthrough the noise space as demonstrated in the example above. The 2nd\nand 3rd dimension can also be interpreted as time.<br /><br />The actual\nnoise is structured similar to an audio signal, in respect to the\nfunction&#39;s use of frequencies. Similar to the concept of harmonics in\nphysics, perlin noise is computed over several octaves which are added\ntogether for the final result. <br /><br />Another way to adjust the\ncharacter of the resulting sequence is the scale of the input\ncoordinates. As the function works within an infinite space the value of\nthe coordinates doesn&#39;t matter as such, only the distance between\nsuccessive coordinates does (eg. when using <b>noise()</b> within a\nloop). As a general rule the smaller the difference between coordinates,\nthe smoother the resulting noise sequence will be. Steps of 0.005-0.03\nwork best for most applications, but this will differ depending on use.</p>\n',itemtype:"method",name:"noise",params:[{name:"x",description:"<p>x-coordinate in noise space</p>\n",type:"Number"},{name:"y",description:"<p>y-coordinate in noise space</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>z-coordinate in noise space</p>\n",type:"Number",optional:!0}],return:{description:"Perlin noise value (between 0 and 1) at specified\n                     coordinates",type:"Number"},example:["\n<div>\n<code>\nlet xoff = 0.0;\n\nfunction draw() {\n  background(204);\n  xoff = xoff + 0.01;\n  let n = noise(xoff) * width;\n  line(n, 0, n, height);\n}\n</code>\n</div>\n<div>\n<code>let noiseScale=0.02;\n\nfunction draw() {\n  background(0);\n  for (let x=0; x < width; x++) {\n    let 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:187,description:"<p>Adjusts the character and level of detail produced by the Perlin noise\n function. Similar to harmonics in physics, noise is computed over\n several octaves. Lower octaves contribute more to the output signal and\n as such define the overall intensity of the noise, whereas higher octaves\n create finer grained details in the noise sequence.\n <br><br>\n By default, noise is computed over 4 octaves with each octave contributing\n exactly half than its predecessor, starting at 50% strength for the 1st\n octave. This falloff amount can be changed by adding an additional function\n parameter. Eg. a falloff factor of 0.75 means each octave will now have\n 75% impact (25% less) of the previous lower octave. Any value between\n 0.0 and 1.0 is valid, however note that values greater than 0.5 might\n result in greater than 1.0 values returned by <b>noise()</b>.\n <br><br>\n By changing these parameters, the signal created by the <b>noise()</b>\n function can be adapted to fit very specific needs and characteristics.</p>\n",itemtype:"method",name:"noiseDetail",params:[{name:"lod",description:"<p>number of octaves to be used by the noise</p>\n",type:"Number"},{name:"falloff",description:"<p>falloff factor for each octave</p>\n",type:"Number"}],example:["\n <div>\n <code>\n let noiseVal;\n let noiseScale = 0.02;\nfunction setup() {\n   createCanvas(100, 100);\n }\nfunction draw() {\n   background(0);\n   for (let y = 0; y < height;
21 y++) {\n     for (let x = 0; x < width / 2; x++) {\n       noiseDetail(2, 0.2);\n       noiseVal = noise((mouseX + x) * noiseScale, (mouseY + y) * noiseScale);\n       stroke(noiseVal * 255);\n       point(x, y);\n       noiseDetail(8, 0.65);\n       noiseVal = noise(\n         (mouseX + x + width / 2) * noiseScale,\n         (mouseY + y) * noiseScale\n       );\n       stroke(noiseVal * 255);\n       point(x + width / 2, y);\n     }\n   }\n }\n </code>\n </div>"],alt:"2 vertical grey smokey patterns affected my mouse x-position and noise.",class:"p5",module:"Math",submodule:"Noise"},{file:"src/math/noise.js",line:253,description:"<p>Sets the seed value for <b>noise()</b>. By default, <b>noise()</b>\nproduces different results each time the program is run. Set the\n<b>value</b> parameter to a constant to return the same pseudo-random\nnumbers each time the software is run.</p>\n",itemtype:"method",name:"noiseSeed",params:[{name:"seed",description:"<p>the seed value</p>\n",type:"Number"}],example:["\n<div>\n<code>let xoff = 0.0;\n\nfunction setup() {\n  noiseSeed(99);\n  stroke(0, 10);\n}\n\nfunction draw() {\n  xoff = xoff + .01;\n  let n = noise(xoff) * width;\n  line(n, 0, n, height);\n}\n</code>\n</div>"],alt:"vertical grey lines drawing in pattern affected by noise.",class:"p5",module:"Math",submodule:"Noise"},{file:"src/math/p5.Vector.js",line:67,description:"<p>The x component of the vector</p>\n",itemtype:"property",name:"x",type:"Number",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:72,description:"<p>The y component of the vector</p>\n",itemtype:"property",name:"y",type:"Number",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:77,description:"<p>The z component of the vector</p>\n",itemtype:"property",name:"z",type:"Number",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:84,description:"<p>Returns a string representation of a vector v by calling String(v)\nor v.toString(). This method is useful for logging vectors in the\nconsole.</p>\n",itemtype:"method",name:"toString",return:{description:"",type:"String"},example:['\n<div class = "norender">\n<code>\nfunction setup() {\n  let v = createVector(20, 30);\n  print(String(v)); // prints "p5.Vector Object : [20, 30, 0]"\n}\n</code>\n</div>\n\n<div>\n<code>\nfunction draw() {\n  background(240);\n\n  let v0 = createVector(0, 0);\n  let v1 = createVector(mouseX, mouseY);\n  drawArrow(v0, v1, \'black\');\n\n  noStroke();\n  text(v1.toString(), 10, 25, 90, 75);\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>'],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:134,description:'<p>Sets the x, y, and z component of the vector using two or three separate\nvariables, the data from a <a href="#/p5.Vector">p5.Vector</a>, or the values from a float array.</p>\n',itemtype:"method",name:"set",chainable:1,example:["\n<div class=\"norender\">\n<code>\nfunction setup() {\n  let v = createVector(1, 2, 3);\n  v.set(4, 5, 6); // Sets vector to [4, 5, 6]\n\n  let v1 = createVector(0, 0, 0);\n  let arr = [1, 2, 3];\n  v1.set(arr); // Sets vector to [1, 2, 3]\n}\n</code>\n</div>\n\n<div>\n<code>\nlet v0, v1;\nfunction setup() {\n  createCanvas(100, 100);\n\n  v0 = createVector(0, 0);\n  v1 = createVector(50, 50);\n}\n\nfunction draw() {\n  background(240);\n\n  drawArrow(v0, v1, 'black');\n  v1.set(v1.x + random(-1, 1), v1.y + random(-1, 1));\n\n  noStroke();\n  text('x: ' + round(v1.x) + ' y: ' + round(v1.y), 20, 90);\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:134,params:[{name:"x",description:"<p>the x component of the vector</p>\n",type:"Number",optional:!0},{name:"y",description:"<p>the y component of the vector</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>the z component of the vector</p>\n",type:"Number",optional:!0}],chainable:1},{line:193,params:[{name:"value",description:"<p>the vector to set</p>\n",type:"p5.Vector|Number[]"}],chainable:1}]},{file:"src/math/p5.Vector.js",line:217,description:'<p>Gets a copy of the vector, returns a <a href="#/p5.Vector">p5.Vector</a> object.</p>\n',itemtype:"method",name:"copy",return:{description:'the copy of the <a href="#/p5.Vector">p5.Vector</a> object',type:"p5.Vector"},example:['\n<div class="norender">\n<code>\nlet v1 = createVector(1, 2, 3);\nlet v2 = v1.copy();\nprint(v1.x === v2.x && v1.y === v2.y && v1.z === v2.z);\n// Prints "true"\n</code>\n</div>'],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:240,description:'<p>Adds x, y, and z components to a vector, adds one vector to another, or\nadds two independent vectors together. The version of the method that adds\ntwo vectors together is a static method and returns a <a href="#/p5.Vector">p5.Vector</a>, the others\nacts directly on the vector. See the examples for more context.</p>\n',itemtype:"method",name:"add",chainable:1,example:["\n<div class=\"norender\">\n<code>\nlet v = createVector(1, 2, 3);\nv.add(4, 5, 6);\n// v's components are set to [5, 7, 9]\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\n// Static method\nlet v1 = createVector(1, 2, 3);\nlet v2 = createVector(2, 3, 4);\n\nlet v3 = p5.Vector.add(v1, v2);\n// v3 has components [3, 5, 7]\nprint(v3);\n</code>\n</div>\n\n<div>\n<code>\n// red vector + blue vector = purple vector\nfunction draw() {\n  background(240);\n\n  let v0 = createVector(0, 0);\n  let v1 = createVector(mouseX, mouseY);\n  drawArrow(v0, v1, 'red');\n\n  let v2 = createVector(-30, 20);\n  drawArrow(v1, v2, 'blue');\n\n  let v3 = p5.Vector.add(v1, v2);\n  drawArrow(v0, v3, 'purple');\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:240,params:[{name:"x",description:"<p>the x component of the vector to be added</p>\n",type:"Number"},{name:"y",description:"<p>the y component of the vector to be added</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>the z component of the vector to be added</p>\n",type:"Number",optional:!0}],chainable:1},{line:306,params:[{name:"value",description:"<p>the vector to add</p>\n",type:"p5.Vector|Number[]"}],chainable:1},{line:1555,params:[{name:"v1",description:'<p>a <a href="#/p5.Vector">p5.Vector</a> to add</p>\n',type:"p5.Vector"},{name:"v2",description:'<p>a <a href="#/p5.Vector">p5.Vector</a> to add</p>\n',type:"p5.Vector"},{name:"target",description:"<p>the vector to receive the result</p>\n",type:"p5.Vector"}],static:1},{line:1562,params:[{name:"v1",description:"",type:"p5.Vector"},{name:"v2",description:"",type:"p5.Vector"}],static:1,return:{description:'the resulting <a href="#/p5.Vector">p5.Vector</a>',type:"p5.Vector"}}]},{file:"src/math/p5.Vector.js",line:330,description:'<p>Subtracts x, y, and z components from a vector, subtracts one vector from\nanother, or subtracts two independent vectors. The version of the method\nthat subtracts two vectors is a static method and returns a <a href="#/p5.Vector">p5.Vector</a>, the\nother acts directly on the vector. See the examples for more context.</p>\n',itemtype:"method",name:"sub",chainable:1,example:["\n<div class=\"norender\">\n<code>
21\nlet v = createVector(4, 5, 6);\nv.sub(1, 1, 1);\n// v's components are set to [3, 4, 5]\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\n// Static method\nlet v1 = createVector(2, 3, 4);\nlet v2 = createVector(1, 2, 3);\n\nlet v3 = p5.Vector.sub(v1, v2);\n// v3 has components [1, 1, 1]\nprint(v3);\n</code>\n</div>\n\n<div>\n<code>\n// red vector - blue vector = purple vector\nfunction draw() {\n  background(240);\n\n  let v0 = createVector(0, 0);\n  let v1 = createVector(70, 50);\n  drawArrow(v0, v1, 'red');\n\n  let v2 = createVector(mouseX, mouseY);\n  drawArrow(v0, v2, 'blue');\n\n  let v3 = p5.Vector.sub(v1, v2);\n  drawArrow(v2, v3, 'purple');\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:330,params:[{name:"x",description:"<p>the x component of the vector to subtract</p>\n",type:"Number"},{name:"y",description:"<p>the y component of the vector to subtract</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>the z component of the vector to subtract</p>\n",type:"Number",optional:!0}],chainable:1},{line:396,params:[{name:"value",description:"<p>the vector to subtract</p>\n",type:"p5.Vector|Number[]"}],chainable:1},{line:1585,params:[{name:"v1",description:'<p>a <a href="#/p5.Vector">p5.Vector</a> to subtract from</p>\n',type:"p5.Vector"},{name:"v2",description:'<p>a <a href="#/p5.Vector">p5.Vector</a> to subtract</p>\n',type:"p5.Vector"},{name:"target",description:"<p>if undefined a new vector will be created</p>\n",type:"p5.Vector"}],static:1},{line:1592,params:[{name:"v1",description:"",type:"p5.Vector"},{name:"v2",description:"",type:"p5.Vector"}],static:1,return:{description:'the resulting <a href="#/p5.Vector">p5.Vector</a>',type:"p5.Vector"}}]},{file:"src/math/p5.Vector.js",line:420,description:'<p>Multiply the vector by a scalar. The static version of this method\ncreates a new <a href="#/p5.Vector">p5.Vector</a> while the non static version acts on the vector\ndirectly. See the examples for more context.</p>\n',itemtype:"method",name:"mult",chainable:1,example:["\n<div class=\"norender\">\n<code>\nlet v = createVector(1, 2, 3);\nv.mult(2);\n// v's components are set to [2, 4, 6]\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\n// Static method\nlet v1 = createVector(1, 2, 3);\nlet v2 = p5.Vector.mult(v1, 2);\n// v2 has components [2, 4, 6]\nprint(v2);\n</code>\n</div>\n\n<div>\n<code>\nfunction draw() {\n  background(240);\n\n  let v0 = createVector(50, 50);\n  let v1 = createVector(25, -25);\n  drawArrow(v0, v1, 'red');\n\n  let num = map(mouseX, 0, width, -2, 2, true);\n  let v2 = p5.Vector.mult(v1, num);\n  drawArrow(v0, v2, 'blue');\n\n  noStroke();\n  text('multiplied by ' + num.toFixed(2), 5, 90);\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:420,params:[{name:"n",description:"<p>the number to multiply with the vector</p>\n",type:"Number"}],chainable:1},{line:1613,params:[{name:"v",description:"<p>the vector to multiply</p>\n",type:"p5.Vector"},{name:"n",description:"",type:"Number"},{name:"target",description:"<p>if undefined a new vector will be created</p>\n",type:"p5.Vector"}],static:1},{line:1620,params:[{name:"v",description:"",type:"p5.Vector"},{name:"n",description:"",type:"Number"}],static:1,return:{description:'the resulting new <a href="#/p5.Vector">p5.Vector</a>',type:"p5.Vector"}}]},{file:"src/math/p5.Vector.js",line:495,description:'<p>Divide the vector by a scalar. The static version of this method creates a\nnew <a href="#/p5.Vector">p5.Vector</a> while the non static version acts on the vector directly.\nSee the examples for more context.</p>\n',itemtype:"method",name:"div",chainable:1,example:["\n<div class=\"norender\">\n<code>\nlet v = createVector(6, 4, 2);\nv.div(2); //v's components are set to [3, 2, 1]\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\n// Static method\nlet v1 = createVector(6, 4, 2);\nlet v2 = p5.Vector.div(v1, 2);\n// v2 has components [3, 2, 1]\nprint(v2);\n</code>\n</div>\n\n<div>\n<code>\nfunction draw() {\n  background(240);\n\n  let v0 = createVector(0, 100);\n  let v1 = createVector(50, -50);\n  drawArrow(v0, v1, 'red');\n\n  let num = map(mouseX, 0, width, 10, 0.5, true);\n  let v2 = p5.Vector.div(v1, num);\n  drawArrow(v0, v2, 'blue');\n\n  noStroke();\n  text('divided by ' + num.toFixed(2), 10, 90);\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:495,params:[{name:"n",description:"<p>the number to divide the vector by</p>\n",type:"Number"}],chainable:1},{line:1640,params:[{name:"v",description:"<p>the vector to divide</p>\n",type:"p5.Vector"},{name:"n",description:"",type:"Number"},{name:"target",description:"<p>if undefined a new vector will be created</p>\n",type:"p5.Vector"}],static:1},{line:1647,params:[{name:"v",description:"",type:"p5.Vector"},{name:"n",description:"",type:"Number"}],static:1,return:{description:'the resulting new <a href="#/p5.Vector">p5.Vector</a>',type:"p5.Vector"}}]},{file:"src/math/p5.Vector.js",line:573,description:"<p>Calculates the magnitude (length) of the vector and returns the result as\na float (this is simply the equation sqrt(x<em>x + y</em>y + z*z).)</p>\n",itemtype:"method",name:"mag",return:{description:"magnitude of the vector",type:"Number"},example:["\n<div>\n<code>\nfunction draw() {\n  background(240);\n\n  let v0 = createVector(0, 0);\n  let v1 = createVector(mouseX, mouseY);\n  drawArrow(v0, v1, 'black');\n\n  noStroke();
21\n  text('vector length: ' + v1.mag().toFixed(2), 10, 70, 90, 30);\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>\n<div class=\"norender\">\n<code>\nlet v = createVector(20.0, 30.0, 40.0);\nlet m = v.mag();\nprint(m); // Prints \"53.85164807134504\"\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:573,params:[],return:{description:"magnitude of the vector",type:"Number"}},{line:1737,params:[{name:"vecT",description:"<p>the vector to return the magnitude of</p>\n",type:"p5.Vector"}],static:1,return:{description:"the magnitude of vecT",type:"Number"}}]},{file:"src/math/p5.Vector.js",line:621,description:"<p>Calculates the squared magnitude of the vector and returns the result\nas a float (this is simply the equation <em>(x<em>x + y</em>y + z*z)</em>.)\nFaster if the real length is not required in the\ncase of comparing vectors, etc.</p>\n",itemtype:"method",name:"magSq",return:{description:"squared magnitude of the vector",type:"Number"},example:["\n<div class=\"norender\">\n<code>\n// Static method\nlet v1 = createVector(6, 4, 2);\nprint(v1.magSq()); // Prints \"56\"\n</code>\n</div>\n\n<div>\n<code>\nfunction draw() {\n  background(240);\n\n  let v0 = createVector(0, 0);\n  let v1 = createVector(mouseX, mouseY);\n  drawArrow(v0, v1, 'black');\n\n  noStroke();\n  text('vector length squared: ' + v1.magSq().toFixed(2), 10, 45, 90, 55);\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:675,description:"<p>Calculates the dot product of two vectors. The version of the method\nthat computes the dot product of two independent vectors is a static\nmethod. See the examples for more context.</p>\n",itemtype:"method",name:"dot",return:{description:"the dot product",type:"Number"},example:['\n<div class="norender">\n<code>\nlet v1 = createVector(1, 2, 3);\nlet v2 = createVector(2, 3, 4);\n\nprint(v1.dot(v2)); // Prints "20"\n</code>\n</div>\n\n<div class="norender">\n<code>\n//Static method\nlet v1 = createVector(1, 2, 3);\nlet v2 = createVector(3, 2, 1);\nprint(p5.Vector.dot(v1, v2)); // Prints "10"\n</code>\n</div>'],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:675,params:[{name:"x",description:"<p>x component of the vector</p>\n",type:"Number"},{name:"y",description:"<p>y component of the vector</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>z component of the vector</p>\n",type:"Number",optional:!0}],return:{description:"the dot product",type:"Number"}},{line:706,params:[{name:"value",description:'<p>value component of the vector or a <a href="#/p5.Vector">p5.Vector</a></p>\n',type:"p5.Vector"}],return:{description:"",type:"Number"}},{line:1667,params:[{name:"v1",description:'<p>the first <a href="#/p5.Vector">p5.Vector</a></p>\n',type:"p5.Vector"},{name:"v2",description:'<p>the second <a href="#/p5.Vector">p5.Vector</a></p>\n',type:"p5.Vector"}],static:1,return:{description:"the dot product",type:"Number"}}]},{file:"src/math/p5.Vector.js",line:718,description:'<p>Calculates and returns a vector composed of the cross product between\ntwo vectors. Both the static and non static methods return a new <a href="#/p5.Vector">p5.Vector</a>.\nSee the examples for more context.</p>\n',itemtype:"method",name:"cross",return:{description:'<a href="#/p5.Vector">p5.Vector</a> composed of cross product',type:"p5.Vector"},example:['\n<div class="norender">\n<code>\nlet v1 = createVector(1, 2, 3);\nlet v2 = createVector(1, 2, 3);\n\nv1.cross(v2); // v\'s components are [0, 0, 0]\n</code>\n</div>\n\n<div class="norender">\n<code>\n// Static method\nlet v1 = createVector(1, 0, 0);\nlet v2 = createVector(0, 1, 0);
21\n\nlet crossProduct = p5.Vector.cross(v1, v2);\n// crossProduct has components [0, 0, 1]\nprint(crossProduct);\n</code>\n</div>'],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:718,params:[{name:"v",description:'<p><a href="#/p5.Vector">p5.Vector</a> to be crossed</p>\n',type:"p5.Vector"}],return:{description:'<a href="#/p5.Vector">p5.Vector</a> composed of cross product',type:"p5.Vector"}},{line:1681,params:[{name:"v1",description:'<p>the first <a href="#/p5.Vector">p5.Vector</a></p>\n',type:"p5.Vector"},{name:"v2",description:'<p>the second <a href="#/p5.Vector">p5.Vector</a></p>\n',type:"p5.Vector"}],static:1,return:{description:"the cross product",type:"Number"}}]},{file:"src/math/p5.Vector.js",line:759,description:"<p>Calculates the Euclidean distance between two points (considering a\npoint as a vector object).</p>\n",itemtype:"method",name:"dist",return:{description:"the distance",type:"Number"},example:["\n<div class=\"norender\">\n<code>\nlet v1 = createVector(1, 0, 0);\nlet v2 = createVector(0, 1, 0);\n\nlet distance = v1.dist(v2); // distance is 1.4142...\nprint(distance);\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\n// Static method\nlet v1 = createVector(1, 0, 0);\nlet v2 = createVector(0, 1, 0);\n\nlet distance = p5.Vector.dist(v1, v2);\n// distance is 1.4142...\nprint(distance);\n</code>\n</div>\n\n<div>\n<code>\nfunction draw() {\n  background(240);\n\n  let v0 = createVector(0, 0);\n\n  let v1 = createVector(70, 50);\n  drawArrow(v0, v1, 'red');\n\n  let v2 = createVector(mouseX, mouseY);\n  drawArrow(v0, v2, 'blue');\n\n  noStroke();\n  text('distance between vectors: ' + v2.dist(v1).toFixed(2), 5, 50, 95, 50);\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:759,params:[{name:"v",description:'<p>the x, y, and z coordinates of a <a href="#/p5.Vector">p5.Vector</a></p>\n',type:"p5.Vector"}],return:{description:"the distance",type:"Number"}},{line:1696,params:[{name:"v1",description:'<p>the first <a href="#/p5.Vector">p5.Vector</a></p>\n',type:"p5.Vector"},{name:"v2",description:'<p>the second <a href="#/p5.Vector">p5.Vector</a></p>\n',type:"p5.Vector"}],static:1,return:{description:"the distance",type:"Number"}}]},{file:"src/math/p5.Vector.js",line:830,description:"<p>Normalize the vector to length 1 (make it a unit vector).</p>\n",itemtype:"method",name:"normalize",return:{description:'normalized <a href="#/p5.Vector">p5.Vector</a>',type:"p5.Vector"},example:["\n<div class=\"norender\">\n<code>\nlet v = createVector(10, 20, 2);\n// v has components [10.0, 20.0, 2.0]\nv.normalize();\n// v's components are set to\n// [0.4454354, 0.8908708, 0.089087084]\n</code>\n</div>\n<div>\n<code>\nfunction draw() {\n  background(240);\n\n  let v0 = createVector(50, 50);\n  let v1 = createVector(mouseX - 50, mouseY - 50);\n\n  drawArrow(v0, v1, 'red');\n  v1.normalize();\n  drawArrow(v0, v1.mult(35), 'blue');\n\n  noFill();\n  ellipse(50, 50, 35 * 2);\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:886,description:"<p>Limit the magnitude of this vector to the value used for the <b>max</b>\nparameter.</p>\n",itemtype:"method",name:"limit",params:[{name:"max",description:"<p>the maximum magnitude for the vector</p>\n",type:"Number"}],chainable:1,example:["\n<div class=\"norender\">\n<code>\nlet v = createVector(10, 20, 2);\n// v has components [10.0, 20.0, 2.0]\nv.limit(5);\n// v's components are set to\n// [2.2271771, 4.4543543, 0.4454354]\n</code>\n</div>\n<div>\n<code>\nfunction draw() {\n  background(240);\n\n  let v0 = createVector(50, 50);\n  let v1 = createVector(mouseX - 50, mouseY - 50);\n\n  drawArrow(v0, v1, 'red');\n  drawArrow(v0, v1.limit(35), 'blue');\n\n  noFill();\n  ellipse(50, 50, 35 * 2);\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:944,description:"<p>Set the magnitude of this vector to the value used for the <b>len</b>\nparameter.</p>\n",itemtype:"method",name:"setMag",params:[{name:"len",description:"<p>the new length for this vector</p>\n",type:"Number"}],chainable:1,example:["\n<div class=\"norender\">\n<code>\nlet v = createVector(10, 20, 2);\n// v has components [10.0, 20.0, 2.0]\nv.setMag(10);\n// v's components are set to [6.0, 8.0, 0.0]\n</code>\n</div>\n\n<div>\n<code>\nfunction draw() {\n  background(240);\n\n  let v0 = createVector(0, 0);\n  let v1 = createVector(50, 50);\n\n  drawArrow(v0, v1, 'red');\n\n  let length = map(mouseX, 0, width, 0, 141, true);\n  v1.setMag(length);\n  drawArrow(v0, v1, 'blue');\n\n  noStroke();\n  text('magnitude set to: ' + length.toFixed(2), 10, 70, 90, 30);\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1e3,description:"<p>Calculate the angle of rotation for this vector (only 2D vectors)</p>\n",itemtype:"method",name:"heading",return:{description:"the angle of rotation",type:"Number"},example:["\n<div class = \"norender\">\n<code>\nfunction setup() {\n  let v1 = createVector(30, 50);\n  print(v1.heading()); // 1.0303768265243125\n\n  v1 = createVector(40, 50);\n  print(v1.heading());
21 // 0.8960553845713439\n\n  v1 = createVector(30, 70);\n  print(v1.heading()); // 1.1659045405098132\n}\n</code>\n</div>\n\n<div>\n<code>\nfunction draw() {\n  background(240);\n\n  let v0 = createVector(50, 50);\n  let v1 = createVector(mouseX - 50, mouseY - 50);\n\n  drawArrow(v0, v1, 'black');\n\n  let myHeading = v1.heading();\n  noStroke();\n  text(\n    'vector heading: ' +\n      myHeading.toFixed(2) +\n      ' radians or ' +\n      degrees(myHeading).toFixed(2) +\n      ' degrees',\n    10,\n    50,\n    90,\n    50\n  );\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1069,description:"<p>Rotate the vector by an angle (only 2D vectors), magnitude remains the\nsame</p>\n",itemtype:"method",name:"rotate",params:[{name:"angle",description:"<p>the angle of rotation</p>\n",type:"Number"}],chainable:1,example:["\n<div class=\"norender\">\n<code>\nlet v = createVector(10.0, 20.0);\n// v has components [10.0, 20.0, 0.0]\nv.rotate(HALF_PI);\n// v's components are set to [-20.0, 9.999999, 0.0]\n</code>\n</div>\n\n<div>\n<code>\nlet angle = 0;\nfunction draw() {\n  background(240);\n\n  let v0 = createVector(50, 50);\n  let v1 = createVector(50, 0);\n\n  drawArrow(v0, v1.rotate(angle), 'black');\n  angle += 0.01;\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1125,description:"<p>Calculates and returns the angle (in radians) between two vectors.</p>\n",itemtype:"method",name:"angleBetween",params:[{name:"value",description:'<p>the x, y, and z components of a <a href="#/p5.Vector">p5.Vector</a></p>\n',type:"p5.Vector"}],return:{description:"the angle between (in radians)",type:"Number"},example:["\n<div class=\"norender\">\n<code>\nlet v1 = createVector(1, 0, 0);\nlet v2 = createVector(0, 1, 0);\n\nlet angle = v1.angleBetween(v2);\n// angle is PI/2\nprint(angle);\n</code>\n</div>\n\n<div>\n<code>\nfunction draw() {\n  background(240);\n  let v0 = createVector(50, 50);\n\n  let v1 = createVector(50, 0);\n  drawArrow(v0, v1, 'red');\n\n  let v2 = createVector(mouseX - 50, mouseY - 50);\n  drawArrow(v0, v2, 'blue');\n\n  let angleBetween = v1.angleBetween(v2);\n  noStroke();\n  text(\n    'angle between: ' +\n      angleBetween.toFixed(2) +\n      ' radians or ' +\n      degrees(angleBetween).toFixed(2) +\n      ' degrees',\n    10,\n    50,\n    90,\n    50\n  );\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1198,description:"<p>Linear interpolate the vector to another vector</p>\n",itemtype:"method",name:"lerp",chainable:1,example:["\n<div class=\"norender\">\n<code>\nlet v = createVector(1, 1, 0);\n\nv.lerp(3, 3, 0, 0.5); // v now has components [2,2,0]\n</code>\n</div>\n\n<div class=\"norender\">\n<code>\nlet v1 = createVector(0, 0, 0);\nlet v2 = createVector(100, 100, 0);\n\nlet v3 = p5.Vector.lerp(v1, v2, 0.5);\n// v3 has components [50,50,0]\nprint(v3);\n</code>\n</div>\n\n<div>\n<code>\nlet step = 0.01;\nlet amount = 0;\n\nfunction draw() {\n  background(240);\n  let v0 = createVector(0, 0);\n\n  let v1 = createVector(mouseX, mouseY);\n  drawArrow(v0, v1, 'red');\n\n  let v2 = createVector(90, 90);\n  drawArrow(v0, v2, 'blue');\n\n  if (amount > 1 || amount < 0) {\n    step *= -1;\n  }\n  amount += step;\n  let v3 = p5.Vector.lerp(v1, v2, amount);\n\n  drawArrow(v0, v3, 'purple');\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:1198,params:[{name:"x",description:"<p>the x component</p>\n",type:"Number"},{name:"y",description:"<p>the y component</p>\n",type:"Number"},{name:"z",description:"<p>the z component</p>\n",type:"Number"},{name:"amt",description:"<p>the amount of interpolation; some value between 0.0\n                        (old vector) and 1.0 (new vector). 0.9 is very near\n                        the new vector. 0.5 is halfway in between.</p>\n",type:"Number"}],chainable:1},{line:1271,params:[{name:"v",description:'<p>the <a href="#/p5.Vector">p5.Vector</a> to lerp to</p>\n',type:"p5.Vector"},{name:"amt",description:"",type:"Number"}],chainable:1},{line:1711,params:[{name:"v1",description:"",type:"p5.Vector"},{name:"v2",description:"",type:"p5.Vector"},{name:"amt",description:"",type:"Number"},{name:"target",description:"<p>if undefined a new vector will be created</p>\n",type:"p5.Vector"}],static:1},{line:1719,params:[{name:"v1",description:"",type:"p5.Vector"},{name:"v2",description:"",type:"p5.Vector"},{name:"amt",description:"",type:"Number"}],static:1,return:{description:"the lerped value",type:"Number"}}]},{file:"src/math/p5.Vector.js",line:1287,description:'<p>Return a representation of this vector as a float array. This is only\nfor temporary use. If used in any other fashion, the contents should be\ncopied by using the <b>p5.Vector.<a href="#/p5.Vector/copy">copy()</a></b>
21 method to copy into your own\narray.</p>\n',itemtype:"method",name:"array",return:{description:"an Array with the 3 values",type:"Number[]"},example:['\n<div class = "norender">\n<code>\nfunction setup() {\n  let v = createVector(20, 30);\n  print(v.array()); // Prints : Array [20, 30, 0]\n}\n</code>\n</div>\n\n<div class="norender">\n<code>\nlet v = createVector(10.0, 20.0, 30.0);\nlet f = v.array();\nprint(f[0]); // Prints "10.0"\nprint(f[1]); // Prints "20.0"\nprint(f[2]); // Prints "30.0"\n</code>\n</div>'],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1319,description:'<p>Equality check against a <a href="#/p5.Vector">p5.Vector</a></p>\n',itemtype:"method",name:"equals",return:{description:"whether the vectors are equals",type:"Boolean"},example:['\n<div class = "norender">\n<code>\nlet v1 = createVector(5, 10, 20);\nlet v2 = createVector(5, 10, 20);\nlet v3 = createVector(13, 10, 19);\n\nprint(v1.equals(v2.x, v2.y, v2.z)); // true\nprint(v1.equals(v3.x, v3.y, v3.z)); // false\n</code>\n</div>\n\n<div class="norender">\n<code>\nlet v1 = createVector(10.0, 20.0, 30.0);\nlet v2 = createVector(10.0, 20.0, 30.0);\nlet v3 = createVector(0.0, 0.0, 0.0);\nprint(v1.equals(v2)); // true\nprint(v1.equals(v3)); // false\n</code>\n</div>'],class:"p5.Vector",module:"Math",submodule:"Math",overloads:[{line:1319,params:[{name:"x",description:"<p>the x component of the vector</p>\n",type:"Number",optional:!0},{name:"y",description:"<p>the y component of the vector</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>the z component of the vector</p>\n",type:"Number",optional:!0}],return:{description:"whether the vectors are equals",type:"Boolean"}},{line:1349,params:[{name:"value",description:"<p>the vector to compare</p>\n",type:"p5.Vector|Array"}],return:{description:"",type:"Boolean"}}]},{file:"src/math/p5.Vector.js",line:1374,description:"<p>Make a new 2D vector from an angle</p>\n",itemtype:"method",name:"fromAngle",static:1,params:[{name:"angle",description:'<p>the desired angle, in radians (unaffected by <a href="#/p5/angleMode">angleMode</a>)</p>\n',type:"Number"},{name:"length",description:"<p>the length of the new vector (defaults to 1)</p>\n",type:"Number",optional:!0}],return:{description:'the new <a href="#/p5.Vector">p5.Vector</a> object',type:"p5.Vector"},example:["\n<div>\n<code>\nfunction draw() {\n  background(200);\n\n  // Create a variable, proportional to the mouseX,\n  // varying from 0-360, to represent an angle in degrees.\n  let myDegrees = map(mouseX, 0, width, 0, 360);\n\n  // Display that variable in an onscreen text.\n  // (Note the nfc() function to truncate additional decimal places,\n  // and the \"\\xB0\" character for the degree symbol.)\n  let readout = 'angle = ' + nfc(myDegrees, 1) + '\\xB0';\n  noStroke();\n  fill(0);\n  text(readout, 5, 15);\n\n  // Create a p5.Vector using the fromAngle function,\n  // and extract its x and y components.\n  let v = p5.Vector.fromAngle(radians(myDegrees), 30);\n  let vx = v.x;\n  let vy = v.y;\n\n  push();\n  translate(width / 2, height / 2);\n  noFill();\n  stroke(150);\n  line(0, 0, 30, 0);\n  stroke(0);\n  line(0, 0, vx, vy);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1425,description:"<p>Make a new 3D vector from a pair of ISO spherical angles</p>\n",itemtype:"method",name:"fromAngles",static:1,params:[{name:"theta",description:"<p>the polar angle, in radians (zero is up)</p>\n",type:"Number"},{name:"phi",description:"<p>the azimuthal angle, in radians\n                              (zero is out of the screen)</p>\n",type:"Number"},{name:"length",description:"<p>the length of the new vector (defaults to 1)</p>\n",type:"Number",optional:!0}],return:{description:'the new <a href="#/p5.Vector">p5.Vector</a> object',type:"p5.Vector"},example:["\n<div modernizr='webgl'>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  fill(255);\n  noStroke();\n}\nfunction draw() {\n  background(255);\n\n  let t = millis() / 1000;\n\n  // add three point lights\n  pointLight(color('#f00'), p5.Vector.fromAngles(t * 1.0, t * 1.3, 100));\n  pointLight(color('#0f0'), p5.Vector.fromAngles(t * 1.1, t * 1.2, 100));\n  pointLight(color('#00f'), p5.Vector.fromAngles(t * 1.2, t * 1.1, 100));\n\n  sphere(35);\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1474,description:"<p>Make a new 2D unit vector from a random angle</p>\n",itemtype:"method",name:"random2D",static:1,return:{description:'the new <a href="#/p5.Vector">p5.Vector</a> object',type:"p5.Vector"},example:["\n<div class=\"norender\">\n<code>\nlet v = p5.Vector.random2D();\n// May make v's attributes something like:\n// [0.61554617, -0.51195765, 0.0] or\n// [-0.4695841, -0.
2114366731, 0.0] or\n// [0.6091097, -0.22805278, 0.0]\nprint(v);\n</code>\n</div>\n\n<div>\n<code>\nfunction setup() {\n  frameRate(1);\n}\n\nfunction draw() {\n  background(240);\n\n  let v0 = createVector(50, 50);\n  let v1 = p5.Vector.random2D();\n  drawArrow(v0, v1.mult(50), 'black');\n}\n\n// draw an arrow for a vector at a given base position\nfunction drawArrow(base, vec, myColor) {\n  push();\n  stroke(myColor);\n  strokeWeight(3);\n  fill(myColor);\n  translate(base.x, base.y);\n  line(0, 0, vec.x, vec.y);\n  rotate(vec.heading());\n  let arrowSize = 7;\n  translate(vec.mag() - arrowSize, 0);\n  triangle(0, arrowSize / 2, 0, -arrowSize / 2, arrowSize, 0);\n  pop();\n}\n</code>\n</div>"],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1527,description:"<p>Make a new random 3D unit vector.</p>\n",itemtype:"method",name:"random3D",static:1,return:{description:'the new <a href="#/p5.Vector">p5.Vector</a> object',type:"p5.Vector"},example:['\n<div class="norender">\n<code>\nlet v = p5.Vector.random3D();\n// May make v\'s attributes something like:\n// [0.61554617, -0.51195765, 0.599168] or\n// [-0.4695841, -0.14366731, -0.8711202] or\n// [0.6091097, -0.22805278, -0.7595902]\nprint(v);\n</code>\n</div>'],class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1610,description:"<p>Multiplies a vector by a scalar and returns a new vector.</p>\n",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1637,description:"<p>Divides a vector by a scalar and returns a new vector.</p>\n",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1664,description:"<p>Calculates the dot product of two vectors.</p>\n",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1678,description:"<p>Calculates the cross product of two vectors.</p>\n",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1692,description:"<p>Calculates the Euclidean distance between two points (considering a\npoint as a vector object).</p>\n",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/p5.Vector.js",line:1707,description:"<p>Linear interpolate a vector to another vector and return the result as a\nnew vector.</p>\n",class:"p5.Vector",module:"Math",submodule:"Math"},{file:"src/math/random.js",line:48,description:'<p>Sets the seed value for <a href="#/p5/random">random()</a>.</p>\n<p>By default, <a href="#/p5/random">random()</a> produces different results each time the program\nis run. Set the seed parameter to a constant to return the same\npseudo-random numbers each time the software is run.</p>\n',itemtype:"method",name:"randomSeed",params:[{name:"seed",description:"<p>the seed value</p>\n",type:"Number"}],example:["\n<div>\n<code>\nrandomSeed(99);\nfor (let i = 0; i < 100; i++) {\n  let r = random(0, 255);\n  stroke(r);\n  line(i, 0, i, 100);\n}\n</code>\n</div>"],alt:"many vertical lines drawn in white, black or grey.",class:"p5",module:"Math",submodule:"Random"},{file:"src/math/random.js",line:79,description:"<p>Return a random floating-point number.</p>\n<p>Takes either 0, 1 or 2 arguments.</p>\n<p>If no argument is given, returns a random number from 0\nup to (but not including) 1.</p>\n<p>If one argument is given and it is a number, returns a random number from 0\nup to (but not including) the number.</p>\n<p>If one argument is given and it is an array, returns a random element from\nthat array.</p>\n<p>If two arguments are given, returns a random number from the\nfirst argument up to (but not including) the second argument.</p>\n",itemtype:"method",name:"random",return:{description:"the random number",type:"Number"},example:["\n<div>\n<code>\nfor (let i = 0; i < 100; i++) {\n  let r = random(50);\n  stroke(r * 5);\n  line(50, i, 50 + r, i);\n}\n</code>\n</div>\n<div>\n<code>\nfor (let i = 0; i < 100; i++) {\n  let r = random(-50, 50);\n  line(50, i, 50 + r, i);\n}\n</code>\n</div>\n<div>\n<code>\n// Get a random element from an array using the random(Array) syntax\nlet words = ['apple', 'bear', 'cat', 'dog'];\nlet word = random(words); // select random word\ntext(word, 10, 50); // draw the word\n</code>\n</div>"],alt:"100 horizontal lines from center canvas to right. size+fill change each time\n100 horizontal lines from center of canvas. height & side change each render\nword displayed at random. Either apple, bear, cat, or dog",class:"p5",module:"Math",submodule:"Random",overloads:[{line:79,params:[{name:"min",description:"<p>the lower bound (inclusive)</p>\n",type:"Number",optional:!0},{name:"max",description:"<p>the upper bound (exclusive)</p>\n",type:"Number",optional:!0}],return:{description:"the random number",type:"Number"}},{line:133,params:[{name:"choices",description:"<p>the array to choose from</p>\n",type:"Array"}],return:{description:"the random element from the array",type:"*"}}]},{file:"src/math/random.js",line:166,description:'<p>Returns a random number fitting a Gaussian, or\n normal, distribution. There is theoretically no minimum or maximum\n value that <a href="#/p5/randomGaussian">randomGaussian()</a> might return. Rather, there is\n just a very low probability that values far from the mean will be\n returned; and a higher probability that numbers near the mean will\n be returned.\n <br><br>\n Takes either 0, 1 or 2 arguments.<br>\n If no args, returns a mean of 0 and standard deviation of 1.<br>\n If one arg, that arg is the mean (standard deviation is 1).<br>\n If two args, first is mean, second is standard deviation.</p>\n',itemtype:"method",name:"randomGaussian",params:[{name:"mean",de
21scription:"<p>the mean</p>\n",type:"Number"},{name:"sd",description:"<p>the standard deviation</p>\n",type:"Number"}],return:{description:"the random number",type:"Number"},example:["\n <div>\n <code>\n for (let y = 0; y < 100; y++) {\n   let x = randomGaussian(50, 15);\n   line(50, y, x, y);\n }\n </code>\n </div>\n <div>\n <code>\n let distribution = new Array(360);\nfunction setup() {\n   createCanvas(100, 100);\n   for (let i = 0; i < distribution.length; i++) {\n     distribution[i] = floor(randomGaussian(0, 15));\n   }\n }\nfunction draw() {\n   background(204);\n  translate(width / 2, width / 2);\n  for (let i = 0; i < distribution.length; i++) {\n     rotate(TWO_PI / distribution.length);\n     stroke(0);\n     let 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:20,description:'<p>The inverse of <a href="#/p5/cos">cos()</a>, 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>\nlet a = PI;\nlet c = cos(a);\nlet 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>\nlet a = PI + PI / 4.0;\nlet c = cos(a);\nlet 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:54,description:'<p>The inverse of <a href="#/p5/sin">sin()</a>, 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>\nlet a = PI + PI / 3;\nlet s = sin(a);\nlet 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>\nlet a = PI + PI / 3.0;\nlet s = sin(a);\nlet 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:89,description:'<p>The inverse of <a href="#/p5/tan">tan()</a>, 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>\nlet a = PI + PI / 3;\nlet t = tan(a);\nlet 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>\nlet a = PI + PI / 3.0;\nlet t = tan(a);\nlet 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:124,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<a href="#/p5/">()</a> function is most often used\nfor orienting geometry to the position of the cursor.\n<br><br>\nNote: The y-coordinate of the point is the first parameter, and the\nx-coordinate is the second parameter, due the the structure of calculating\nthe tangent.</p>\n',itemtype:"method",name:"atan2",params:[{name:"y",description:"<p>y-coordinate of the point</p>\n",type:"Number"},{name:"x",description:"<p>x-coordinate of the point</p>\n",type:"Number"}],return:{description:"the arc tangent of the given point",type:"Number"},example:["\n<div>\n<code>\nfunction draw() {\n  background(204);\n  translate(width / 2, height / 2);
21\n  let a = atan2(mouseY - height / 2, mouseX - width / 2);\n  rotate(a);\n  rect(-30, -5, 60, 10);\n}\n</code>\n</div>"],alt:"60 by 10 rect at center of canvas rotates with mouse movements",class:"p5",module:"Math",submodule:"Trigonometry"},{file:"src/math/trigonometry.js",line:160,description:'<p>Calculates the cosine of an angle. This function takes into account the\ncurrent <a href="#/p5/angleMode">angleMode</a>. Values are returned in the range -1 to 1.</p>\n',itemtype:"method",name:"cos",params:[{name:"angle",description:"<p>the angle</p>\n",type:"Number"}],return:{description:"the cosine of the angle",type:"Number"},example:["\n<div>\n<code>\nlet a = 0.0;\nlet inc = TWO_PI / 25.0;\nfor (let i = 0; i < 25; i++) {\n  line(i * 4, 50, i * 4, 50 + cos(a) * 40.0);\n  a = a + inc;\n}\n</code>\n</div>"],alt:"vertical black lines form wave patterns, extend-down on left and right side",class:"p5",module:"Math",submodule:"Trigonometry"},{file:"src/math/trigonometry.js",line:188,description:'<p>Calculates the sine of an angle. This function takes into account the\ncurrent <a href="#/p5/angleMode">angleMode</a>. Values are returned in the range -1 to 1.</p>\n',itemtype:"method",name:"sin",params:[{name:"angle",description:"<p>the angle</p>\n",type:"Number"}],return:{description:"the sine of the angle",type:"Number"},example:["\n<div>\n<code>\nlet a = 0.0;\nlet inc = TWO_PI / 25.0;\nfor (let i = 0; i < 25; i++) {\n  line(i * 4, 50, i * 4, 50 + sin(a) * 40.0);\n  a = a + inc;\n}\n</code>\n</div>"],alt:"vertical black lines extend down and up from center to form wave pattern",class:"p5",module:"Math",submodule:"Trigonometry"},{file:"src/math/trigonometry.js",line:216,description:'<p>Calculates the tangent of an angle. This function takes into account\nthe current <a href="#/p5/angleMode">angleMode</a>. Values are returned in the range -1 to 1.</p>\n',itemtype:"method",name:"tan",params:[{name:"angle",description:"<p>the angle</p>\n",type:"Number"}],return:{description:"the tangent of the angle",type:"Number"},example:["\n<div>\n<code>\nlet a = 0.0;\nlet inc = TWO_PI / 50.0;\nfor (let i = 0; i < 100; i = i + 2) {\n  line(i, 50, i, 50 + tan(a) * 2.0);\n  a = a + inc;\n}\n</code>"],alt:"vertical black lines end down and up from center to form spike pattern",class:"p5",module:"Math",submodule:"Trigonometry"},{file:"src/math/trigonometry.js",line:244,description:'<p>Converts a radian measurement to its corresponding value in degrees.\nRadians and degrees are two ways of measuring the same thing. There are\n360 degrees in a circle and 2*PI radians in a circle. For example,\n90° = PI/2 = 1.5707964. This function does not take into account the\ncurrent <a href="#/p5/angleMode">angleMode</a>.</p>\n',itemtype:"method",name:"degrees",params:[{name:"radians",description:"<p>the radians value to convert to degrees</p>\n",type:"Number"}],return:{description:"the converted angle",type:"Number"},example:["\n<div class= “norender\">\n<code>\nlet rad = PI / 4;\nlet deg = degrees(rad);\nprint(rad + ' radians is ' + deg + ' degrees');\n// Prints: 0.7853981633974483 radians is 45 degrees\n</code>\n</div>\n"],class:"p5",module:"Math",submodule:"Trigonometry"},{file:"src/math/trigonometry.js",line:271,description:'<p>Converts a degree measurement to its corresponding value in radians.\nRadians and degrees are two ways of measuring the same thing. There are\n360 degrees in a circle and 2*PI radians in a circle. For example,\n90° = PI/2 = 1.5707964. This function does not take into account the\ncurrent <a href="#/p5/angleMode">angleMode</a>.</p>\n',itemtype:"method",name:"radians",params:[{name:"degrees",description:"<p>the degree value to convert to radians</p>\n",type:"Number"}],return:{description:"the converted angle",type:"Number"},example:["\n<div class= “norender\">\n<code>\nlet deg = 45.0;\nlet rad = radians(deg);\nprint(deg + ' degrees is ' + rad + ' radians');\n// Prints: 45 degrees is 0.7853981633974483 radians\n</code>\n</div>"],class:"p5",module:"Math",submodule:"Trigonometry"},{file:"src/math/trigonometry.js",line:296,description:"<p>Sets the current mode of p5 to given mode. Default mode is RADIANS.</p>\n",itemtype:"method",name:"angleMode",params:[{name:"mode",description:"<p>either RADIANS or DEGREES</p>\n",type:"Constant"}],example:["\n<div>\n<code>\nfunction draw() {\n  background(204);\n  angleMode(DEGREES);
21 // Change the mode to DEGREES\n  let a = atan2(mouseY - height / 2, mouseX - width / 2);\n  translate(width / 2, height / 2);\n  push();\n  rotate(a);\n  rect(-20, -5, 40, 10); // Larger rectangle is rotating in degrees\n  pop();\n  angleMode(RADIANS); // Change the mode to RADIANS\n  rotate(a); // variable a stays the same\n  rect(-40, -5, 20, 10); // Smaller rectangle is rotating in radians\n}\n</code>\n</div>"],alt:"40 by 10 rect in center rotates with mouse moves. 20 by 10 rect moves faster.",class:"p5",module:"Math",submodule:"Trigonometry"},{file:"src/typography/attributes.js",line:13,description:'<p>Sets the current alignment for drawing text. Accepts two\narguments: horizAlign (LEFT, CENTER, or RIGHT) and\nvertAlign (TOP, BOTTOM, CENTER, or BASELINE).</p>\n<p>The horizAlign parameter is in reference to the x value\nof the <a href="#/p5/text">text()</a> function, while the vertAlign parameter is\nin reference to the y value.</p>\n<p>So if you write textAlign(LEFT), you are aligning the left\nedge of your text to the x value you give in <a href="#/p5/text">text()</a>. If you\nwrite textAlign(RIGHT, TOP), you are aligning the right edge\nof your text to the x value and the top of edge of the text\nto the y value.</p>\n',itemtype:"method",name:"textAlign",chainable:1,example:["\n<div>\n<code>\ntextSize(16);\ntextAlign(RIGHT);\ntext('ABCD', 50, 30);\ntextAlign(CENTER);\ntext('EFGH', 50, 50);\ntextAlign(LEFT);\ntext('IJKL', 50, 70);\n</code>\n</div>\n\n<div>\n<code>\ntextSize(16);\nstrokeWeight(0.5);\n\nline(0, 12, width, 12);\ntextAlign(CENTER, TOP);\ntext('TOP', 0, 12, width);\n\nline(0, 37, width, 37);\ntextAlign(CENTER, CENTER);\ntext('CENTER', 0, 37, width);\n\nline(0, 62, width, 62);\ntextAlign(CENTER, BASELINE);\ntext('BASELINE', 0, 62, width);\n\nline(0, 87, width, 87);\ntextAlign(CENTER, BOTTOM);\ntext('BOTTOM', 0, 87, width);\n</code>\n</div>"],alt:"Letters ABCD displayed at top right, EFGH at center and IJKL at bottom left.\nThe names of the four vertical alignments rendered each showing that alignment's placement relative to a horizontal line.",class:"p5",module:"Typography",submodule:"Attributes",overloads:[{line:13,params:[{name:"horizAlign",description:"<p>horizontal alignment, either LEFT,\n                           CENTER, or RIGHT</p>\n",type:"Constant"},{name:"vertAlign",description:"<p>vertical alignment, either TOP,\n                           BOTTOM, CENTER, or BASELINE</p>\n",type:"Constant",optional:!0}],chainable:1},{line:75,params:[],return:{description:"",type:"Object"}}]},{file:"src/typography/attributes.js",line:84,description:'<p>Sets/gets the spacing, in pixels, between lines of text. This\nsetting will be used in all subsequent calls to the <a href="#/p5/text">text()</a> function.</p>\n',itemtype:"method",name:"textLeading",chainable:1,example:['\n<div>\n<code>\n// Text to display. The "\\n" is a "new line" character\nlet lines = \'L1\\nL2\\nL3\';\ntextSize(12);\n\ntextLeading(10); // Set leading to 10\ntext(lines, 10, 25);\n\ntextLeading(20); // Set leading to 20\ntext(lines, 40, 25);\n\ntextLeading(30); // Set leading to 30\ntext(lines, 70, 25);\n</code>\n</div>'],alt:"set L1 L2 & L3 displayed vertically 3 times. spacing increases for each set",class:"p5",module:"Typography",submodule:"Attributes",overloads:[{line:84,params:[{name:"leading",description:"<p>the size in pixels for spacing between lines</p>\n",type:"Number"}],chainable:1},{line:113,params:[],return:{description:"",type:"Number"}}]},{file:"src/typography/attributes.js",line:122,description:'<p>Sets/gets the current font size. This size will be used in all subsequent\ncalls to the <a href="#/p5/text">text()</a> function. Font size is measured in pixels.</p>\n',itemtype:"method",name:"textSize",chainable:1,example:["\n<div>\n<code>\ntextSize(12);\ntext('Font Size 12', 10, 30);\ntextSize(14);\ntext('Font Size 14', 10, 60);\ntextSize(16);\ntext('Font Size 16', 10, 90);\n</code>\n</div>"],alt:"Font Size 12 displayed small, Font Size 14 medium & Font Size 16 large",class:"p5",module:"Typography",submodule:"Attributes",overloads:[{line:122,params:[{name:"theSize",description:"<p>the size of the letters in units of pixels</p>\n",type:"Number"}],chainable:1},{line:145,params:[],return:{description:"",type:"Number"}}]},{file:"src/typography/attributes.js",line:154,description:"<p>Sets/gets the style of the text for system fonts to NORMAL, ITALIC, BOLD or BOLDITALIC.\nNote: this may be is overridden by CSS styling. For non-system fonts\n(opentype, truetype, etc.) please load styled fonts instead.</p>\n",itemtype:"method",name:"textStyle",chainable:1,example:["\n<div>\n<code>\nstrokeWeight(0);\ntextSize(12);\ntextStyle(NORMAL);\ntext('Font Style Normal', 10, 15);\ntextStyle(ITALIC);\ntext('Font Style Italic', 10, 40);\ntextStyle(BOLD);\ntext('Font Style Bold', 10, 65);\ntextStyle(BOLDITALIC);\ntext('Font Style Bold Italic', 10, 90);\n</code>\n</div>"],alt:"words Font Style Normal displayed normally, Italic in italic, bold in bold and bold italic in bold italics.",class:"p5",module:"Typography",submodule:"Attributes",overloads:[{line:154,params:[{name:"theStyle",description:"<p>styling for text, either NORMAL,\n                           ITALIC, BOLD or BOLDITALIC</p>\n",type:"Constant"}],chainable:1},{line:182,params:[],return:{description:"",type:"String"}}]},{file:"src/typography/attributes.js",line:191,description:"<p>
21Calculates and returns the width of any character or text string.</p>\n",itemtype:"method",name:"textWidth",params:[{name:"theText",description:"<p>the String of characters to measure</p>\n",type:"String"}],return:{description:"",type:"Number"},example:["\n<div>\n<code>\ntextSize(28);\n\nlet aChar = 'P';\nlet cWidth = textWidth(aChar);\ntext(aChar, 0, 40);\nline(cWidth, 0, cWidth, 50);\n\nlet aString = 'p5.js';\nlet sWidth = textWidth(aString);\ntext(aString, 0, 85);\nline(sWidth, 50, sWidth, 100);\n</code>\n</div>"],alt:"Letter P and p5.js are displayed with vertical lines at end. P is wide",class:"p5",module:"Typography",submodule:"Attributes"},{file:"src/typography/attributes.js",line:226,description:"<p>Returns the ascent of the current font at its current size. The ascent\nrepresents the distance, in pixels, of the tallest character above\nthe baseline.</p>\n",itemtype:"method",name:"textAscent",return:{description:"",type:"Number"},example:["\n<div>\n<code>\nlet base = height * 0.75;\nlet scalar = 0.8; // Different for each font\n\ntextSize(32); // Set initial text size\nlet asc = textAscent() * scalar; // Calc ascent\nline(0, base - asc, width, base - asc);\ntext('dp', 0, base); // Draw text on baseline\n\ntextSize(64); // Increase text size\nasc = textAscent() * scalar; // Recalc ascent\nline(40, base - asc, width, base - asc);\ntext('dp', 40, base); // Draw text on baseline\n</code>\n</div>"],class:"p5",module:"Typography",submodule:"Attributes"},{file:"src/typography/attributes.js",line:255,description:"<p>Returns the descent of the current font at its current size. The descent\nrepresents the distance, in pixels, of the character with the longest\ndescender below the baseline.</p>\n",itemtype:"method",name:"textDescent",return:{description:"",type:"Number"},example:["\n<div>\n<code>\nlet base = height * 0.75;\nlet scalar = 0.8; // Different for each font\n\ntextSize(32); // Set initial text size\nlet desc = textDescent() * scalar; // Calc ascent\nline(0, base + desc, width, base + desc);\ntext('dp', 0, base); // Draw text on baseline\n\ntextSize(64); // Increase text size\ndesc = textDescent() * scalar; // Recalc ascent\nline(40, base + desc, width, base + desc);\ntext('dp', 40, base); // Draw text on baseline\n</code>\n</div>"],class:"p5",module:"Typography",submodule:"Attributes"},{file:"src/typography/attributes.js",line:284,description:"<p>Helper function to measure ascent and descent.</p>\n",class:"p5",module:"Typography",submodule:"Attributes"},{file:"src/typography/loading_displaying.js",line:16,description:"<p>Loads an opentype font file (.otf, .ttf) from a file or a URL,\nand returns a PFont Object. This method is asynchronous,\nmeaning it may not finish before the next line in your sketch\nis executed.\n<br><br>\nThe path to the font should be relative to the HTML file\nthat links in your sketch. Loading fonts from a URL or other\nremote location may be blocked due to your browser&#39;s built-in\nsecurity.</p>\n",itemtype:"method",name:"loadFont",params:[{name:"path",description:"<p>name of the file or url to load</p>\n",type:"String"},{name:"callback",description:'<p>function to be executed after\n                                   <a href="#/p5/loadFont">loadFont()</a> completes</p>\n',type:"Function",optional:!0},{name:"onError",description:"<p>function to be executed if\n                                   an error occurs</p>\n",type:"Function",optional:!0}],return:{description:'<a href="#/p5.Font">p5.Font</a> object',type:"p5.Font"},example:["\n\n<p>Calling loadFont() inside <a href=\"#/p5/preload\">preload()</a> guarantees that the load\noperation will have completed before <a href=\"#/p5/setup\">setup()</a> and <a href=\"#/p5/draw\">draw()</a> are called.</p>\n\n<div><code>\nlet myFont;\nfunction preload() {\n  myFont = loadFont('assets/inconsolata.otf');\n}\n\nfunction setup() {\n  fill('#ED225D');\n  textFont(myFont);\n  textSize(36);\n  text('p5*js', 10, 50);\n}\n</code></div>\n\nOutside of <a href=\"#/p5/preload\">preload()</a>, you may supply a callback function to handle the\nobject:\n\n<div><code>\nfunction setup() {\n  loadFont('assets/inconsolata.otf', drawText);\n}
21\n\nfunction drawText(font) {\n  fill('#ED225D');\n  textFont(font, 36);\n  text('p5*js', 10, 50);\n}\n</code></div>\n\n<p>You can also use the font filename string (without the file extension) to style other HTML\nelements.</p>\n\n<div><code>\nfunction preload() {\n  loadFont('assets/inconsolata.otf');\n}\n\nfunction setup() {\n  let myDiv = createDiv('hello there');\n  myDiv.style('font-family', 'Inconsolata');\n}\n</code></div>"],alt:"p5*js in p5's theme dark pink\np5*js in p5's theme dark pink",class:"p5",module:"Typography",submodule:"Loading & Displaying"},{file:"src/typography/loading_displaying.js",line:143,description:'<p>Draws text to the screen. Displays the information specified in the first\nparameter on the screen in the position specified by the additional\nparameters. A default font will be used unless a font is set with the\n<a href="#/p5/textFont">textFont()</a> function and a default size will be used unless a font is set\nwith <a href="#/p5/textSize">textSize()</a>. Change the color of the text with the <a href="#/p5/fill">fill()</a> function.\nChange the outline of the text with the <a href="#/p5/stroke">stroke()</a> and <a href="#/p5/strokeWeight">
21strokeWeight()</a>\nfunctions.\n<br><br>\nThe text displays in relation to the <a href="#/p5/textAlign">textAlign()</a> function, which gives the\noption to draw to the left, right, and center of the coordinates.\n<br><br>\nThe x2 and y2 parameters define a rectangular area to display within and\nmay only be used with string data. When these parameters are specified,\nthey are interpreted based on the current <a href="#/p5/rectMode">rectMode()</a> setting. Text that\ndoes not fit completely within the rectangle specified will not be drawn\nto the screen. If x2 and y2 are not specified, the baseline alignment is the\ndefault, which means that the text will be drawn upwards from x and y.\n<br><br>\n<b>WEBGL</b>: Only opentype/truetype fonts are supported. You must load a font using the\n<a href="#/p5/loadFont">loadFont()</a> method (see the example above).\n<a href="#/p5/stroke">stroke()</a> currently has no effect in webgl mode.</p>\n',itemtype:"method",name:"text",params:[{name:"str",description:"<p>the alphanumeric\n                                            symbols to be displayed</p>\n",type:"String|Object|Array|Number|Boolean"},{name:"x",description:"<p>x-coordinate of text</p>\n",type:"Number"},{name:"y",description:"<p>y-coordinate of text</p>\n",type:"Number"},{name:"x2",description:'<p>by default, the width of the text box,\n                    see <a href="#/p5/rectMode">rectMode()</a> for more info</p>\n',type:"Number",optional:!0},{name:"y2",description:'<p>by default, the height of the text box,\n                    see <a href="#/p5/rectMode">rectMode()</a> for more info</p>\n',type:"Number",optional:!0}],chainable:1,example:["\n<div>\n<code>\ntextSize(32);\ntext('word', 10, 30);\nfill(0, 102, 153);\ntext('word', 10, 60);\nfill(0, 102, 153, 51);\ntext('word', 10, 90);\n</code>\n</div>\n<div>\n<code>\nlet s = 'The quick brown fox jumped over the lazy dog.';\nfill(50);\ntext(s, 10, 10, 70, 80); // Text wraps within text box\n</code>\n</div>\n\n<div modernizr='webgl'>\n<code>\nlet inconsolata;\nfunction preload() {\n  inconsolata = loadFont('assets/inconsolata.otf');\n}\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  textFont(inconsolata);\n  textSize(width / 3);\n  textAlign(CENTER, CENTER);\n}\nfunction draw() {\n  background(0);\n  let time = millis();\n  rotateX(time / 1000);\n  rotateZ(time / 1234);\n  text('p5.js', 0, 0);\n}\n</code>\n</div>"],alt:"'word' displayed 3 times going from black, blue to translucent blue\nThe quick brown fox jumped over the lazy dog.\nthe text 'p5.js' spinning in 3d",class:"p5",module:"Typography",submodule:"Loading & Displaying"},{file:"src/typography/loading_displaying.js",line:230,description:'<p>Sets the current font that will be drawn with the <a href="#/p5/text">text()</a> function.\n<br><br>\n<b>WEBGL</b>: Only fonts loaded via <a href="#/p5/loadFont">loadFont()</a> are supported.</p>\n',itemtype:"method",name:"textFont",return:{description:"the current font",type:"Object"},example:["\n<div>\n<code>\nfill(0);\ntextSize(12);\ntextFont('Georgia');\ntext('Georgia', 12, 30);\ntextFont('Helvetica');\ntext('Helvetica', 12, 60);\n</code>\n</div>\n<div>\n<code>\nlet fontRegular, fontItalic, fontBold;\nfunction preload() {\n  fontRegular = loadFont('assets/Regular.otf');\n  fontItalic = loadFont('assets/Italic.ttf');\n  fontBold = loadFont('assets/Bold.ttf');\n}\nfunction setup() {\n  background(210);\n  fill(0)\n   .strokeWeight(0)\n   .textSize(10);\n  textFont(fontRegular);\n  text('Font Style Normal', 10, 30);\n  textFont(fontItalic);\n  text('Font Style Italic', 10, 50);\n  textFont(fontBold);\n  text('Font Style Bold', 10, 70);\n}\n</code>\n</div>"],alt:"words Font Style Normal displayed normally, Italic in italic and bold in bold",class:"p5",module:"Typography",submodule:"Loading & Displaying",overloads:[{line:230,params:[],return:{description:"the current font",type:"Object"}},{line:275,params:[{name:"font",description:'<p>a font loaded via <a href="#/p5/loadFont">loadFont()</a>, or a String\nrepresenting a <a href="https://mzl.la/2dOw8WD">web safe font</a> (a font\nthat is generally available across all systems)</p>\n',type:"Object|String"},{name:"size",description:"<p>the font size to use</p>\n",type:"Number",optional:!0}],chainable:1}]},{file:"src/typography/p5.Font.js",line:25,description:"<p>Underlying opentype font implementation</p>\n",itemtype:"property",name:"font",class:"p5.Font",module:"Typography",submodule:"Font"},{file:"src/typography/p5.Font.js",line:32,description:"<p>
21Returns a tight bounding box for the given text string using this\nfont (currently only supports single lines)</p>\n",itemtype:"method",name:"textBounds",params:[{name:"line",description:"<p>a line of text</p>\n",type:"String"},{name:"x",description:"<p>x-position</p>\n",type:"Number"},{name:"y",description:"<p>y-position</p>\n",type:"Number"},{name:"fontSize",description:"<p>font size to use (optional) Default is 12.</p>\n",type:"Number",optional:!0},{name:"options",description:"<p>opentype options (optional)\n                           opentype fonts contains alignment and baseline options.\n                           Default is &#39;LEFT&#39; and &#39;alphabetic&#39;</p>\n",type:"Object",optional:!0}],return:{description:"a rectangle object with properties: x, y, w, h",type:"Object"},example:["\n<div>\n<code>\nlet font;\nlet textString = 'Lorem ipsum dolor sit amet.';\nfunction preload() {\n  font = loadFont('./assets/Regular.otf');\n}\nfunction setup() {\n  background(210);\n\n  let bbox = font.textBounds(textString, 10, 30, 12);\n  fill(255);\n  stroke(0);\n  rect(bbox.x, bbox.y, bbox.w, bbox.h);\n  fill(0);\n  noStroke();\n\n  textFont(font);\n  textSize(12);\n  text(textString, 10, 30);\n}\n</code>\n</div>"],alt:"words Lorem ipsum dol go off canvas and contained by white bounding box",class:"p5.Font",module:"Typography",submodule:"Font"},{file:"src/typography/p5.Font.js",line:156,description:"<p>Computes an array of points following the path for specified text</p>\n",itemtype:"method",name:"textToPoints",params:[{name:"txt",description:"<p>a line of text</p>\n",type:"String"},{name:"x",description:"<p>x-position</p>\n",type:"Number"},{name:"y",description:"<p>y-position</p>\n",type:"Number"},{name:"fontSize",description:"<p>font size to use (optional)</p>\n",type:"Number"},{name:"options",description:"<p>an (optional) object that can contain:</p>\n<p><br>sampleFactor - the ratio of path-length to number of samples\n(default=.1); higher values yield more points and are therefore\nmore precise</p>\n<p><br>simplifyThreshold - if set to a non-zero value, collinear points will be\nbe removed from the polygon; the value represents the threshold angle to use\nwhen determining whether two edges are collinear</p>\n",type:"Object",optional:!0}],return:{description:"an array of points, each with x, y, alpha (the path angle)",type:"Array"},example:["\n<div>\n<code>\nlet font;\nfunction preload() {\n  font = loadFont('assets/inconsolata.otf');\n}\n\nlet points;\nlet bounds;\nfunction setup() {\n  createCanvas(100, 100);\n  stroke(0);\n  fill(255, 104, 204);\n\n  points = font.textToPoints('p5', 0, 0, 10, {\n    sampleFactor: 5,\n    simplifyThreshold: 0\n  });\n  bounds = font.textBounds(' p5 ', 0, 0, 10);\n}\n\nfunction draw() {\n  background(255);\n  beginShape();\n  translate(-bounds.x * width / bounds.w, -bounds.y * height / bounds.h);\n  for (let i = 0; i < points.length; i++) {\n    let p = points[i];\n    vertex(\n      p.x * width / bounds.w +\n        sin(20 * p.y / bounds.h + millis() / 1000) * width / 30,\n      p.y * height / bounds.h\n    );\n  }\n  endShape(CLOSE);\n}\n</code>\n</div>\n"],class:"p5.Font",module:"Typography",submodule:"Font"},{file:"src/utilities/array_functions.js",line:12,description:"<p>Adds a value to the end of an array. Extends the length of\nthe array by one. Maps to Array.push().</p>\n",itemtype:"method",name:"append",deprecated:!0,deprecationMessage:'Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/push">array.push(value)</a> instead.',params:[{name:"array",description:"<p>Array to append</p>\n",type:"Array"},{name:"value",description:"<p>to be added to the Array</p>\n",type:"Any"}],return:{description:"the array that was appended to",type:"Array"},example:["\n<div class='norender'><code>\nfunction setup() {\n  var myArray = ['Mango', 'Apple', 'Papaya'];\n  print(myArray); // ['Mango', 'Apple', 'Papaya']\n\n  append(myArray, 'Peach');\n  print(myArray); // ['Mango', 'Apple', 'Papaya', 'Peach']\n}\n</code></div>"],class:"p5",module:"Data",submodule:"Array Functions"},{file:"src/utilities/array_functions.js",line:37,description:'<p>Copies an array (or part of an array) to another array. The src array is\ncopied to the dst array, beginning at the position specified by\nsrcPosition and into the position specified by dstPosition. The number of\nelements to copy is determined by length. Note that copying values\noverwrites existing values in the destination array. To append values\ninstead of overwriting them, use <a href="#/p5/concat">concat()</a>.\n<br><br>\nThe simplified version with only two arguments, arrayCopy(src, dst),\ncopies an entire array to another of the same size. It is equivalent to\narrayCopy(src, 0, dst, 0, src.length).\n<br><br>\nUsing this function is far more efficient for copying array data than\niterating through a for() loop and copying each element individually.</p>\n',itemtype:"method",name:"arrayCopy",deprecated:!0,example:["\n<div class='norender'><code>\nvar src = ['A', 'B', 'C'];\nvar dst = [1, 2, 3];\nvar srcPosition = 1;\nvar dstPosition = 0;\nvar length = 2;\n\nprint(src); // ['A', 'B', 'C']\nprint(dst); // [ 1 ,  2 ,  3 ]\n\narrayCopy(src, srcPosition, dst, dstPosition, length);\nprint(dst); // ['B', 'C', 3]\n</code></div>"],class:"p5",module:"Data",submodule:"Array Functions",overloads:[{line:37,params:[{name:"src",description:"<p>the source Array</p>\n",type:"Array"},{name:"srcPosition",description:"<p>starting position in the source Array</p>\n",type:"Integer"},{name:"dst",description:"<p>the destination Array</p>\n",type:"Array"},{name:"dstPosition",description:"<p>starting position in the destination Array</p>\n",type:"Integer"},{name:"length",description:"<p>number of Array elements to be copied</p>\n",type:"Integer"}]},{line:75,params:[{name:"src",description:"",type:"Array"},{name:"dst",description:"",type:"Array"},{name:"length",description:"",type:"Integer",optional:!0}]}]},{file:"src/utilities/array_functions.js",line:114,description:"<p>Concatenates two arrays, maps to Array.concat(). Does not modify the\ninput arrays.</p>\n",itemtype:"method",name:"concat",deprecated:!0,deprecationMessage:'Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat">arr1.concat(arr2)</a> instead.',params:[{name:"a",description:"<p>first Array to concatenate</p>\n",type:"Array"},{name:"b",description:"<p>second Array to concatenate</p>\n",type:"Array"}],return:{description:"concatenated array",type:"Array"},example:["\n<div class = 'norender'><code>\nfunction setup() {\n  var arr1 = ['A', 'B', 'C'];\n  var arr2 = [1, 2, 3];\n\n  print(arr1); // ['A','B','C']\n  print(arr2); // [1,2,3]\n\n  var arr3 = concat(arr1, arr2);\n\n  print(arr1); // ['A','B','C']\n  print(arr2); // [1, 2, 3]\n  print(arr3); // ['A','B','C', 1, 2, 3]\n}\n</code></div>"],class:"p5",module:"Data",submodule:"Array Functions"},{file:"src/utilities/array_functions.js",line:145,description:"<p>Reverses the order of an array, maps to Array.reverse()</p>\n",itemtype:"method",name:"reverse",deprecated:!0,deprecationMessage:'Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reverse">array.reverse()</a> instead.',params:[{name:"list",description:"<p>Array to reverse</p>\n",type:"Array"}],return:{description:"the reversed list",type:"Array"},example:["\n<div class='norender'><code>\nfunction setup() {\n  var myArray = ['A', 'B', 'C'];\n  print(myArray); // ['A','B','C']\n\n  reverse(myArray);\n  print(myArray); // ['C','B','A']\n}\n</code></div>"],class:"p5",module:"Data",submodule:"Array Functions"},{file:"src/utilities/array_functions.js",line:167,description:"<p>Decreases an array by one element and returns the shortened array,\nmaps to Array.pop().</p>\n",itemtype:"method",name:"shorten",deprecated:!0,deprecationMessage:'Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/pop">array.pop()</a> instead.',params:[{name:"list",description:"<p>Array to shorten</p>\n",type:"Array"}],return:{description:"shortened Array",type:"Array"},example:["\n<div class = 'norender'><code>\nfunction setup() {\n  var myArray = ['A', 'B', 'C'];\n  print(myArray); // ['A', 'B', 'C']\n  var newArray = shorten(myArray);\n  print(myArray); // ['A','B','C']\n  print(newArray); // ['A','B']\n}\n</code></div>"],class:"p5",module:"Data",submodule:"Array Functions"},{file:"src/utilities/array_functions.js",line:191,description:"<p>Randomizes the order of the elements of an array. Implements\n<a href='http://Bost.Ocks.org/mike/shuffle/' target=_blank>
21\nFisher-Yates Shuffle Algorithm</a>.</p>\n",itemtype:"method",name:"shuffle",params:[{name:"array",description:"<p>Array to shuffle</p>\n",type:"Array"},{name:"bool",description:"<p>modify passed array</p>\n",type:"Boolean",optional:!0}],return:{description:"shuffled Array",type:"Array"},example:["\n<div><code>\nfunction setup() {\n  var regularArr = ['ABC', 'def', createVector(), TAU, Math.E];\n  print(regularArr);\n  shuffle(regularArr, true); // force modifications to passed array\n  print(regularArr);\n\n  // By default shuffle() returns a shuffled cloned array:\n  var newArr = shuffle(regularArr);\n  print(regularArr);\n  print(newArr);\n}\n</code></div>"],class:"p5",module:"Data",submodule:"Array Functions"},{file:"src/utilities/array_functions.js",line:233,description:"<p>Sorts an array of numbers from smallest to largest, or puts an array of\nwords in alphabetical order. The original array is not modified; a\nre-ordered array is returned. The count parameter states the number of\nelements to sort. For example, if there are 12 elements in an array and\ncount is set to 5, only the first 5 elements in the array will be sorted.</p>\n",itemtype:"method",name:"sort",deprecated:!0,deprecationMessage:'Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort">array.sort()</a> instead.',params:[{name:"list",description:"<p>Array to sort</p>\n",type:"Array"},{name:"count",description:"<p>number of elements to sort, starting from 0</p>\n",type:"Integer",optional:!0}],return:{description:"the sorted list",type:"Array"},example:["\n<div class = 'norender'><code>\nfunction setup() {\n  var words = ['banana', 'apple', 'pear', 'lime'];\n  print(words); // ['banana', 'apple', 'pear', 'lime']\n  var count = 4; // length of array\n\n  words = sort(words, count);\n  print(words); // ['apple', 'banana', 'lime', 'pear']\n}\n</code></div>\n<div class = 'norender'><code>\nfunction setup() {\n  var numbers = [2, 6, 1, 5, 14, 9, 8, 12];\n  print(numbers); // [2, 6, 1, 5, 14, 9, 8, 12]\n  var count = 5; // Less than the length of the array\n\n  numbers = sort(numbers, count);\n  print(numbers); // [1,2,5,6,14,9,8,12]\n}\n</code></div>"],class:"p5",module:"Data",submodule:"Array Functions"},{file:"src/utilities/array_functions.js",line:281,description:"<p>Inserts a value or an array of values into an existing array. The first\nparameter specifies the initial array to be modified, and the second\nparameter defines the data to be inserted. The third parameter is an index\nvalue which specifies the array position from which to insert data.\n(Remember that array index numbering starts at zero, so the first position\nis 0, the second position is 1, and so on.)</p>\n",itemtype:"method",name:"splice",deprecated:!0,deprecationMessage:'Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice">array.splice()</a> instead.',params:[{name:"list",description:"<p>Array to splice into</p>\n",type:"Array"},{name:"value",description:"<p>value to be spliced in</p>\n",type:"Any"},{name:"position",description:"<p>in the array from which to insert data</p>\n",type:"Integer"}],return:{description:"the list",type:"Array"},example:["\n<div class = 'norender'><code>\nfunction setup() {\n  var myArray = [0, 1, 2, 3, 4];\n  var insArray = ['A', 'B', 'C'];\n  print(myArray); // [0, 1, 2, 3, 4]\n  print(insArray); // ['A','B','C']\n\n  splice(myArray, insArray, 3);\n  print(myArray); // [0,1,2,'A','B','C',3,4]\n}\n</code></div>"],class:"p5",module:"Data",submodule:"Array Functions"},{file:"src/utilities/array_functions.js",line:316,description:"<p>Extracts an array of elements from an existing array. The list parameter\ndefines the array from which the elements will be copied, and the start\nand count parameters specify which elements to extract. If no count is\ngiven, elements will be extracted from the start to the end of the array.\nWhen specifying the start, remember that the first array element is 0.\nThis function does not change the source array.</p>\n",itemtype:"method",name:"subset",deprecated:!0,deprecationMessage:'Use <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice">array.slice()</a> instead.',params:[{name:"list",description:"<p>Array to extract from</p>\n",type:"Array"},{name:"start",description:"<p>position to begin</p>\n",type:"Integer"},{name:"count",description:"<p>number of values to extract</p>\n",type:"Integer",optional:!0}],return:{description:"Array of extracted elements",type:"Array"},example:["\n<div class = 'norender'><code>\nfunction setup() {\n  var myArray = [1, 2, 3, 4, 5];\n  print(myArray); // [1, 2, 3, 4, 5]\n\n  var sub1 = subset(myArray, 0, 3);\n  var sub2 = subset(myArray, 2, 2);\n  print(sub1); // [1,2,3]\n  print(sub2); // [3,4]\n}\n</code></div>"],class:"p5",module:"Data",submodule:"Array Functions"},{file:"src/utilities/conversion.js",line:12,description:"<p>Converts a string to its floating point representation. The contents of a\nstring must resemble a number, or NaN (not a number) will be returned.\nFor example, float(&quot;1234.56&quot;) evaluates to 1234.56, but float(&quot;giraffe&quot;)\nwill return NaN.</p>\n<p>When an array of values is passed in, then an array of floats of the same\nlength is returned.</p>\n",itemtype:"method",name:"float",params:[{name:"str",description:"<p>float string to parse</p>\n",type:"String"}
21],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>\n<div class='norender'><code>\nprint(float('10.31')); // 10.31\nprint(float('Infinity')); // Infinity\nprint(float('-Infinity')); // -Infinity\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:47,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"},example:["\n<div class='norender'><code>\nprint(int('10')); // 10\nprint(int(10.31)); // 10\nprint(int(-10)); // -10\nprint(int(true)); // 1\nprint(int(false)); // 0\nprint(int([false, true, '10.3', 9.8])); // [0, 1, 10, 9]\nprint(int(Infinity)); // Infinity\nprint(int('-Infinity')); // -Infinity\n</code></div>"],class:"p5",module:"Data",submodule:"Conversion",overloads:[{line:47,params:[{name:"n",description:"<p>value to parse</p>\n",type:"String|Boolean|Number"},{name:"radix",description:"<p>the radix to convert to (default: 10)</p>\n",type:"Integer",optional:!0}],return:{description:"integer representation of value",type:"Number"}},{line:69,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:93,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:119,description:"<p>Converts a number or string to its boolean representation.\nFor a number, any non-zero value (positive or negative) evaluates to true,\nwhile zero evaluates to false. For a string, the value &quot;true&quot; evaluates to\ntrue, while any other value evaluates to false. When an array of number or\nstring values is passed in, then a array of booleans of the same length is\nreturned.</p>\n",itemtype:"method",name:"boolean",params:[{name:"n",description:"<p>value to parse</p>\n",type:"String|Boolean|Number|Array"}],return:{description:"boolean representation of value",type:"Boolean"},example:["\n<div class='norender'><code>\nprint(boolean(0)); // false\nprint(boolean(1)); // true\nprint(boolean('true')); // true\nprint(boolean('abcd')); // false\nprint(boolean([0, 12, 'true'])); // [false, true, true]\n</code></div>"],class:"p5",module:"Data",submodule:"Conversion"},{file:"src/utilities/conversion.js",line:151,description:"<p>Converts a number, string representation of a number, or boolean to its byte\nrepresentation. A byte can be only a whole number between -128 and 127, so\nwhen a value outside of this range is converted, it wraps around to the\ncorresponding byte representation. When an array of number, string or boolean\nvalues is passed in, then an array of bytes the same length is returned.</p>\n",itemtype:"method",name:"byte",return:{description:"byte representation of value",type:"Number"},example:["\n<div class='norender'><code>\nprint(byte(127)); // 127\nprint(byte(128)); // -128\nprint(byte(23.4)); // 23\nprint(byte('23.4')); // 23\nprint(byte('hello')); // NaN\nprint(byte(true)); // 1\nprint(byte([0, 255, '100'])); // [0, -1, 100]\n</code></div>"],class:"p5",module:"Data",submodule:"Conversion",overloads:[{line:151,params:[{name:"n",description:"<p>value to parse</p>\n",type:"String|Boolean|Number"}],return:{description:"byte representation of value",type:"Number"}},{line:173,params:[{name:"ns",description:"<p>values to parse</p>\n",type:"Array"}],return:{description:"array of byte representation of values",type:"Number[]"}}]},{file:"src/utilities/conversion.js",line:187,description:"<p>Converts a number or string to its corresponding single-character\nstring representation. If a string parameter is provided, it is first\nparsed as an integer and then translated into a single-character string.\nWhen an array of number or string values is passed in, then an array of\nsingle-character strings of the same length is returned.</p>\n",itemtype:"method",name:"char",return:{description:"string representation of value",type:"String"},example:['\n<div class=\'norender\'><code>\nprint(char(65)); // "A"\nprint(char(\'65\')); // "A"\nprint(char([65, 66, 67])); // [ "A", "B", "C" ]\nprint(join(char([65, 66, 67]), \'\')); // "ABC"\n</code></div>'],class:"p5",module:"Data",submodule:"Conversion",overloads:[{line:187,params:[{name:"n",description:"<p>value to parse</p>\n",type:"String|Number"}],return:{description:"string representation of value",type:"String"}},{line:206,params:[{name:"ns",description:"<p>values to parse</p>\n",type:"Array"}
21],return:{description:"array of string representation of values",type:"String[]"}}]},{file:"src/utilities/conversion.js",line:221,description:"<p>Converts a single-character string to its corresponding integer\nrepresentation. When an array of single-character string values is passed\nin, then an array of integers of the same length is returned.</p>\n",itemtype:"method",name:"unchar",return:{description:"integer representation of value",type:"Number"},example:["\n<div class='norender'><code>\nprint(unchar('A')); // 65\nprint(unchar(['A', 'B', 'C'])); // [ 65, 66, 67 ]\nprint(unchar(split('ABC', ''))); // [ 65, 66, 67 ]\n</code></div>"],class:"p5",module:"Data",submodule:"Conversion",overloads:[{line:221,params:[{name:"n",description:"<p>value to parse</p>\n",type:"String"}],return:{description:"integer representation of value",type:"Number"}},{line:237,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:250,description:"<p>Converts a number to a string in its equivalent hexadecimal notation. If a\nsecond parameter is passed, it is used to set the number of characters to\ngenerate in the hexadecimal notation. When an array is passed in, an\narray of strings in hexadecimal notation of the same length is returned.</p>\n",itemtype:"method",name:"hex",return:{description:"hexadecimal string representation of value",type:"String"},example:['\n<div class=\'norender\'><code>\nprint(hex(255)); // "000000FF"\nprint(hex(255, 6)); // "0000FF"\nprint(hex([0, 127, 255], 6)); // [ "000000", "00007F", "0000FF" ]\nprint(Infinity); // "FFFFFFFF"\nprint(-Infinity); // "00000000"\n</code></div>'],class:"p5",module:"Data",submodule:"Conversion",overloads:[{line:250,params:[{name:"n",description:"<p>value to parse</p>\n",type:"Number"},{name:"digits",description:"",type:"Number",optional:!0}],return:{description:"hexadecimal string representation of value",type:"String"}},{line:270,params:[{name:"ns",description:"<p>array of values to parse</p>\n",type:"Number[]"},{name:"digits",description:"",type:"Number",optional:!0}],return:{description:"hexadecimal string representation of values",type:"String[]"}}]},{file:"src/utilities/conversion.js",line:302,description:"<p>Converts a string representation of a hexadecimal number to its equivalent\ninteger value. When an array of strings in hexadecimal notation is passed\nin, an array of integers of the same length is returned.</p>\n",itemtype:"method",name:"unhex",return:{description:"integer representation of hexadecimal value",type:"Number"},example:["\n<div class='norender'><code>\nprint(unhex('A')); // 10\nprint(unhex('FF')); // 255\nprint(unhex(['FF', 'AA', '00'])); // [ 255, 170, 0 ]\n</code></div>"],class:"p5",module:"Data",submodule:"Conversion",overloads:[{line:302,params:[{name:"n",description:"<p>value to parse</p>\n",type:"String"}],return:{description:"integer representation of hexadecimal value",type:"Number"}},{line:318,params:[{name:"ns",description:"<p>values to parse</p>\n",type:"Array"}],return:{description:"integer representations of hexadecimal value",type:"Number[]"}}]},{file:"src/utilities/string_functions.js",line:15,description:'<p>Combines an array of Strings into one String, each separated by the\ncharacter(s) used for the separator parameter. To join arrays of ints or\nfloats, it&#39;s necessary to first convert them to Strings using <a href="#/p5/nf">nf()</a> or\nnfs().</p>\n',itemtype:"method",name:"join",params:[{name:"list",description:"<p>array of Strings to be joined</p>\n",type:"Array"},{name:"separator",description:"<p>String to be placed between each item</p>\n",type:"String"}],return:{description:"joined String",type:"String"},example:["\n<div>\n<code>\nvar array = ['Hello', 'world!'];\nvar separator = ' ';\nvar message = join(array, separator);\ntext(message, 5, 50);\n</code>\n</div>"],alt:'"hello world!" displayed middle left of canvas.',class:"p5",module:"Data",submodule:"String Functions"},{file:"src/utilities/string_functions.js",line:44,description:"<p>This function is used to apply a regular expression to a piece of text,\nand return matching groups (elements found inside parentheses) as a\nString array. If there are no matches, a null value will be returned.\nIf no groups are specified in the regular expression, but the sequence\nmatches, an array of length 1 (with the matched text as the first element\nof the array) will be returned.\n<br><br>\nTo use the function, first check to see if the result is null. If the\nresult is null, then the sequence did not match at all. If the sequence\ndid match, an array is returned.\n<br><br>\nIf there are groups (specified by sets of parentheses) in the regular\nexpression, then the contents of each will be returned in the array.\nElement [0] of a regular expression match returns the entire matching\nstring, and the match groups start at element [1] (the first group is [1],\nthe second [2], and so on).</p>\n",itemtype:"method",name:"match",params:[{name:"str",description:"<p>the String to be searched</p>\n",type:"String"},{name:"regexp",description:"<p>the regexp to be used for matching</p>\n",type:"String"}],return:{description:"Array of Strings found",type:"String[]"},example:["\n<div>\n<code>\nvar string = 'Hello p5js*!';\nvar regexp = 'p5js\\\\*';\nvar m = match(string, regexp);\ntext(m, 5, 50);\n</code>\n</div>"],alt:'"p5js*" displayed middle left of canvas.',class:"p5",module:"Data",submodule:"String Functions"},{file:"src/utilities/string_functions.js",line:85,description:"<p>This function is used to apply a regular expression to a piece of text,\nand return a list of matching groups (elements found inside parentheses)\nas a two-dimensional Str
21ing array. If there are no matches, a null value\nwill be returned. If no groups are specified in the regular expression,\nbut the sequence matches, a two dimensional array is still returned, but\nthe second dimension is only of length one.\n<br><br>\nTo use the function, first check to see if the result is null. If the\nresult is null, then the sequence did not match at all. If the sequence\ndid match, a 2D array is returned.\n<br><br>\nIf there are groups (specified by sets of parentheses) in the regular\nexpression, then the contents of each will be returned in the array.\nAssuming a loop with counter variable i, element [i][0] of a regular\nexpression match returns the entire matching string, and the match groups\nstart at element [i][1] (the first group is [i][1], the second [i][2],\nand so on).</p>\n",itemtype:"method",name:"matchAll",params:[{name:"str",description:"<p>the String to be searched</p>\n",type:"String"},{name:"regexp",description:"<p>the regexp to be used for matching</p>\n",type:"String"}],return:{description:"2d Array of Strings found",type:"String[]"},example:["\n<div class=\"norender\">\n<code>\nvar string = 'Hello p5js*! Hello world!';\nvar regexp = 'Hello';\nmatchAll(string, regexp);\n</code>\n</div>"],class:"p5",module:"Data",submodule:"String Functions"},{file:"src/utilities/string_functions.js",line:132,description:"<p>Utility function for formatting numbers into strings. There are two\nversions: one for formatting floats, and one for formatting ints.\nThe values for the digits, left, and right parameters should always\nbe positive integers.\n(NOTE): Be cautious when using left and right parameters as it prepends numbers of 0&#39;s if the parameter\nif greater than the current length of the number.\nFor example if number is 123.2 and left parameter passed is 4 which is greater than length of 123\n(integer part) i.e 3 than result will be 0123.2. Same case for right parameter i.e. if right is 3 than\nthe result will be 123.200.</p>\n",itemtype:"method",name:"nf",return:{description:"formatted String",type:"String"},example:["\n<div>\n<code>\nvar myFont;\nfunction preload() {\n  myFont = loadFont('assets/fonts/inconsolata.ttf');\n}\nfunction setup() {\n  background(200);\n  var num1 = 321;\n  var num2 = -1321;\n\n  noStroke();\n  fill(0);\n  textFont(myFont);\n  textSize(22);\n\n  text(nf(num1, 4, 2), 10, 30);\n  text(nf(num2, 4, 2), 10, 80);\n  // Draw dividing line\n  stroke(120);\n  line(0, 50, width, 50);\n}\n</code>\n</div>"],alt:'"0321.00" middle top, -1321.00" middle bottom canvas',class:"p5",module:"Data",submodule:"String Functions",overloads:[{line:132,params:[{name:"num",description:"<p>the Number to format</p>\n",type:"Number|String"},{name:"left",description:"<p>number of digits to the left of the\n                               decimal point</p>\n",type:"Integer|String",optional:!0},{name:"right",description:"<p>number of digits to the right of the\n                               decimal point</p>\n",type:"Integer|String",optional:!0}],return:{description:"formatted String",type:"String"}},{line:180,params:[{name:"nums",description:"<p>the Numbers to format</p>\n",type:"Array"},{name:"left",description:"",type:"Integer|String",optional:!0},{name:"right",description:"",type:"Integer|String",optional:!0}],return:{description:"formatted Strings",type:"String[]"}}]},{file:"src/utilities/string_functions.js",line:243,description:"<p>Utility function for formatting numbers into strings and placing\nappropriate commas to mark units of 1000. There are two versions: one\nfor formatting ints, and one for formatting an array of ints. The value\nfor the right parameter should always be a positive integer.</p>\n",itemtype:"method",name:"nfc",return:{description:"formatted String",type:"String"},example:["\n<div>\n<code>\nfunction setup() {\n  background(200);\n  var num = 11253106.115;\n  var numArr = [1, 1, 2];\n\n  noStroke();\n  fill(0);\n  textSize(12);\n\n  // Draw formatted numbers\n  text(nfc(num, 4), 10, 30);\n  text(nfc(numArr, 2), 10, 80);\n\n  // Draw dividing line\n  stroke(120);\n  line(0, 50, width, 50);\n}\n</code>\n</div>"],alt:'"11,253,106.115" top middle and "1.00,1.00,2.00" displayed bottom mid',class:"p5",module:"Data",submodule:"String Functions",overloads:[{line:243,params:[{name:"num",description:"<p>the Number to format</p>\n",type:"Number|String"},{name:"right",description:"<p>number of digits to the right of the\n                                 decimal point</p>\n",type:"Integer|String",optional:!0}],return:{description:"formatted String",type:"String"}},{line:281,params:[{name:"nums",description:"<p>the Numbers to format</p>\n",type:"Array"},{name:"right",description:"",type:"Integer|String",optional:!0}],return:{description:"formatted Strings",type:"String[]"}}]},{file:"src/utilities/string_functions.js",line:319,description:'<p>Utility function for formatting numbers into strings. Similar to <a href="#/p5/nf">nf()</a> but\nputs a &quot;+&quot; in front of positive numbers and a &quot;-&quot; in front of negative\nnumbers. There are two versions: one for formatting floats, and one for\nformatting ints. The values for left, and right parameters\nshould always be positive integers.</p>\n',itemtype:"method",name:"nfp",return:{description:"formatted String",type:"String"},example:["\n<div>\n<code>\nfunction setup() {\n  background(200);\n  var num1 = 11253106.115;\n  var num2 = -11253106.115;\n\n  noStroke();\n  fill(0);\n  textSize(12);\n\n  // Draw formatted numbers\n  text(nfp(num1, 4, 2), 10, 30);\n  text(nfp(num2, 4, 2), 10, 80);\n\n  // Draw dividing line\n  stroke(120);\n  line(0, 50, width, 50);\n}\n</code>\n</div>"],alt:'"+11253106.11" top middle and "-11253106.11" displayed bottom middle',class:"p5",module:"Data",submodule:"String Functions",overloads:[{line:319,params:[{name:"num",description:"<p>the Number to format</p>\n",type:"Number"},{name:"left",description:"<p>number of digits to the left of the decimal\n                               point</p>\n",type:"Integer",optional:!0},{name:"right",description:"<p>number of digits to the right of the\n                               decimal point</p>\n",type:"Integer",optional:!0}],return:{description:"formatted String",type:"String"}},{line:360,params:[{name:"nums",description:"<p>the Numbers to format</p>\n",type:"Number[]"},{name:"left",description:"",type:"Integer",optional:!0},{name:"right",description:"",type:"Integer",optional:!0}],return:{description:"formatted Strings",type:"String[]"}}]},{file:"src/utilities/string_functions.js",line:381,description:'<p>Utility function for formatting numbers into strings. Similar to <a href="#/p5/nf">nf()</a> but\nputs an additional &quot;_&quot; (space) in front of positive numbers just in case to align it with negative\nnumbers which includes &quot;-&quot; (minus) sign.\nThe main usecase of nfs() can be seen when one wants to align the digits (place values) of a non-negative\nnumber with some negative number (See the example to get a clear picture).\nThere are two versions: one for formatting float, and one for formatting int.\nThe values for the digits, left, and right parameters should always be positive integers.\n(IMP): The result on the canvas basically the expected alignment can vary based on the typeface you are using.\n(NOTE): Be cautious when using left and right parameters as it prepends numbers of 0&#39;s if the parameter\nif greater than the current length of the number.\nFor example if number is 123.2 and left parameter passed is 4 which is greater than length of 123\n(integer part) i.e 3 than result will be 0123.2. Same case for right parameter i.e. if right is 3 than\nthe result will be 123.200.</p>\n',itemtype:"method",name:"nfs",return:{description:"formatted String",type:"String"},example:["\n<div>\n<code>\nvar myFont;\nfunction preload() {\n  myFont = loadFont('assets/fonts/inconsolata.ttf');\n}\nfunction setup() {\n  background(200);\n  var num1 = 321;\n  var num2 = -1321;\n\n  noStroke();\n  fill(0);\n  textFont(myFont);\n  textSize(22);
21\n\n  // nfs() aligns num1 (positive number) with num2 (negative number) by\n  // adding a blank space in front of the num1 (positive number)\n  // [left = 4] in num1 add one 0 in front, to align the digits with num2\n  // [right = 2] in num1 and num2 adds two 0's after both numbers\n  // To see the differences check the example of nf() too.\n  text(nfs(num1, 4, 2), 10, 30);\n  text(nfs(num2, 4, 2), 10, 80);\n  // Draw dividing line\n  stroke(120);\n  line(0, 50, width, 50);\n}\n</code>\n</div>"],alt:'"0321.00" top middle and "-1321.00" displayed bottom middle',class:"p5",module:"Data",submodule:"String Functions",overloads:[{line:381,params:[{name:"num",description:"<p>the Number to format</p>\n",type:"Number"},{name:"left",description:"<p>number of digits to the left of the decimal\n                               point</p>\n",type:"Integer",optional:!0},{name:"right",description:"<p>number of digits to the right of the\n                               decimal point</p>\n",type:"Integer",optional:!0}],return:{description:"formatted String",type:"String"}},{line:438,params:[{name:"nums",description:"<p>the Numbers to format</p>\n",type:"Array"},{name:"left",description:"",type:"Integer",optional:!0},{name:"right",description:"",type:"Integer",optional:!0}],return:{description:"formatted Strings",type:"String[]"}}]},{file:"src/utilities/string_functions.js",line:459,description:'<p>The <a href="#/p5/split">split()</a> function maps to String.split(), it breaks a String into\npieces using a character or string as the delimiter. The delim parameter\nspecifies the character or characters that mark the boundaries between\neach piece. A String[] array is returned that contains each of the pieces.</p>\n<p>The <a href="#/p5/splitTokens">splitTokens()</a> function works in a similar fashion, except that it\nsplits using a range of characters instead of a specific character or\nsequence.</p>\n',itemtype:"method",name:"split",params:[{name:"value",description:"<p>the String to be split</p>\n",type:"String"},{name:"delim",description:"<p>the String used to separate the data</p>\n",type:"String"}],return:{description:"Array of Strings",type:"String[]"},example:["\n<div>\n<code>\nvar names = 'Pat,Xio,Alex';\nvar splitString = split(names, ',');\ntext(splitString[0], 5, 30);\ntext(splitString[1], 5, 50);\ntext(splitString[2], 5, 70);\n</code>\n</div>"],alt:'"pat" top left, "Xio" mid left and "Alex" displayed bottom left',class:"p5",module:"Data",submodule:"String Functions"},{file:"src/utilities/string_functions.js",line:493,description:'<p>The <a href="#/p5/splitTokens">splitTokens()</a> function splits a String at one or many character\ndelimiters or &quot;tokens.&quot; The delim parameter specifies the character or\ncharacters to be used as a boundary.\n<br><br>\nIf no delim characters are specified, any whitespace character is used to\nsplit. Whitespace characters include tab (\\t), line feed (\\n), carriage\nreturn (\\r), form feed (\\f), and space.</p>\n',itemtype:"method",name:"splitTokens",params:[{name:"value",description:"<p>the String to be split</p>\n",type:"String"},{name:"delim",description:"<p>list of individual Strings that will be used as\n                         separators</p>\n",type:"String",optional:!0}],return:{description:"Array of Strings",type:"String[]"},example:['\n<div class = "norender">\n<code>\nfunction setup() {\n  var myStr = \'Mango, Banana, Lime\';\n  var myStrArr = splitTokens(myStr, \',\');\n\n  print(myStrArr); // prints : ["Mango"," Banana"," Lime"]\n}\n</code>\n</div>'],class:"p5",module:"Data",submodule:"String Functions"},{file:"src/utilities/string_functions.js",line:548,description:"<p>Removes whitespace characters from the beginning and end of a String. In\naddition to standard whitespace characters such as space, carriage return,\nand tab, this function also removes the Unicode &quot;nbsp&quot; character.</p>\n",itemtype:"method",name:"trim",return:{description:"a trimmed String",type:"String"},example:["\n<div>\n<code>\nvar string = trim('  No new lines\\n   ');\ntext(string + ' here', 2, 50);\n</code>\n</div>"],alt:'"No new lines here" displayed center canvas',class:"p5",module:"Data",submodule:"String Functions",overloads:[{line:548,params:[{name:"str",description:"<p>a String to be trimmed</p>\n",type:"String"}],return:{description:"a trimmed String",type:"String"}},{line:568,params:[{name:"strs",description:"<p>an Array of Strings to be trimmed</p>\n",type:"Array"}],return:{description:"an Array of trimmed Strings",type:"String[]"}}]},{file:"src/utilities/time_date.js",line:12,description:'<p>p5.js communicates with the clock on your computer. The <a href="#/p5/day">day()</a> function\nreturns the current day as a value from 1 - 31.</p>\n',itemtype:"method",name:"day",return:{description:"the current day",type:"Integer"},example:["\n<div>\n<code>\nvar d = day();\ntext('Current day: \\n' + d, 5, 50);\n</code>\n</div>"],alt:"Current day is displayed",class:"p5",module:"IO",submodule:"Time & Date"},{file:"src/utilities/time_date.js",line:34,description:'<p>p5.js communicates with the clock on your computer. The <a href="#/p5/hour">hour()</a> function\nreturns the current hour as a value from 0 - 23.</p>\n',itemtype:"method",name:"hour",return:{description:"the current hour",type:"Integer"},example:["\n<div>\n<code>\nvar h = hour();\ntext('Current hour:\\n' + h, 5, 50);\n</code>\n</div>"],alt:"Current hour is displayed",class:"p5",module:"IO",submodule:"Time & Date"},{file:"src/utilities/time_date.js",line:56,description:'<p>p5.js communicates with the clock on your computer. The <a href="#/p5/minute">minute()</a> function\nreturns the current minute as a value from 0 - 59.</p>\n',itemtype:"method",name:"minute",return:{description:"the current minute",type:"Integer"},example:["\n<div>\n<code>\nvar m = minute();\ntext('Current minute: \\n' + m, 5, 50);\n</code>\n</div>"],alt:"Current minute is displayed",class:"p5",module:"IO",submodule:"Time & Date"},{file:"src/utilities/time_date.js",line:78,description:"<p>Returns the number of milliseconds (thousandths of a second) since\nstarting the program. This information is often used for timing events and\nanimation sequences.</p>\n",itemtype:"method",name:"millis",return:{description:"the number of milliseconds since starting the program",type:"Number"},example:["\n<div>\n<code>\nvar millisecond = millis();\ntext('Milliseconds \\nrunning: \\n' + millisecond, 5, 40);\n</code>\n</div>"],alt:"number of milliseconds since program has started displayed",class:"p5",module:"IO",submodule:"Time & Date"},{file:"src/utilities/time_date.js",line:101,description:'<p>p5.js communicates with the clock on your computer. The <a href="#/p5/month">month()</a> function\nreturns the current month as a value from 1 - 12.</p>\n',itemtype:"method",name:"month",return:{description:"the current month",type:"Integer"},example:["\n<div>\n<code>\nvar m = month();\ntext('Current month: \\n' + m, 5, 50);\n</code>\n</div>"],alt:"Current month is displayed",class:"p5",module:"IO",submodule:"Time & Date"}
21,{file:"src/utilities/time_date.js",line:123,description:'<p>p5.js communicates with the clock on your computer. The <a href="#/p5/second">second()</a> function\nreturns the current second as a value from 0 - 59.</p>\n',itemtype:"method",name:"second",return:{description:"the current second",type:"Integer"},example:["\n<div>\n<code>\nvar s = second();\ntext('Current second: \\n' + s, 5, 50);\n</code>\n</div>"],alt:"Current second is displayed",class:"p5",module:"IO",submodule:"Time & Date"},{file:"src/utilities/time_date.js",line:145,description:'<p>p5.js communicates with the clock on your computer. The <a href="#/p5/year">year()</a> function\nreturns the current year as an integer (2014, 2015, 2016, etc).</p>\n',itemtype:"method",name:"year",return:{description:"the current year",type:"Integer"},example:["\n<div>\n<code>\nvar y = year();\ntext('Current year: \\n' + y, 5, 50);\n</code>\n</div>"],alt:"Current year is displayed",class:"p5",module:"IO",submodule:"Time & Date"},{file:"src/webgl/3d_primitives.js",line:14,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",optional:!0},{name:"height",description:"<p>height of the plane</p>\n",type:"Number",optional:!0},{name:"detailX",description:"<p>Optional number of triangle\n                            subdivisions in x-dimension</p>\n",type:"Integer",optional:!0},{name:"detailY",description:"<p>Optional number of triangle\n                            subdivisions in y-dimension</p>\n",type:"Integer",optional:!0}],chainable:1,example:["\n<div>\n<code>\n// draw a plane\n// with width 50 and height 50\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/3d_primitives.js",line:98,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",optional:!0},{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:"Integer",optional:!0},{name:"detailY",description:"<p>Optional number of triangle\n                           subdivisions in y-dimension</p>\n",type:"Integer",optional:!0}],chainable:1,example:["\n<div>\n<code>\n// draw a spinning box\n// with width, height and depth of 50\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(50);\n}\n</code>\n</div>"],class:"p5",module:"Shape",submodule:"3D Primitives"},{file:"src/webgl/3d_primitives.js",line:216,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",optional:!0},{name:"detailX",description:"<p>number of segments,\n                                   the more segments the smoother geometry\n                                   default is 24</p>\n",type:"Integer",optional:!0},{name:"detailY",description:"<p>number of segments,\n                                   the more segments the smoother geometry\n                                   default is 16</p>\n",type:"Integer",optional:!0}],chainable:1,example:["\n<div>\n<code>\n// draw a sphere with radius 40\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n  background(200);\n  sphere(40);\n}\n</code>\n</div>"],class:"p5",module:"Shape",submodule:"3D Primitives"},{file:"src/webgl/3d_primitives.js",line:378,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",optional:!0},{name:"height",description:"<p>height of the cylinder</p>\n",type:"Number",optional:!0},{name:"detailX",description:"<p>number of segments,\n                              the more segments the smoother geometry\n                              default is 24</p>\n",type:"Integer",optional:!0},{name:"detailY",description:"<p>number of segments in y-dimension,\n                              the more segments the smoother geometry\n                              default is 1</p>\n",type:"Integer",optional:!0},{name:"bottomCap",description:"<p>whether to draw the bottom of the cylinder</p>\n",type:"Boolean",optional:!0},{name:"topCap",description:"<p>whether to draw the top of the cylinder</p>\n",type:"Boolean",optional:!0}],chainable:1,example:["\n<div>\n<code>\n// draw a spinning cylinder\n// with radius 20 and height 50\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n  background(200);\n  rotateX(frameCount * 0.01);\n  rotateZ(frameCount * 0.01);\n  cylinder(20, 50);\n}\n</code>\n</div>"],class:"p5",module:"Shape",submodule:"3D Primitives"},{file:"src/webgl/3d_primitives.js",line:470,description:"<p>Draw a cone with given radius and height</p>\n",itemtype:"method",name:"cone",params:[{name:"radius",description:"<p>radius of the bottom surface</p>\n",type:"Number",optional:!0},{name:"height",description:"<p>height of the cone</p>\n",type:"Number",optional:!0},{name:"detailX",description:"<p>number of segments,\n                            the more segments the smoother geometry\n                            default is 24</p>\n",type:"Integer",optional:!0},{name:"detailY",description:"<p>number of segments,\n                            the more segments the smoother geometry\n                            default is 1</p>\n",type:"Integer",optional:!0},{name:"cap",description:"<p>whether to draw the base of the cone</p>\n",type:"Boolean",optional:!0}],chainable:1,example:["\n<div>\n<code>\n// draw a spinning cone\n// with radius 40 and height 70\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n  background(200);\n  rotateX(frameCount * 0.01);\n  rotateZ(frameCount * 0.01);\n  cone(40, 70);\n}\n</code>\n</div>"],class:"p5",module:"Shape",submodule:"3D Primitives"},{file:"src/webgl/3d_primitives.js",line:540,description:"<p>Draw an ellipsoid with given radius</p>\n",itemtype:"method",name:"ellipsoid",params:[{name:"radiusx",description:"<p>x-radius of ellipsoid</p>\n",type:"Number",optional:!0},{name:"radiusy",description:"<p>y-radius of ellipsoid</p>\n",type:"Number",optional:!0},{name:"radiusz",description:"<p>z-radius of ellipsoid</p>\n",type:"Number",optional:!0},{name:"detailX",description:"<p>number of segments,\n                                   the more segments the smoother geometry\n                                   default is 24. Avoid detail number above\n                                   150, it may crash the browser.</p>\n",type:"Integer",optional:!0},{name:"detailY",description:"<p>number of segments,\n                                   the more segments the smoother geometry\n                                   default is 16. Avoid detail number above\n                                   150, it may crash the browser.</p>\n",type:"Integer",optional:!0}],chainable:1,example:["\n<div>\n<code>\n// draw an ellipsoid\n// with radius 30, 40 and 40.\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n  background(200);\n  ellipsoid(30, 40, 40);\n}\n</code>\n</div>"],class:"p5",module:"Shape",submodule:"3D Primitives"},{file:"src/webgl/3d_primitives.js",line:631,description:"<p>Draw a torus with given radius and tube radius</p>\n",itemtype:"method",name:"torus",params:[{name:"radius",description:"<p>radius of the whole ring</p>\n",type:"Number",optional:!0},{name:"tubeRadius",description:"<p>radius of the tube</p>\n",type:"Number",optional:!0},{name:"detailX",description:"<p>number of segments in x-dimension,\n                               the more segments the smoother geometry\n                               default is 24</p>\n",type:"Integer",optional:!0},{name:"detailY",description:"<p>number of segments in y-dimension,\n                               the more segments the smoother geometry\n                               default is 16</p>\n",type:"Integer",optional:!0}],chainable:1,example:["\n<div>\n<code>\n// draw a spinning torus\n// with ring radius 30 and tube radius 15\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n  background(200);\n  rotateX(frameCount * 0.01);\n  rotateY(frameCount * 0.01);\n  torus(30, 15);\n}\n</code>\n</div>"],class:"p5",module:"Shape",submodule:"3D Primitives"},{file:"src/webgl/interaction.js",line:13,description:"<p>Allows movement around a 3D sketch using a mouse or trackpad.  Left-clicking\nand dragging will rotate the camera position about the center of the sketch,\nright-clicking and dragging will pan the camera position without rotation,\nand using the mouse wheel (scrolling) will move the camera closer or further\nfrom the center of the sketch. This function can be called with parameters\ndictating sensitivity to mouse movement along the X and Y axes.  Calling\nthis function without parameters is equivalent to calling orbitControl(1,1).\nTo reverse direction of movement in either axis, enter a negative number\nfor sensitivity.</p>\n",itemtype:"method",name:"orbitControl",params:[{name:"sensitivityX",description:"<p>sensitivity to mouse movement along X axis</p>\n",type:"Number",optional:!0},{name:"sensitivityY",description:"<p>sensitivity to mouse movement along Y axis</p>\n",type:"Number",optional:!0}],chainable:1,example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  normalMaterial();\n}\nfunction draw() {\n  background(200);\n  orbitControl();\n  rotateY(0.5);\n  box(30, 50);\n}\n</code>\n</div>"],alt:"Camera orbits around a box when mouse is hold-clicked & then moved.",class:"p5",module:"Lights, Camera",submodule:"Interaction"},{file:"src/webgl/interaction.js",line:146,description:"<p>debugMode() helps visualize 3D space by adding a grid to indicate where the\n‘ground’ is in a sketch and an axes icon which indicates the +X, +Y, and +Z\ndirections. This function can be called without parameters to create a\ndefault grid and axes icon, or it can be called according to the examples\nabove to customize the size and position of the grid and/or axes icon.  The\ngrid is drawn using the most recently set stroke color and weight.  To\nspecify these parameters, add a call to stroke() and strokeWeight(
21)\njust before the end of the draw() loop.</p>\n<p>By default, the grid will run through the origin (0,0,0) of the sketch\nalong the XZ plane\nand the axes icon will be offset from the origin.  Both the grid and axes\nicon will be sized according to the current canvas size.  Note that because the\ngrid runs parallel to the default camera view, it is often helpful to use\ndebugMode along with orbitControl to allow full view of the grid.</p>\n",itemtype:"method",name:"debugMode",example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  camera(0, -30, 100, 0, 0, 0, 0, 1, 0);\n  normalMaterial();\n  debugMode();\n}\n\nfunction draw() {\n  background(200);\n  orbitControl();\n  box(15, 30);\n  // Press the spacebar to turn debugMode off!\n  if (keyIsDown(32)) {\n    noDebugMode();\n  }\n}\n</code>\n</div>","\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  camera(0, -30, 100, 0, 0, 0, 0, 1, 0);\n  normalMaterial();\n  debugMode(GRID);\n}\n\nfunction draw() {\n  background(200);\n  orbitControl();\n  box(15, 30);\n}\n</code>\n</div>","\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  camera(0, -30, 100, 0, 0, 0, 0, 1, 0);\n  normalMaterial();\n  debugMode(AXES);\n}\n\nfunction draw() {\n  background(200);\n  orbitControl();\n  box(15, 30);\n}\n</code>\n</div>","\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  camera(0, -30, 100, 0, 0, 0, 0, 1, 0);\n  normalMaterial();\n  debugMode(GRID, 100, 10, 0, 0, 0);\n}\n\nfunction draw() {\n  background(200);\n  orbitControl();\n  box(15, 30);\n}\n</code>\n</div>","\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  camera(0, -30, 100, 0, 0, 0, 0, 1, 0);\n  normalMaterial();\n  debugMode(100, 10, 0, 0, 0, 20, 0, -40, 0);\n}\n\nfunction draw() {\n  noStroke();\n  background(200);\n  orbitControl();\n  box(15, 30);\n  // set the stroke color and weight for the grid!\n  stroke(255, 0, 150);\n  strokeWeight(0.8);\n}\n</code>\n</div>"],alt:"a 3D box is centered on a grid in a 3D sketch. an icon\nindicates the direction of each axis: a red line points +X,\na green line +Y, and a blue line +Z.",class:"p5",module:"Lights, Camera",submodule:"Interaction",overloads:[{line:146,params:[]},{line:279,params:[{name:"mode",description:"<p>either GRID or AXES</p>\n",type:"Constant"}]},{line:284,params:[{name:"mode",description:"",type:"Constant"},{name:"gridSize",description:"<p>size of one side of the grid</p>\n",type:"Number",optional:!0},{name:"gridDivisions",description:"<p>number of divisions in the grid</p>\n",type:"Number",optional:!0},{name:"xOff",description:"<p>X axis offset from origin (0,0,0)</p>\n",type:"Number",optional:!0},{name:"yOff",description:"<p>Y axis offset from origin (0,0,0)</p>\n",type:"Number",optional:!0},{name:"zOff",description:"<p>Z axis offset from origin (0,0,0)</p>\n",type:"Number",optional:!0}]},{line:294,params:[{name:"mode",description:"",type:"Constant"},{name:"axesSize",description:"<p>size of axes icon</p>\n",type:"Number",optional:!0},{name:"xOff",description:"",type:"Number",optional:!0},{name:"yOff",description:"",type:"Number",optional:!0},{name:"zOff",description:"",type:"Number",optional:!0}]},{line:303,params:[{name:"gridSize",description:"",type:"Number",optional:!0},{name:"gridDivisions",description:"",type:"Number",optional:!0},{name:"gridXOff",description:"",type:"Number",optional:!0},{name:"gridYOff",description:"",type:"Number",optional:!0},{name:"gridZOff",description:"",type:"Number",optional:!0},{name:"axesSize",description:"",type:"Number",optional:!0},{name:"axesXOff",description:"",type:"Number",optional:!0},{name:"axesYOff",description:"",type:"Number",optional:!0},{name:"axesZOff",description:"",type:"Number",optional:!0}]}]},{file:"src/webgl/interaction.js",line:380,description:"<p>Turns off debugMode() in a 3D sketch.</p>\n",itemtype:"method",name:"noDebugMode",example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  camera(0, -30, 100, 0, 0, 0, 0, 1, 0);\n  normalMaterial();\n  debugMode();\n}\n\nfunction draw() {\n  background(200);\n  orbitControl();\n  box(15, 30);\n  // Press the spacebar to turn debugMode off!\n  if (keyIsDown(32)) {\n    noDebugMode();\n  }\n}\n</code>\n</div>"],alt:"a 3D box is centered on a grid in a 3D sketch. an icon\nindicates the direction of each axis: a red line points +X,\na green line +Y, and a blue line +Z. the grid and icon disappear when the\nspacebar is pressed.",class:"p5",module:"Lights, Camera",submodule:"Interaction"},{file:"src/webgl/light.js",line:12,description:"<p>Creates an ambient light with a color</p>\n",itemtype:"method",name:"ambientLight",chainable:1,example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\nfunction draw() {\n  background(0);\n  ambientLight(150);\n  ambientMaterial(250);\n  noStroke();\n  sphere(40);\n}\n</code>\n</div>"],alt:"evenly distributed light across a sphere",class:"p5",module:"Lights, Camera",submodule:"Lights",overloads:[{line:12,params:[{name:"v1",description:"<p>red or hue value relative to\n                                the current color range</p>\n",type:"Number"},{name:"v2",description:"<p>
21green or saturation value\n                                relative to the current color range</p>\n",type:"Number"},{name:"v3",description:"<p>blue or brightness value\n                                relative to the current color range</p>\n",type:"Number"},{name:"alpha",description:"<p>the alpha value</p>\n",type:"Number",optional:!0}],chainable:1},{line:46,params:[{name:"value",description:"<p>a color string</p>\n",type:"String"}],chainable:1},{line:52,params:[{name:"gray",description:"<p>a gray value</p>\n",type:"Number"},{name:"alpha",description:"",type:"Number",optional:!0}],chainable:1},{line:59,params:[{name:"values",description:"<p>an array containing the red,green,blue &amp;\n                                and alpha components of the color</p>\n",type:"Number[]"}],chainable:1},{line:66,params:[{name:"color",description:"<p>the ambient light color</p>\n",type:"p5.Color"}],chainable:1}]},{file:"src/webgl/light.js",line:87,description:"<p>Creates a directional light with a color and a direction</p>\n",itemtype:"method",name:"directionalLight",chainable:1,example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\nfunction draw() {\n  background(0);\n  //move your mouse to change light direction\n  let dirX = (mouseX / width - 0.5) * 2;\n  let dirY = (mouseY / height - 0.5) * 2;\n  directionalLight(250, 250, 250, -dirX, -dirY, -1);\n  noStroke();\n  sphere(40);\n}\n</code>\n</div>"],alt:"light source on canvas changeable with mouse position",class:"p5",module:"Lights, Camera",submodule:"Lights",overloads:[{line:87,params:[{name:"v1",description:"<p>red or hue value (depending on the current\ncolor mode),</p>\n",type:"Number"},{name:"v2",description:"<p>green or saturation value</p>\n",type:"Number"},{name:"v3",description:"<p>blue or brightness value</p>\n",type:"Number"},{name:"position",description:"<p>the direction of the light</p>\n",type:"p5.Vector"}],chainable:1},{line:119,params:[{name:"color",description:'<p>color Array, CSS color string,\n                                            or <a href="#/p5.Color">p5.Color</a> value</p>\n',type:"Number[]|String|p5.Color"},{name:"x",description:"<p>x axis direction</p>\n",type:"Number"},{name:"y",description:"<p>y axis direction</p>\n",type:"Number"},{name:"z",description:"<p>z axis direction</p>\n",type:"Number"}],chainable:1},{line:129,params:[{name:"color",description:"",type:"Number[]|String|p5.Color"},{name:"position",description:"",type:"p5.Vector"}],chainable:1},{line:136,params:[{name:"v1",description:"",type:"Number"},{name:"v2",description:"",type:"Number"},{name:"v3",description:"",type:"Number"},{name:"x",description:"",type:"Number"},{name:"y",description:"",type:"Number"},{name:"z",description:"",type:"Number"}],chainable:1}]},{file:"src/webgl/light.js",line:185,description:"<p>Creates a point light with a color and a light position</p>\n",itemtype:"method",name:"pointLight",chainable:1,example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\nfunction draw() {\n  background(0);\n  //move your mouse to change light position\n  let locX = mouseX - width / 2;\n  let locY = mouseY - height / 2;\n  // to set the light position,\n  // think of the world's coordinate as:\n  // -width/2,-height/2 -------- width/2,-height/2\n  //                |            |\n  //                |     0,0    |\n  //                |            |\n  // -width/2,height/2--------width/2,height/2\n  pointLight(250, 250, 250, locX, locY, 50);\n  noStroke();\n  sphere(40);\n}\n</code>\n</div>"],alt:"spot light on canvas changes position with mouse",class:"p5",module:"Lights, Camera",submodule:"Lights",overloads:[{line:185,params:[{name:"v1",description:"<p>red or hue value (depending on the current\ncolor mode),</p>\n",type:"Number"},{name:"v2",description:"<p>green or saturation value</p>\n",type:"Number"},{name:"v3",description:"<p>blue or brightness value</p>\n",type:"Number"},{name:"x",description:"<p>x axis position</p>\n",type:"Number"},{name:"y",description:"<p>y axis position</p>\n",type:"Number"},{name:"z",description:"<p>z axis position</p>\n",type:"Number"}],chainable:1},{line:226,params:[{name:"v1",description:"",type:"Number"},{name:"v2",description:"",type:"Number"},{name:"v3",description:"",type:"Number"},{name:"position",description:"<p>the position of the light</p>\n",type:"p5.Vector"}],chainable:1},{line:235,params:[{name:"color",description:'<p>color Array, CSS color string,\nor <a href="#/p5.Color">p5.Color</a> value</p>\n',type:"Number[]|String|p5.Color"},{name:"x",description:"",type:"Number"},{name:"y",description:"",type:"Number"},{name:"z",description:"",type:"Number"}],chainable:1},{line:245,params:[{name:"color",description:"",type:"Number[]|String|p5.Color"},{name:"position",description:"",type:"p5.Vector"}],chainable:1}]},{file:"src/webgl/light.js",line:287,description:'<p>Sets the default ambient and directional light. The defaults are <a href="#/p5/ambientLight">ambientLight(128, 128, 128)</a> and <a href="#/p5/directionalLight">directionalLight(128, 128, 128, 0, 0, -1)</a>. Lights need to be included in the <a href="#/p5/draw">draw()</a> to remain persistent in a looping program. Placing them in the <a href="#/p5/setup">setup()</a> of a looping program will cause them to only have an effect the first time through the loop.</p>\n',itemtype:"method",name:"lights",chainable:1,example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\nfunction draw() {\n  background(0);\n  lights();\n  rotateX(millis() / 1000);\n  rotateY(millis() / 1000);\n  rotateZ(millis() / 1000);\n  box();\n}\n</code>\n</div>"],alt:"the light is partially ambient and partially directional",class:"p5",module:"Lights, Camera",submodule:"Lights"},{file:"src/webgl/light.js",line:318,description:"<p>Sets the falloff rates for point lights. It affects only the elements which are created after it in the code.\nThe default value is lightFalloff(1.0, 0.0, 0.0), and the parameters are used to calculate the falloff with the following equation:</p>\n<p>d = distance from light position to vertex position</p>\n<p>falloff = 1 / (CONSTANT + d * LINEAR + ( d * d ) * QUADRATIC)</p>\n",itemtype:"method",name:"lightFalloff",params:[{name:"constant",description:"<p>constant value for determining falloff</p>\n",type:"Number"},{name:"linear",description:"<p>linear value for determining falloff</p>\n",type:"Number"},{name:"quadratic",description:"<p>quadratic value for determining falloff</p>\n",type:"Number"}],chainable:1,example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  noStroke();\n}\nfunction draw() {\n  background(0);\n  let locX = mouseX - width / 2;
21\n  let locY = mouseY - height / 2;\n  translate(-25, 0, 0);\n  lightFalloff(1, 0, 0);\n  pointLight(250, 250, 250, locX, locY, 50);\n  sphere(20);\n  translate(50, 0, 0);\n  lightFalloff(0.9, 0.01, 0);\n  pointLight(250, 250, 250, locX, locY, 50);\n  sphere(20);\n}\n</code>\n</div>"],alt:"Two spheres with different falloff values show different intensity of light",class:"p5",module:"Lights, Camera",submodule:"Lights"},{file:"src/webgl/loading.js",line:14,description:'<p>Load a 3d model from an OBJ or STL file.\n<br><br>\nOne of the limitations of the OBJ and STL format is that it doesn&#39;t have a built-in\nsense of scale. This means that models exported from different programs might\nbe very different sizes. If your model isn&#39;t displaying, try calling\n<a href="#/p5/loadModel">loadModel()</a> with the normalized parameter set to true. This will resize the\nmodel to a scale appropriate for p5. You can also make additional changes to\nthe final size of your model with the <a href="#/p5/scale">scale()</a> function.</p>\n<p>Also, the support for colored STL files is not present. STL files with color will be\nrendered without color properties.</p>\n',itemtype:"method",name:"loadModel",return:{description:'the <a href="#/p5.Geometry">p5.Geometry</a> object',type:"p5.Geometry"},example:["\n<div>\n<code>\n//draw a spinning octahedron\nlet octahedron;\n\nfunction preload() {\n  octahedron = loadModel('assets/octahedron.obj');\n}\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n  background(200);\n  rotateX(frameCount * 0.01);\n  rotateY(frameCount * 0.01);\n  model(octahedron);\n}\n</code>\n</div>","\n<div>\n<code>\n//draw a spinning teapot\nlet teapot;\n\nfunction preload() {\n  // Load model with normalise parameter set to true\n  teapot = loadModel('assets/teapot.obj', true);\n}\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n  background(200);\n  scale(0.4); // Scaled to make model fit into canvas\n  rotateX(frameCount * 0.01);\n  rotateY(frameCount * 0.01);\n  normalMaterial(); // For effect\n  model(teapot);\n}\n</code>\n</div>"],alt:"Vertically rotating 3-d teapot with red, green and blue gradient.",class:"p5",module:"Shape",submodule:"3D Models",overloads:[{line:14,params:[{name:"path",description:"<p>Path of the model to be loaded</p>\n",type:"String"},{name:"normalize",description:"<p>If true, scale the model to a\n                                     standardized size when loading</p>\n",type:"Boolean"},{name:"successCallback",description:"<p>Function to be called\n                                    once the model is loaded. Will be passed\n                                    the 3D model object.</p>\n",type:"function(p5.Geometry)",optional:!0},{name:"failureCallback",description:"<p>called with event error if\n                                        the model fails to load.</p>\n",type:"Function(Event)",optional:!0}],return:{description:'the <a href="#/p5.Geometry">p5.Geometry</a> object',type:"p5.Geometry"}},{line:93,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 <a href="#/p5.Geometry">p5.Geometry</a> object',type:"p5.Geometry"}}]},{file:"src/webgl/loading.js",line:169,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:278,description:"<p>STL files can be of two types, ASCII and Binary,</p>\n<p>We need to convert the arrayBuffer to an array of strings,\nto parse it as an ASCII file.</p>\n",class:"p5",module:"Shape",submodule:"3D Models"},{file:"src/webgl/loading.js",line:305,description:'<p>This function checks if the file is in ASCII format or in Binary format</p>\n<p>It is done by searching keyword <code>solid</code> at the start of the file.</p>\n<p>An ASCII STL data must begin with <code>solid</code>
21 as the first six bytes.\nHowever, ASCII STLs lacking the SPACE after the <code>d</code> are known to be\nplentiful. So, check the first 5 bytes for <code>solid</code>.</p>\n<p>Several encodings, such as UTF-8, precede the text with up to 5 bytes:\n<a href="https://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding">https://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding</a>\nSearch for <code>solid</code> to start anywhere after those prefixes.</p>\n',class:"p5",module:"Shape",submodule:"3D Models"},{file:"src/webgl/loading.js",line:332,description:"<p>This function matches the <code>query</code> at the provided <code>offset</code></p>\n",class:"p5",module:"Shape",submodule:"3D Models"},{file:"src/webgl/loading.js",line:344,description:'<p>This function parses the Binary STL files.\n<a href="https://en.wikipedia.org/wiki/STL_%28file_format%29#Binary_STL">https://en.wikipedia.org/wiki/STL_%28file_format%29#Binary_STL</a></p>\n<p>Currently there is no support for the colors provided in STL files.</p>\n',class:"p5",module:"Shape",submodule:"3D Models"},{file:"src/webgl/loading.js",line:433,description:"<p>ASCII STL file starts with <code>solid &#39;nameOfFile&#39;</code>\nThen contain the normal of the face, starting with <code>facet normal</code>\nNext contain a keyword indicating the start of face vertex, <code>outer loop</code>\nNext comes the three vertex, starting with <code>vertex x y z</code>\nVertices ends with <code>endloop</code>\nFace ends with <code>endfacet</code>\nNext face starts with <code>facet normal</code>\nThe end of the file is indicated by <code>endsolid</code></p>\n",class:"p5",module:"Shape",submodule:"3D Models"},{file:"src/webgl/loading.js",line:580,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 octahedron\nlet octahedron;\n\nfunction preload() {\n  octahedron = loadModel('assets/octahedron.obj');\n}\n\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  model(octahedron);\n}\n</code>\n</div>"],alt:"Vertically rotating 3-d octahedron.",class:"p5",module:"Shape",submodule:"3D Models"},{file:"src/webgl/material.js",line:14,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 <a href="#/p5/preload">preload()</a>.</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"},{name:"fragFilename",description:"<p>path to file containing fragment shader\nsource code</p>\n",type:"String"},{name:"callback",description:"<p>callback to be executed after loadShader\ncompletes. On success, the Shader object is passed as the first argument.</p>\n",type:"Function",optional:!0},{name:"errorCallback",description:"<p>callback to be executed when an error\noccurs inside loadShader. On error, the error is passed as the first\nargument.</p>\n",type:"Function",optional:!0}],return:{description:"a shader object created from the provided\nvertex and fragment shader files.",type:"p5.Shader"},example:["\n<div modernizr='webgl'>\n<code>\nlet mandel;\nfunction preload() {\n  // load the shader definitions from files\n  mandel = loadShader('assets/shader.vert', 'assets/shader.frag');\n}\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  // use the shader\n  shader(mandel);\n  noStroke();\n  mandel.setUniform('p', [-0.74364388703, 0.13182590421]);\n}\n\nfunction draw() {\n  mandel.setUniform('r', 1.5 * exp(-6.5 * (1 + sin(millis() / 2000))));\n  quad(-1, -1, 1, -1, 1, 1, -1, 1);\n}\n</code>\n</div>"],alt:"zooming Mandelbrot set. a colorful, infinitely detailed fractal.",class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/material.js",line:113,itemtype:"method",name:"createShader",params:[{name:"vertSrc",description:"<p>source code for the vertex shader</p>\n",type:"String"},{name:"fragSrc",description:"<p>source code for the fragment shader</p>\n",type:"String"}],return:{description:"a shader object created from the provided\nvertex and fragment shaders.",type:"p5.Shader"},example:["\n<div modernizr='webgl'>\n<code>\n// the 'varying's are shared between both vertex & fragment shaders\nlet varying = 'precision highp float; varying vec2 vPos;';\n\n// the vertex shader is called for each vertex\nlet vs =\n  varying +\n  'attribute vec3 aPosition;' +\n  'void main() { vPos = (gl_Position = vec4(aPosition,1.0)).xy; }';\n\n// the fragment shader is called for each pixel\nlet fs =\n  varying +\n  'uniform vec2 p;' +\n  'uniform float r;' +\n  'const int I = 500;' +\n  'void main() {' +\n  '  vec2 c = p + vPos * r, z = c;' +\n  '  float n = 0.0;' +\n  '  for (int i = I; i > 0; i --) {' +\n  '    if(z.x*z.x+z.y*z.y > 4.0) {' +\n  '      n = float(i)/float(I);' +\n  '      break;' +\n  '    }' +\n  '    z = vec2(z.x*z.x-z.y*z.y, 2.0*z.x*z.y) + c;' +\n  '  }
21' +\n  '  gl_FragColor = vec4(0.5-cos(n*17.0)/2.0,0.5-cos(n*13.0)/2.0,0.5-cos(n*23.0)/2.0,1.0);' +\n  '}';\n\nlet mandel;\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n\n  // create and initialize the shader\n  mandel = createShader(vs, fs);\n  shader(mandel);\n  noStroke();\n\n  // 'p' is the center point of the Mandelbrot image\n  mandel.setUniform('p', [-0.74364388703, 0.13182590421]);\n}\n\nfunction draw() {\n  // 'r' is the size of the image in Mandelbrot-space\n  mandel.setUniform('r', 1.5 * exp(-6.5 * (1 + sin(millis() / 2000))));\n  quad(-1, -1, 1, -1, 1, 1, -1, 1);\n}\n</code>\n</div>"],alt:"zooming Mandelbrot set. a colorful, infinitely detailed fractal.",class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/material.js",line:181,description:'<p>The <a href="#/p5/shader">shader()</a> 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\n<a href="#/p5/loadShader">loadShader()</a>.</p>\n',itemtype:"method",name:"shader",chainable:1,params:[{name:"s",description:'<p>the desired <a href="#/p5.Shader">p5.Shader</a> to use for rendering\nshapes.</p>\n',type:"p5.Shader",optional:!0}],example:["\n<div modernizr='webgl'>\n<code>\n// Click within the image to toggle\n// the shader used by the quad shape\n// Note: for an alternative approach to the same example,\n// involving changing uniforms please refer to:\n// https://p5js.org/reference/#/p5.Shader/setUniform\n\nlet redGreen;\nlet orangeBlue;\nlet showRedGreen = false;\n\nfunction preload() {\n  // note that we are using two instances\n  // of the same vertex and fragment shaders\n  redGreen = loadShader('assets/shader.vert', 'assets/shader-gradient.frag');\n  orangeBlue = loadShader('assets/shader.vert', 'assets/shader-gradient.frag');\n}\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n\n  // initialize the colors for redGreen shader\n  shader(redGreen);\n  redGreen.setUniform('colorCenter', [1.0, 0.0, 0.0]);\n  redGreen.setUniform('colorBackground', [0.0, 1.0, 0.0]);\n\n  // initialize the colors for orangeBlue shader\n  shader(orangeBlue);\n  orangeBlue.setUniform('colorCenter', [1.0, 0.5, 0.0]);\n  orangeBlue.setUniform('colorBackground', [0.226, 0.0, 0.615]);\n\n  noStroke();\n}\n\nfunction draw() {\n  // update the offset values for each shader,\n  // moving orangeBlue in vertical and redGreen\n  // in horizontal direction\n  orangeBlue.setUniform('offset', [0, sin(millis() / 2000) + 1]);\n  redGreen.setUniform('offset', [sin(millis() / 2000), 1]);\n\n  if (showRedGreen === true) {\n    shader(redGreen);\n  } else {\n    shader(orangeBlue);\n  }\n  quad(-1, -1, 1, -1, 1, 1, -1, 1);\n}\n\nfunction mouseClicked() {\n  showRedGreen = !showRedGreen;\n}\n</code>\n</div>"],alt:"canvas toggles between a circular gradient of orange and blue vertically. and a circular gradient of red and green moving horizontally when mouse is clicked/pressed.",class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/material.js",line:272,description:'<p>This function restores the default shaders in WEBGL mode. Code that runs\nafter resetShader() will not be affected by previously defined\nshaders. Should be run after <a href="#/p5/shader">shader()</a>.</p>\n',itemtype:"method",name:"resetShader",chainable:1,class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/material.js",line:285,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(40);\n}\n</code>\n</div>"],alt:"Red, green and blue gradient.",class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/material.js",line:322,description:'<p>Texture for geometry.  You can view other possible materials in this\n<a href="https://p5js.org/examples/3d-materials.html">example</a>.</p>\n',itemtype:"method",name:"texture",params:[{name:"tex",description:"<p>2-dimensional graphics\n                   to render as texture</p>\n",type:"p5.Image|p5.MediaElement|p5.Graphics"}],chainable:1,example:["\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n  background(0);\n  rotateZ(frameCount * 0.01);\n  rotateX(frameCount * 0.01);\n  rotateY(frameCount * 0.01);\n  //pass image as texture\n  texture(img);\n  box(200, 200, 200);\n}\n</code>\n</div>\n\n<div>\n<code>\nlet pg;\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  pg = createGraphics(200, 200);\n  pg.textSize(75);\n}\n\nfunction draw() {\n  background(0);\n  pg.background(255);\n  pg.text('hello!', 0, 100);\n  //pass image as texture\n  texture(pg);\n  rotateX(0.5);\n  noStroke();\n  plane(50);\n}\n</code>\n</div>\n\n<div>\n<code>\nlet vid;\nfunction preload() {\n  vid = createVideo('assets/fingers.mov');\n  vid.hide();\n}\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n  background(0);\n  //pass video frame as texture\n  texture(vid);\n  rect(-40, -40, 80, 80);\n}\n\nfunction mousePressed() {\n  vid.loop();\n}\n</code>\n</div>"],alt:"Rotating view of many images umbrella and grid roof on a 3d plane\nblack canvas\nblack canvas",class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/material.js",line:419,description:"<p>Sets the coordinate space for texture mapping. The default mode is IMAGE\nwhich refers to the actual coordinates of the image.\nNORMAL refers to a normalized space of values ranging from 0 to 1.\
21nThis function only works in WEBGL mode.</p>\n<p>With IMAGE, if an image is 100 x 200 pixels, mapping the image onto the entire\nsize of a quad would require the points (0,0) (100, 0) (100,200) (0,200).\nThe same mapping in NORMAL is (0,0) (1,0) (1,1) (0,1).</p>\n",itemtype:"method",name:"textureMode",params:[{name:"mode",description:"<p>either IMAGE or NORMAL</p>\n",type:"Constant"}],example:["\n<div>\n<code>\nlet img;\n\nfunction preload() {\n  img = loadImage('assets/laDefense.jpg');\n}\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n  texture(img);\n  textureMode(NORMAL);\n  beginShape();\n  vertex(-50, -50, 0, 0);\n  vertex(50, -50, 1, 0);\n  vertex(50, 50, 1, 1);\n  vertex(-50, 50, 0, 1);\n  endShape();\n}\n</code>\n</div>"],alt:"the underside of a white umbrella and gridded ceiling above",class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/material.js",line:498,description:"<p>Sets the global texture wrapping mode. This controls how textures behave\nwhen their uv&#39;s go outside of the 0 - 1 range. There are three options:\nCLAMP, REPEAT, and MIRROR.</p>\n<p>CLAMP causes the pixels at the edge of the texture to extend to the bounds\nREPEAT causes the texture to tile repeatedly until reaching the bounds\nMIRROR works similarly to REPEAT but it flips the texture with every new tile</p>\n<p>REPEAT &amp; MIRROR are only available if the texture\nis a power of two size (128, 256, 512, 1024, etc.).</p>\n<p>This method will affect all textures in your sketch until a subsequent\ntextureWrap call is made.</p>\n<p>If only one argument is provided, it will be applied to both the\nhorizontal and vertical axes.</p>\n",itemtype:"method",name:"textureWrap",params:[{name:"wrapX",description:"<p>either CLAMP, REPEAT, or MIRROR</p>\n",type:"Constant"},{name:"wrapY",description:"<p>either CLAMP, REPEAT, or MIRROR</p>\n",type:"Constant",optional:!0}],example:["\n<div>\n<code>\nlet img;\nfunction preload() {\n  img = loadImage('assets/rockies128.jpg');\n}\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  textureWrap(MIRROR);\n}\n\nfunction draw() {\n  background(0);\n\n  let dX = mouseX;\n  let dY = mouseY;\n\n  let u = lerp(1.0, 2.0, dX);\n  let v = lerp(1.0, 2.0, dY);\n\n  scale(width / 2);\n\n  texture(img);\n\n  beginShape(TRIANGLES);\n  vertex(-1, -1, 0, 0, 0);\n  vertex(1, -1, 0, u, 0);\n  vertex(1, 1, 0, u, v);\n\n  vertex(1, 1, 0, u, v);\n  vertex(-1, 1, 0, 0, v);\n  vertex(-1, -1, 0, 0, 0);\n  endShape();\n}\n</code>\n</div>"],alt:"an image of the rocky mountains repeated in mirrored tiles",class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/material.js",line:573,description:'<p>Ambient material for geometry with a given color. You can view all\npossible materials in this\n<a href="https://p5js.org/examples/3d-materials.html">example</a>.</p>\n',itemtype:"method",name:"ambientMaterial",chainable:1,example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\nfunction draw() {\n  background(0);\n  noStroke();\n  ambientLight(200);\n  ambientMaterial(70, 130, 230);\n  sphere(40);\n}\n</code>\n</div>"],alt:"radiating light source from top right of canvas",class:"p5",module:"Lights, Camera",submodule:"Material",overloads:[{line:573,params:[{name:"v1",description:"<p>gray value, red or hue value\n                        (depending on the current color mode),</p>\n",type:"Number"},{name:"v2",description:"<p>green or saturation value</p>\n",type:"Number",optional:!0},{name:"v3",description:"<p>blue or brightness value</p>\n",type:"Number",optional:!0},{name:"a",description:"<p>opacity</p>\n",type:"Number",optional:!0}],chainable:1},{line:604,params:[{name:"color",description:"<p>color, color Array, or CSS color string</p>\n",type:"Number[]|String|p5.Color"}],chainable:1}]},{file:"src/webgl/material.js",line:623,description:'<p>Specular material for geometry with a given color. You can view all\npossible materials in this\n<a href="https://p5js.org/examples/3d-materials.html">example</a>.</p>\n',itemtype:"method",name:"specularMaterial",chainable:1,example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\nfunction draw() {\n  background(0);\n  noStroke();\n  ambientLight(50);\n  pointLight(250, 250, 250, 100, 100, 30);\n  specularMaterial(250);\n  sphere(40);\n}\n</code>\n</div>"],alt:"diffused radiating light source from top right of canvas",class:"p5",module:"Lights, Camera",submodule:"Material",overloads:[{line:623,params:[{name:"v1",description:"<p>gray value, red or hue value\n                      (depending on the current color mode),</p>\n",type:"Number"},{name:"v2",description:"<p>green or saturation value</p>\n",type:"Number",optional:!0},{name:"v3",description:"<p>blue or brightness value</p>\n",type:"Number",optional:!0},{name:"a",description:"<p>opacity</p>\n",type:"Number",optional:!0}],chainable:1},{line:655,params:[{name:"color",description:"<p>color Array, or CSS color string</p>\n",type:"Number[]|String|p5.Color"}],chainable:1}]}
21,{file:"src/webgl/material.js",line:674,description:"<p>Sets the amount of gloss in the surface of shapes.\nUsed in combination with specularMaterial() in setting\nthe material properties of shapes. The default and minimum value is 1.</p>\n",itemtype:"method",name:"shininess",params:[{name:"shine",description:"<p>Degree of Shininess.\n                      Defaults to 1.</p>\n",type:"Number"}],chainable:1,example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\nfunction draw() {\n  background(0);\n  noStroke();\n  let locX = mouseX - width / 2;\n  let locY = mouseY - height / 2;\n  ambientLight(60, 60, 60);\n  pointLight(255, 255, 255, locX, locY, 50);\n  specularMaterial(250);\n  translate(-25, 0, 0);\n  shininess(1);\n  sphere(20);\n  translate(50, 0, 0);\n  shininess(20);\n  sphere(20);\n}\n</code>\n</div>"],alt:"Shininess on Camera changes position with mouse",class:"p5",module:"Lights, Camera",submodule:"Material"},{file:"src/webgl/p5.Camera.js",line:15,description:"<p>Sets the camera position for a 3D sketch. Parameters for this function define\nthe position for the camera, the center of the sketch (where the camera is\npointing), and an up direction (the orientation of the camera).</p>\n<p>When called with no arguments, this function creates a default camera\nequivalent to\ncamera(0, 0, (height/2.0) / tan(PI*30.0 / 180.0), 0, 0, 0, 0, 1, 0);</p>\n",itemtype:"method",name:"camera",params:[{name:"x",description:"<p>camera position value on x axis</p>\n",type:"Number",optional:!0},{name:"y",description:"<p>camera position value on y axis</p>\n",type:"Number",optional:!0},{name:"z",description:"<p>camera position value on z axis</p>\n",type:"Number",optional:!0},{name:"centerX",description:"<p>x coordinate representing center of the sketch</p>\n",type:"Number",optional:!0},{name:"centerY",description:"<p>y coordinate representing center of the sketch</p>\n",type:"Number",optional:!0},{name:"centerZ",description:"<p>z coordinate representing center of the sketch</p>\n",type:"Number",optional:!0},{name:"upX",description:"<p>x component of direction &#39;up&#39; from camera</p>\n",type:"Number",optional:!0},{name:"upY",description:"<p>y component of direction &#39;up&#39; from camera</p>\n",type:"Number",optional:!0},{name:"upZ",description:"<p>z component of direction &#39;up&#39; from camera</p>\n",type:"Number",optional:!0}],chainable:1,example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\nfunction draw() {\n  background(204);\n  //move the camera away from the plane by a sin wave\n  camera(0, 0, 20 + sin(frameCount * 0.01) * 10, 0, 0, 0, 0, 1, 0);\n  plane(10, 10);\n}\n</code>\n</div>"],alt:"White square repeatedly grows to fill canvas and then shrinks.",class:"p5",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/p5.Camera.js",line:61,description:"<p>Sets a perspective projection for the camera in a 3D sketch. This projection\nrepresents depth through foreshortening: objects that are close to the camera\nappear their actual size while those that are further away from the camera\nappear smaller. The parameters to this function define the viewing frustum\n(the truncated pyramid within which objects are seen by the camera) through\nvertical field of view, aspect ratio (usually width/height), and near and far\nclipping planes.</p>\n<p>When called with no arguments, the defaults\nprovided are equivalent to\nperspective(PI/3.0, width/height, eyeZ/10.0, eyeZ<em>10.0), where eyeZ\nis equal to ((height/2.0) / tan(PI</em>60.0/360.0));</p>\n",itemtype:"method",name:"perspective",params:[{name:"fovy",description:'<p>camera frustum vertical field of view,\n                          from bottom to top of view, in <a href="#/p5/angleMode">angleMode</a> units</p>\n',type:"Number",optional:!0},{name:"aspect",description:"<p>camera frustum aspect ratio</p>\n",type:"Number",optional:!0},{name:"near",description:"<p>frustum near plane length</p>\n",type:"Number",optional:!0},{name:"far",description:"<p>frustum far plane length</p>\n",type:"Number",optional:!0}],chainable:1,example:["\n<div>\n<code>
21\n//drag the mouse to look around!\n//you will see there's a vanishing point\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  perspective(PI / 3.0, width / height, 0.1, 500);\n}\nfunction draw() {\n  background(200);\n  orbitControl();\n  normalMaterial();\n\n  rotateX(-0.3);\n  rotateY(-0.2);\n  translate(0, 0, -50);\n\n  push();\n  translate(-15, 0, sin(frameCount / 30) * 95);\n  box(30);\n  pop();\n  push();\n  translate(15, 0, sin(frameCount / 30 + PI) * 95);\n  box(30);\n  pop();\n}\n</code>\n</div>"],alt:"two colored 3D boxes move back and forth, rotating as mouse is dragged.",class:"p5",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/p5.Camera.js",line:126,description:"<p>Sets an orthographic projection for the camera in a 3D sketch and defines a\nbox-shaped viewing frustum within which objects are seen. In this projection,\nall objects with the same dimension appear the same size, regardless of\nwhether they are near or far from the camera. The parameters to this\nfunction specify the viewing frustum where left and right are the minimum and\nmaximum x values, top and bottom are the minimum and maximum y values, and near\nand far are the minimum and maximum z values. If no parameters are given, the\ndefault is used: ortho(-width/2, width/2, -height/2, height/2).</p>\n",itemtype:"method",name:"ortho",params:[{name:"left",description:"<p>camera frustum left plane</p>\n",type:"Number",optional:!0},{name:"right",description:"<p>camera frustum right plane</p>\n",type:"Number",optional:!0},{name:"bottom",description:"<p>camera frustum bottom plane</p>\n",type:"Number",optional:!0},{name:"top",description:"<p>camera frustum top plane</p>\n",type:"Number",optional:!0},{name:"near",description:"<p>camera frustum near plane</p>\n",type:"Number",optional:!0},{name:"far",description:"<p>camera frustum far plane</p>\n",type:"Number",optional:!0}],chainable:1,example:["\n<div>\n<code>\n//drag the mouse to look around!\n//there's no vanishing point\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  ortho(-width / 2, width / 2, height / 2, -height / 2, 0, 500);\n}\nfunction draw() {\n  background(200);\n  orbitControl();\n  normalMaterial();\n\n  rotateX(0.2);\n  rotateY(-0.2);\n  push();\n  translate(-15, 0, sin(frameCount / 30) * 65);\n  box(30);\n  pop();\n  push();\n  translate(15, 0, sin(frameCount / 30 + PI) * 65);\n  box(30);\n  pop();\n}\n</code>\n</div>"],alt:"two 3D boxes move back and forth along same plane, rotating as mouse is dragged.",class:"p5",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/p5.Camera.js",line:187,description:'<p>Creates a new <a href="#/p5.Camera">p5.Camera</a> object and tells the\nrenderer to use that camera.\nReturns the p5.Camera object.</p>\n',itemtype:"method",name:"createCamera",return:{description:"The newly created camera object.",type:"p5.Camera"},class:"p5",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/p5.Camera.js",line:298,description:'<p>Sets a perspective projection for a p5.Camera object and sets parameters\nfor that projection according to <a href="#/p5/perspective">perspective()</a>\nsyntax.</p>\n',itemtype:"method",name:"perspective",class:"p5.Camera",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/p5.Camera.js",line:379,description:'<p>Sets an orthographic projection for a p5.Camera object and sets parameters\nfor that projection according to <a href="#/p5/ortho">ortho()</a> syntax.</p>\n',itemtype:"method",name:"ortho",class:"p5.Camera",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/p5.Camera.js",line:486,description:"<p>Panning rotates the camera view to the left and right.</p>\n",itemtype:"method",name:"pan",params:[{name:"angle",description:'<p>amount to rotate camera in current\n<a href="#/p5/angleMode">angleMode</a> units.\nGreater than 0 values rotate counterclockwise (to the left).</p>\n',type:"Number"}],example:["\n<div>\n<code>\nlet cam;\nlet delta = 0.01;\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  normalMaterial();\n  cam = createCamera();\n  // set initial pan angle\n  cam.pan(-0.8);\n}\n\nfunction draw() {\n  background(200);\n\n  // pan camera according to angle 'delta'\n  cam.pan(delta);\n\n  // every 160 frames, switch direction\n  if (frameCount % 160 === 0) {\n    delta *= -1;\n  }\n\n  rotateX(frameCount * 0.01);\n  translate(-100, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n}\n</code>\n</div>"],alt:"camera view pans left and right across a series of rotating 3D boxes.",class:"p5.Camera",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/p5.Camera.js",line:545,description:"<p>Tilting rotates the camera view up and down.</p>\n",itemtype:"method",name:"tilt",params:[{name:"angle",description:'<p>amount to rotate camera in current\n<a href="#/p5/angleMode">angleMode</a> units.\nGreater than 0 values rotate counterclockwise (to the left).</p>\n',type:"Number"}],example:["\n<div>\n<code>\nlet cam;\nlet delta = 0.01;\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  normalMaterial();\n  cam = createCamera();\n  // set initial tilt\n  cam.tilt(-0.8);\n}\n\nfunction draw() {\n  background(200);\n\n  // pan camera according to angle 'delta'\n  cam.tilt(delta);\n\n  // every 160 frames, switch direction\n  if (frameCount % 160 === 0) {\n    delta *= -1;\n  }\n\n  rotateY(frameCount * 0.01);\n  translate(0, -100, 0);\n  box(20);\n  translate(0, 35, 0);\n  box(20);\n  translate(0, 35, 0);\n  box(20);\n  translate(0, 35, 0);\n  box(20);\n  translate(0, 35, 0);\n  box(20);\n  translate(0, 35, 0);\n  box(20);\n  translate(0, 35, 0);\n  box(20);\n}\n</code>\n</div>"],alt:"camera view tilts up and down across a series of rotating 3D boxes.",class:"p5.Camera",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/p5.Camera.js",line:603,description:"<p>Reorients the camera to look at a position in world space.</p>\n",itemtype:"method",name:"lookAt",params:[{name:"x",description:"<p>x position of a point in world space</p>\n",type:"Number"},{name:"y",description:"<p>y position of a point in world space</p>\n",type:"Number"},{name:"z",description:"<p>z position of a point in world space</p>\n",type:"Number"}],example:["\n<div>\n<code>\nlet cam;\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  normalMaterial();\n  cam = createCamera();\n}\n\nfunction draw() {\n  background(200);\n\n  // look at a new random point every 60 frames\n  if (frameCount % 60 === 0) {\n    cam.lookAt(random(-100, 100), random(-50, 50), 0);\n  }\n\n  rotateX(frameCount * 0.01);\n  translate(-100, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n}\n</code>\n</div>"],alt:"camera view of rotating 3D cubes changes to look at a new random\npoint every second .",class:"p5.Camera",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/p5.Camera.js",line:670,description:'<p>Sets a camera&#39;s position and orientation.  This is equivalent to calling\n<a href="#/p5/camera">camera()</a> on a p5.Camera object.</p>\n',itemtype:"method",name:"camera",class:"p5.Camera",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/p5.Camera.js",line:751,description:"<p>Move camera along its local axes while maintaining current camera orientation.</p>\n",itemtype:"method",name:"move",params:[{name:"x",description:"<p>amount to move along camera&#39;s left-right axis</p>\n",type:"Number"},{name:"y",description:"<p>amount to move along camera&#39;s up-down axis</p>\n",type:"Number"},{name:"z",description:"<p>amount to move along camera&#39;s forward-backward axis</p>\n",type:"Number"}],example:["\n<div>\n<code>\n// see the camera move along its own axes while maintaining its orientation\nlet cam;\nlet delta = 0.5;\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  normalMaterial();\n  cam = createCamera();\n}\n\nfunction draw() {\n  background(200);\n\n  // move the camera along its local axes\n  cam.move(delta, delta, 0);\n\n  // every 100 frames, switch direction\n  if (frameCount % 150 === 0) {\n    delta *= -1;\n  }\n\n  translate(-10, -10, 0);\n  box(50, 8, 50);\n  translate(15, 15, 0);\n  box(50, 8, 50);\n  translate(15, 15, 0);\n  box(50, 8, 50);\n  translate(15, 15, 0);\n  box(50, 8, 50);\n  translate(15, 15, 0);\n  box(50, 8, 50);\n  translate(15, 15, 0);\n  box(50, 8, 50);\n}\n</code>\n</div>"],alt:"camera view moves along a series of 3D boxes, maintaining the same\norientation throughout the move",class:"p5.Camera",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/p5.Camera.js",line:823,description:"<p>Set camera position in world-space while maintaining current camera\norientation.</p>\n",itemtype:"method",name:"setPosition",params:[{name:"x",description:"<p>x position of a point in world space</p>\n",type:"Number"},{name:"y",description:"<p>y position of a point in world space</p>\n",type:"Number"},{name:"z",description:"<p>z position of a point in world space</p>\n",type:"Number"}],example:["\n<div>\n<code>\n// press '1' '2' or '3' keys to set camera position\n\nlet cam;\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  normalMaterial();\n  cam = createCamera();\n}\n\nfunction draw() {\n  background(200);
21\n\n  // '1' key\n  if (keyIsDown(49)) {\n    cam.setPosition(30, 0, 80);\n  }\n  // '2' key\n  if (keyIsDown(50)) {\n    cam.setPosition(0, 0, 80);\n  }\n  // '3' key\n  if (keyIsDown(51)) {\n    cam.setPosition(-30, 0, 80);\n  }\n\n  box(20);\n}\n</code>\n</div>"],alt:"camera position changes as the user presses keys, altering view of a 3D box",class:"p5.Camera",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/p5.Camera.js",line:1088,description:"<p>Sets rendererGL&#39;s current camera to a p5.Camera object.  Allows switching\nbetween multiple cameras.</p>\n",itemtype:"method",name:"setCamera",params:[{name:"cam",description:"<p>p5.Camera object</p>\n",type:"p5.Camera"}],example:["\n<div>\n<code>\nlet cam1, cam2;\nlet currentCamera;\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  normalMaterial();\n\n  cam1 = createCamera();\n  cam2 = createCamera();\n  cam2.setPosition(30, 0, 50);\n  cam2.lookAt(0, 0, 0);\n  cam2.ortho();\n\n  // set variable for previously active camera:\n  currentCamera = 1;\n}\n\nfunction draw() {\n  background(200);\n\n  // camera 1:\n  cam1.lookAt(0, 0, 0);\n  cam1.setPosition(sin(frameCount / 60) * 200, 0, 100);\n\n  // every 100 frames, switch between the two cameras\n  if (frameCount % 100 === 0) {\n    if (currentCamera === 1) {\n      setCamera(cam1);\n      currentCamera = 0;\n    } else {\n      setCamera(cam2);\n      currentCamera = 1;\n    }\n  }\n\n  drawBoxes();\n}\n\nfunction drawBoxes() {\n  rotateX(frameCount * 0.01);\n  translate(-100, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n  translate(35, 0, 0);\n  box(20);\n}\n</code>\n</div>"],alt:"Canvas switches between two camera views, each showing a series of spinning\n3D boxes.",class:"p5",module:"Lights, Camera",submodule:"Camera"},{file:"src/webgl/p5.Geometry.js",line:66,itemtype:"method",name:"computeFaces",chainable:1,class:"p5.Geometry",module:"Lights, Camera"},{file:"src/webgl/p5.Geometry.js",line:108,description:"<p>computes smooth normals per vertex as an average of each\nface.</p>\n",itemtype:"method",name:"computeNormals",chainable:1,class:"p5.Geometry",module:"Lights, Camera"},{file:"src/webgl/p5.Geometry.js",line:147,description:"<p>Averages the vertex normals. Used in curved\nsurfaces</p>\n",itemtype:"method",name:"averageNormals",chainable:1,class:"p5.Geometry",module:"Lights, Camera"},{file:"src/webgl/p5.Geometry.js",line:168,description:"<p>Averages pole normals.  Used in spherical primitives</p>\n",itemtype:"method",name:"averagePoleNormals",chainable:1,class:"p5.Geometry",module:"Lights, Camera"},{file:"src/webgl/p5.Geometry.js",line:261,description:"<p>Modifies all vertices to be centered within the range -100 to 100.</p>\n",itemtype:"method",name:"normalize",chainable:1,class:"p5.Geometry",module:"Lights, Camera"},{file:"src/webgl/p5.RendererGL.js",line:263,description:"<p>Set attributes for the WebGL Drawing context.\nThis is a way of adjusting how the WebGL\nrenderer works to fine-tune the display and performance.\n<br><br>\nNote that this will reinitialize the drawing context\nif called after the WebGL canvas is made.\n<br><br>\nIf an object is passed as the parameter, all attributes\nnot declared in the object will be set to defaults.\n<br><br>\nThe available attributes are:\n<br>\nalpha - indicates if the canvas contains an alpha buffer\ndefault is true\n<br><br>\ndepth - indicates whether the drawing buffer has a depth buffer\nof at least 16 bits - default is true\n<br><br>\nstencil - indicates whether the drawing buffer has a stencil buffer\nof at least 8 bits\n<br><br>\nantialias - indicates whether or not to perform anti-aliasing\ndefault is false\n<br><br>\npremultipliedAlpha - indicates that the page compositor will assume\nthe drawing buffer contains colors with pre-multiplied alpha\ndefault is false\n<br><br>\npreserveDrawingBuffer - if true the buffers will not be cleared and\nand will preserve their values until cleared or over
21written by author\n(note that p5 clears automatically on draw loop)\ndefault is true\n<br><br>\nperPixelLighting - if true, per-pixel lighting will be used in the\nlighting shader.\ndefault is false\n<br><br></p>\n",itemtype:"method",name:"setAttributes",example:["\n<div>\n<code>\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n  background(255);\n  push();\n  rotateZ(frameCount * 0.02);\n  rotateX(frameCount * 0.02);\n  rotateY(frameCount * 0.02);\n  fill(0, 0, 0);\n  box(50);\n  pop();\n}\n</code>\n</div>\n<br>\nNow with the antialias attribute set to true.\n<br>\n<div>\n<code>\nfunction setup() {\n  setAttributes('antialias', true);\n  createCanvas(100, 100, WEBGL);\n}\n\nfunction draw() {\n  background(255);\n  push();\n  rotateZ(frameCount * 0.02);\n  rotateX(frameCount * 0.02);\n  rotateY(frameCount * 0.02);\n  fill(0, 0, 0);\n  box(50);\n  pop();\n}\n</code>\n</div>\n\n<div>\n<code>\n// press the mouse button to enable perPixelLighting\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  noStroke();\n  fill(255);\n}\n\nvar lights = [\n  { c: '#f00', t: 1.12, p: 1.91, r: 0.2 },\n  { c: '#0f0', t: 1.21, p: 1.31, r: 0.2 },\n  { c: '#00f', t: 1.37, p: 1.57, r: 0.2 },\n  { c: '#ff0', t: 1.12, p: 1.91, r: 0.7 },\n  { c: '#0ff', t: 1.21, p: 1.31, r: 0.7 },\n  { c: '#f0f', t: 1.37, p: 1.57, r: 0.7 }\n];\n\nfunction draw() {\n  var t = millis() / 1000 + 1000;\n  background(0);\n  directionalLight(color('#222'), 1, 1, 1);\n\n  for (var i = 0; i < lights.length; i++) {\n    var light = lights[i];\n    pointLight(\n      color(light.c),\n      p5.Vector.fromAngles(t * light.t, t * light.p, width * light.r)\n    );\n  }\n\n  specularMaterial(255);\n  sphere(width * 0.1);\n\n  rotateX(t * 0.77);\n  rotateY(t * 0.83);\n  rotateZ(t * 0.91);\n  torus(width * 0.3, width * 0.07, 24, 10);\n}\n\nfunction mousePressed() {\n  setAttributes('perPixelLighting', true);\n  noStroke();\n  fill(255);\n}\nfunction mouseReleased() {\n  setAttributes('perPixelLighting', false);\n  noStroke();\n  fill(255);\n}\n</code>\n</div>"],alt:"a rotating cube with smoother edges",class:"p5",module:"Rendering",submodule:"Rendering",overloads:[{line:263,params:[{name:"key",description:"<p>Name of attribute</p>\n",type:"String"},{name:"value",description:"<p>New value of named attribute</p>\n",type:"Boolean"}]},{line:402,params:[{name:"obj",description:"<p>object with key-value pairs</p>\n",type:"Object"}]}]},{file:"src/webgl/p5.Shader.js",line:269,description:"<p>Wrapper around gl.uniform functions.\nAs we store uniform info in the shader we can use that\nto do type checking on the supplied data and call\nthe appropriate function.</p>\n",itemtype:"method",name:"setUniform",chainable:1,params:[{name:"uniformName",description:"<p>the name of the uniform in the\nshader program</p>\n",type:"String"},{name:"data",description:"<p>the data to be associated\nwith that uniform; type varies (could be a single numerical value, array,\nmatrix, or texture / sampler reference)</p>\n",type:"Object|Number|Boolean|Number[]"}],example:["\n<div modernizr='webgl'>\n<code>\n// Click within the image to toggle the value of uniforms\n// Note: for an alternative approach to the same example,\n// involving toggling between shaders please refer to:\n// https://p5js.org/reference/#/p5/shader\n\nlet grad;\nlet showRedGreen = false;\n\nfunction preload() {\n  // note that we are using two instances\n  // of the same vertex and fragment shaders\n  grad = loadShader('assets/shader.vert', 'assets/shader-gradient.frag');\n}\n\nfunction setup() {\n  createCanvas(100, 100, WEBGL);\n  shader(grad);\n  noStroke();\n}\n\nfunction draw() {\n  // update the offset values for each scenario,\n  // moving the \"grad\" shader in either vertical or\n  // horizontal direction each with differing colors\n\n  if (showRedGreen === true) {\n    grad.setUniform('colorCenter', [1, 0, 0]);\n    grad.setUniform('colorBackground', [0, 1, 0]);\n    grad.setUniform('offset', [sin(millis() / 2000), 1]);\n  } else {\n    grad.setUniform('colorCenter', [1, 0.5, 0]);
21\n    grad.setUniform('colorBackground', [0.226, 0, 0.615]);\n    grad.setUniform('offset', [0, sin(millis() / 2000) + 1]);\n  }\n  quad(-1, -1, 1, -1, 1, 1, -1, 1);\n}\n\nfunction mouseClicked() {\n  showRedGreen = !showRedGreen;\n}\n</code>\n</div>"],alt:"canvas toggles between a circular gradient of orange and blue vertically. and a circular gradient of red and green moving horizontally when mouse is clicked/pressed.",class:"p5.Shader",module:"Lights, Camera",submodule:"Shaders"},{file:"lib/addons/p5.dom.js",line:40,description:'<p>Searches the page for an element with the given ID, class, or tag name (using the &#39;#&#39; or &#39;.&#39;\nprefixes to specify an ID or class respectively, and none for a tag) and returns it as\na <a href="#/p5.Element">p5.Element</a>. If a class or tag name is given with more than 1 element,\nonly the first element will be returned.\nThe DOM node itself can be accessed with .elt.\nReturns null if none found. You can also specify a container to search within.</p>\n',itemtype:"method",name:"select",params:[{name:"name",description:"<p>id, class, or tag name of element to search for</p>\n",type:"String"},{name:"container",description:'<p>id, <a href="#/p5.Element">p5.Element</a>, or\n                                            HTML element to search within</p>\n',type:"String|p5.Element|HTMLElement",optional:!0}],return:{description:'<a href="#/p5.Element">p5.Element</a> containing node found',type:"p5.Element|null"},example:["\n<div ><code class='norender'>\nfunction setup() {\n  createCanvas(100, 100);\n  //translates canvas 50px down\n  select('canvas').position(100, 100);\n}\n</code></div>\n<div><code class='norender'>\n// these are all valid calls to select()\nvar a = select('#moo');\nvar b = select('#blah', '#myContainer');\nvar c, e;\nif (b) {\n  c = select('#foo', b);\n}\nvar d = document.getElementById('beep');\nif (d) {\n  e = select('p', d);\n}\n[a, b, c, d, e]; // unused\n</code></div>\n"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:107,description:'<p>Searches the page for elements with the given class or tag name (using the &#39;.&#39; prefix\nto specify a class and no prefix for a tag) and returns them as <a href="#/p5.Element">p5.Element</a>s\nin an array.\nThe DOM node itself can be accessed with .elt.\nReturns an empty array if none found.\nYou can also specify a container to search within.</p>\n',itemtype:"method",name:"selectAll",params:[{name:"name",description:"<p>class or tag name of elements to search for</p>\n",type:"String"},{name:"container",description:'<p>id, <a href="#/p5.Element">p5.Element</a>, or HTML element to search within</p>\n',type:"String",optional:!0}],return:{description:'Array of <a href="#/p5.Element">p5.Element</a>s containing nodes found',type:"p5.Element[]"},example:["\n<div class='norender'><code>\nfunction setup() {\n  createButton('btn');\n  createButton('2nd btn');\n  createButton('3rd btn');\n  var buttons = selectAll('button');\n\n  for (var i = 0; i < buttons.length; i++) {\n    buttons[i].size(100, 100);\n  }\n}\n</code></div>\n<div class='norender'><code>\n// these are all valid calls to selectAll()\nvar a = selectAll('.moo');\na = selectAll('div');\na = selectAll('button', '#myContainer');\n\nvar d = select('#container');\na = selectAll('p', d);\n\nvar f = document.getElementById('beep');\na = select('.blah', f);\n\na; // unused\n</code></div>\n"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:168,description:"<p>Helper function for select and selectAll</p>\n",class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:184,description:"<p>Helper function for getElement and getElements.</p>\n",class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:218,description:'<p>Removes all elements created by p5, except any canvas / graphics\nelements created by <a href="#/p5/createCanvas">createCanvas</a> or <a href="#/p5/createGraphics">createGraphics</a>.\nEvent handlers are removed, and element is removed from the DOM.</p>\n',itemtype:"method",name:"removeElements",example:["\n<div class='norender'><code>\nfunction setup() {\n  createCanvas(100, 100);\n  createDiv('this is some text');\n  createP('this is a paragraph');\n}\nfunction mousePressed() {\n  removeElements(); // this will remove the div and p, not canvas\n}\n</code></div>\n"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:245,description:'<p>The .<a href="#/p5.Element/changed">changed()</a> 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\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",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:313,description:'<p>The .<a href="#/p5.Element/input">input()</a> 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\nsl
21ider element. This can be used to attach an element specific\nevent listener.</p>\n',itemtype:"method",name:"input",params:[{name:"fxn",description:"<p>function to be fired when any user input is\n                               detected within the element.\n                               if <code>false</code> is passed instead, the previously\n                               firing function will no longer fire.</p>\n",type:"Function|Boolean"}],chainable:1,example:["\n<div class='norender'><code>\n// Open your console to see the output\nfunction setup() {\n  var inp = createInput('');\n  inp.input(myInputEvent);\n}\n\nfunction myInputEvent() {\n  console.log('you are typing: ', this.value());\n}\n</code></div>"],alt:"no display.",class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:348,description:"<p>Helpers for create methods.</p>\n",class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:361,description:"<p>Creates a &lt;div&gt;&lt;/div&gt; element in the DOM with given inner HTML.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n",itemtype:"method",name:"createDiv",params:[{name:"html",description:"<p>inner HTML for element created</p>\n",type:"String",optional:!0}],return:{description:'pointer to <a href="#/p5.Element">p5.Element</a> holding created node',type:"p5.Element"},example:["\n<div class='norender'><code>\ncreateDiv('this is some text');\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:375,description:"<p>Creates a &lt;p&gt;&lt;/p&gt; element in the DOM with given inner HTML. Used\nfor paragraph length text.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n",itemtype:"method",name:"createP",params:[{name:"html",description:"<p>inner HTML for element created</p>\n",type:"String",optional:!0}],return:{description:'pointer to <a href="#/p5.Element">p5.Element</a> holding created node',type:"p5.Element"},example:["\n<div class='norender'><code>\ncreateP('this is some text');\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:390,description:"<p>Creates a &lt;span&gt;&lt;/span&gt; element in the DOM with given inner HTML.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n",itemtype:"method",name:"createSpan",params:[{name:"html",description:"<p>inner HTML for element created</p>\n",type:"String",optional:!0}],return:{description:'pointer to <a href="#/p5.Element">p5.Element</a> holding created node',type:"p5.Element"},example:["\n<div class='norender'><code>\ncreateSpan('this is some text');\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:413,description:"<p>Creates an &lt;img&gt; element in the DOM with given src and\nalternate text.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n",itemtype:"method",name:"createImg",return:{description:'pointer to <a href="#/p5.Element">p5.Element</a> holding created node',type:"p5.Element"},example:["\n<div class='norender'><code>\ncreateImg('http://p5js.org/img/asterisk-01.png');\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom",overloads:[{line:413,params:[{name:"src",description:"<p>src path or url for image</p>\n",type:"String"},{name:"alt",description:"<p>alternate text to be used if image does not load</p>\n",type:"String",optional:!0},{name:"successCallback",description:"<p>callback to be called once image data is loaded</p>\n",type:"Function",optional:!0}],return:{description:'pointer to <a href="#/p5.Element">p5.Element</a> holding created node',type:"p5.Element"}},{line:429,params:[{name:"src",description:"",type:"String"},{name:"successCallback",description:"",type:"Function"}],return:{description:"",type:"Object|p5.Element"}}]},{file:"lib/addons/p5.dom.js",line:463,description:"<p>Creates an &lt;a&gt;&lt;/a&gt; element in the DOM for including a hyperlink.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n",itemtype:"method",name:"createA",params:[{name:"href",description:"<p>url of page to link to</p>\n",type:"String"},{name:"html",description:"<p>inner html of link element to display</p>\n",type:"String"},{name:"target",description:"<p>target where new link should open,\n                            could be _blank, _self, _parent, _top.</p>\n",type:"String",optional:!0}],return:{description:'pointer to <a href="#/p5.Element">p5.Element</a> holding created node',type:"p5.Element"},example:["\n<div class='norender'><code>\ncreateA('http://p5js.org/', 'this is a link');\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:488,class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:490,description:"<p>Creates a slider &lt;input&gt;&lt;/input&gt; element in the DOM.\nUse .size() to set the display length of the slider.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n",itemtype:"method",name:"createSlider",params:[{name:"min",description:"<p>minimum value of the slider</p>\n",type:"Number"},{name:"max",description:"<p>maximum value of the slider</p>\n",type:"Number"},{name:"value",description:"<p>default value of the slider</p>\n",type:"Number",optional:!0},{name:"step",description:"<p>step size for each tick of the slider (if step is set to 0, the slider will move continuously from the minimum to the maximum value)</p>\n",type:"Number",optional:!0}],return:{description:'pointer to <a href="#/p5.Element">p5.Element</a> holding created node',type:"p5.Element"},example:["\n<div><code>\nvar slider;\nfunction setup() {\n  slider = createSlider(0, 255, 100);\n  slider.position(10, 10);\n  slider.style('width', '80px');\n}\n\nfunction draw() {\n  var val = slider.value();\n  background(val);\n}\n</code></div>\n\n<div><code>\nvar slider;\nfunction setup() {\n  colorMode(HSB);\n  slider = createSlider(0, 360, 60, 40);\n  slider.position(10, 10);\n  slider.style('width', '80px');\n}\n\nfunction draw() {\n  var val = slider.value();
21\n  background(val, 100, 100, 1);\n}\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:547,description:"<p>Creates a &lt;button&gt;&lt;/button&gt; element in the DOM.\nUse .size() to set the display size of the button.\nUse .mousePressed() to specify behavior on press.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n",itemtype:"method",name:"createButton",params:[{name:"label",description:"<p>label displayed on the button</p>\n",type:"String"},{name:"value",description:"<p>value of the button</p>\n",type:"String",optional:!0}],return:{description:'pointer to <a href="#/p5.Element">p5.Element</a> holding created node',type:"p5.Element"},example:["\n<div class='norender'><code>\nvar button;\nfunction setup() {\n  createCanvas(100, 100);\n  background(0);\n  button = createButton('click me');\n  button.position(19, 19);\n  button.mousePressed(changeBG);\n}\n\nfunction changeBG() {\n  var val = random(255);\n  background(val);\n}\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:583,description:"<p>Creates a checkbox &lt;input&gt;&lt;/input&gt; element in the DOM.\nCalling .checked() on a checkbox returns if it is checked or not</p>\n",itemtype:"method",name:"createCheckbox",params:[{name:"label",description:"<p>label displayed after checkbox</p>\n",type:"String",optional:!0},{name:"value",description:"<p>value of the checkbox; checked is true, unchecked is false</p>\n",type:"Boolean",optional:!0}],return:{description:'pointer to <a href="#/p5.Element">p5.Element</a> holding created node',type:"p5.Element"},example:["\n<div class='norender'><code>\nvar checkbox;\n\nfunction setup() {\n  checkbox = createCheckbox('label', false);\n  checkbox.changed(myCheckedEvent);\n}\n\nfunction myCheckedEvent() {\n  if (this.checked()) {\n    console.log('Checking!');\n  } else {\n    console.log('Unchecking!');\n  }\n}\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:651,description:'<p>Creates a dropdown menu &lt;select&gt;&lt;/select&gt; element in the DOM.\nIt also helps to assign select-box methods to <a href="#/p5.Element">p5.Element</a> when selecting existing select box</p>\n',itemtype:"method",name:"createSelect",return:{description:"",type:"p5.Element"},example:["\n<div><code>\nvar sel;\n\nfunction setup() {\n  textAlign(CENTER);\n  background(200);\n  sel = createSelect();\n  sel.position(10, 10);\n  sel.option('pear');\n  sel.option('kiwi');\n  sel.option('grape');\n  sel.changed(mySelectEvent);\n}\n\nfunction mySelectEvent() {\n  var item = sel.value();\n  background(200);\n  text('It is a ' + item + '!', 50, 50);\n}\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom",overloads:[{line:651,params:[{name:"multiple",description:"<p>true if dropdown should support multiple selections</p>\n",type:"Boolean",optional:!0}],return:{description:"",type:"p5.Element"}},{line:679,params:[{name:"existing",description:"<p>DOM select element</p>\n",type:"Object"}],return:{description:"",type:"p5.Element"}}]},{file:"lib/addons/p5.dom.js",line:755,description:"<p>Creates a radio button &lt;input&gt;&lt;/input&gt; element in the DOM.\nThe .option() method can be used to set options for the radio after it is\ncreated. The .value() method will return the currently selected option.</p>\n",itemtype:"method",name:"createRadio",params:[{name:"divId",description:"<p>the id and name of the created div and input field respectively</p>\n",type:"String",optional:!0}],return:{description:'pointer to <a href="#/p5.Element">p5.Element</a> holding created node',type:"p5.Element"},example:["\n<div><code>\nvar radio;\n\nfunction setup() {\n  radio = createRadio();\n  radio.option('black');\n  radio.option('white');\n  radio.option('gray');\n  radio.style('width', '60px');\n  textAlign(CENTER);\n  fill(255, 0, 0);\n}\n\nfunction draw() {\n  var val = radio.value();\n  background(val);\n  text(val, width / 2, height / 2);\n}\n</code></div>\n<div><code>\nvar radio;\n\nfunction setup() {\n  radio = createRadio();\n  radio.option('apple', 1);\n  radio.option('bread', 2);\n  radio.option('juice', 3);\n  radio.style('width', '60px');\n  textAlign(CENTER);\n}\n\nfunction draw() {\n  background(200);
21\n  var val = radio.value();\n  if (val) {\n    text('item cost is $' + val, width / 2, height / 2);\n  }\n}\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:893,description:"<p>Creates a colorPicker element in the DOM for color input.\nThe .value() method will return a hex string (#rrggbb) of the color.\nThe .color() method will return a p5.Color object with the current chosen color.</p>\n",itemtype:"method",name:"createColorPicker",params:[{name:"value",description:"<p>default color of element</p>\n",type:"String|p5.Color",optional:!0}],return:{description:'pointer to <a href="#/p5.Element">p5.Element</a> holding created node',type:"p5.Element"},example:["\n<div>\n<code>\nvar inp1, inp2;\nfunction setup() {\n  createCanvas(100, 100);\n  background('grey');\n  inp1 = createColorPicker('#ff0000');\n  inp2 = createColorPicker(color('yellow'));\n  inp1.input(setShade1);\n  inp2.input(setShade2);\n  setMidShade();\n}\n\nfunction setMidShade() {\n  // Finding a shade between the two\n  var commonShade = lerpColor(inp1.color(), inp2.color(), 0.5);\n  fill(commonShade);\n  rect(20, 20, 60, 60);\n}\n\nfunction setShade1() {\n  setMidShade();
21\n  console.log('You are choosing shade 1 to be : ', this.value());\n}\nfunction setShade2() {\n  setMidShade();\n  console.log('You are choosing shade 2 to be : ', this.value());\n}\n</code>\n</div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:967,description:'<p>Creates an &lt;input&gt;&lt;/input&gt; element in the DOM for text input.\nUse .<a href="#/p5.Element/size">size()</a> to set the display length of the box.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n',itemtype:"method",name:"createInput",params:[{name:"value",description:"<p>default value of the input box</p>\n",type:"String",optional:!0},{name:"type",description:"<p>type of text, ie text, password etc. Defaults to text</p>\n",type:"String",optional:!0}],return:{description:'pointer to <a href="#/p5.Element">p5.Element</a> holding created node',type:"p5.Element"},example:["\n<div class='norender'><code>\nfunction setup() {\n  var inp = createInput('');\n  inp.input(myInputEvent);\n}\n\nfunction myInputEvent() {\n  console.log('you are typing: ', this.value());\n}\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:997,description:"<p>Creates an &lt;input&gt;&lt;/input&gt; element in the DOM of type &#39;file&#39;.\nThis allows users to select local files for use in a sketch.</p>\n",itemtype:"method",name:"createFileInput",params:[{name:"callback",description:"<p>callback function for when a file loaded</p>\n",type:"Function",optional:!0},{name:"multiple",description:"<p>optional to allow multiple files selected</p>\n",type:"String",optional:!0}],return:{description:'pointer to <a href="#/p5.Element">p5.Element</a> holding created DOM element',type:"p5.Element"},example:["\n<div><code>\nlet input;\nlet img;\n\nfunction setup() {\n  input = createFileInput(handleFile);\n  input.position(0, 0);\n}\n\nfunction draw() {\n  background(255);\n  if (img) {\n    image(img, 0, 0, width, height);\n  }\n}\n\nfunction handleFile(file) {\n  print(file);\n  if (file.type === 'image') {\n    img = createImg(file.data);\n    img.hide();\n  } else {\n    img = null;\n  }\n}\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1070,class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1112,description:"<p>Creates an HTML5 &lt;video&gt; element in the DOM for simple playback\nof audio/video. Shown by default, can be hidden with .<a href=\"#/p5.Element/hide\">hide()</a>\nand drawn into canvas using video(). Appends to the container\nnode if one is specified, otherwise appends to body. The first parameter\ncan be either a single string path to a video file, or an array of string\npaths to different formats of the same video. This is useful for ensuring\nthat your video can play across different browsers, as each supports\ndifferent formats. See <a href='https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats'>this\npage</a> for further information about supported formats.</p>\n",itemtype:"method",name:"createVideo",params:[{name:"src",description:"<p>path to a video file, or array of paths for\n                            supporting different browsers</p>\n",type:"String|String[]"},{name:"callback",description:"<p>callback function to be called upon\n                            &#39;canplaythrough&#39; event fire, that is, when the\n                            browser can play the media, and estimates that\n                            enough data has been loaded to play the media\n                            up to its end without having to stop for\n                            further buffering of content</p>\n",type:"Function",optional:!0}],return:{description:'pointer to video <a href="#/p5.Element">p5.Element</a>',type:"p5.MediaElement"},example:["\n<div><code>\nvar vid;\nfunction setup() {\n  noCanvas();\n\n  vid = createVideo(\n    ['assets/small.mp4', 'assets/small.ogv', 'assets/small.webm'],\n    vidLoad\n  );\n\n  vid.size(100, 100);\n}\n\n// This function is called when the video loads\nfunction vidLoad() {\n  vid.loop();\n  vid.volume(0);\n}\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1159,class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1161,description:"<p>Creates a hidden HTML5 &lt;audio&gt; element in the DOM for simple audio\nplayback. Appends to the container node if one is specified,\notherwise appends to body. The first parameter\ncan be either a single str
21ing path to a audio file, or an array of string\npaths to different formats of the same audio. This is useful for ensuring\nthat your audio can play across different browsers, as each supports\ndifferent formats. See <a href='https://developer.mozilla.org/en-US/docs/Web/HTML/Supported_media_formats'>this\npage for further information about supported formats</a>.</p>\n",itemtype:"method",name:"createAudio",params:[{name:"src",description:"<p>path to an audio file, or array of paths\n                            for supporting different browsers</p>\n",type:"String|String[]",optional:!0},{name:"callback",description:"<p>callback function to be called upon\n                            &#39;canplaythrough&#39; event fire, that is, when the\n                            browser can play the media, and estimates that\n                            enough data has been loaded to play the media\n                            up to its end without having to stop for\n                            further buffering of content</p>\n",type:"Function",optional:!0}],return:{description:'pointer to audio <a href="#/p5.Element">p5.Element</a>',type:"p5.MediaElement"},example:["\n<div><code>\nvar ele;\nfunction setup() {\n  ele = createAudio('assets/beat.mp3');\n\n  // here we set the element to autoplay\n  // The element will play as soon\n  // as it is able to do so.\n  ele.autoplay(true);\n}\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1199,class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1201,itemtype:"property",name:"VIDEO",type:"String",final:1,category:["Constants"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1207,itemtype:"property",name:"AUDIO",type:"String",final:1,category:["Constants"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1244,description:"<p>Creates a new HTML5 &lt;video&gt; element that contains the audio/video\nfeed from a webcam. The element is separate from the canvas and is\ndisplayed by default. The element can be hidden using .<a href=\"#/p5.Element/hide\">hide()</a>. The feed\ncan be drawn onto the canvas using <a href=\"#/p5/image\">image()</a>. The loadedmetadata property can\nbe used to detect when the element has fully loaded (see second example).</p>\n<p>More specific properties of the feed can be passing in a Constraints object.\nSee the\n<a href='http://w3c.github.io/mediacapture-main/getusermedia.html#media-track-constraints'> W3C\nspec</a> for possible properties. Note that not all of these are supported\nby all browsers.</p>\n<p>Security note: A new browser security specification requires that getUserMedia,\nwhich is behind <a href=\"#/p5/createCapture\">createCapture()</a>, only works when you&#39;re running the code locally,\nor on HTTPS. Learn more <a href='http://stackoverflow.com/questions/34197653/getusermedia-in-chrome-47-without-using-https'>here</a>\nand <a href='https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia'>here</a>.</p>",itemtype:"method",name:"createCapture",params:[{name:"type",description:"<p>type of capture, either VIDEO or\n                                  AUDIO if none specified, default both,\n                                  or a Constraints object</p>\n",type:"String|Constant|Object"},{name:"callback",description:"<p>function to be called once\n                                  stream has loaded</p>\n",type:"Function",optional:!0}],return:{description:'capture video <a href="#/p5.Element">p5.Element</a>',type:"p5.Element"},example:["\n<div class='norender notest'><code>\nvar capture;\n\nfunction setup() {\n  createCanvas(480, 480);\n  capture = createCapture(VIDEO);\n  capture.hide();\n}\n\nfunction draw() {\n  image(capture, 0, 0, width, width * capture.height / capture.width);\n  filter(INVERT);\n}\n</code></div>\n<div class='norender notest'><code>\nfunction setup() {\n  createCanvas(480, 120);\n  var constraints = {\n    video: {\n      mandatory: {\n        minWidth: 1280,\n        minHeight: 720\n      },\n      optional: [{ maxFrameRate: 10 }]\n    },\n    audio: true\n  };\n  createCapture(constraints, function(stream) {\n    console.log(stream);\n  });\n}\n</code></div>\n<code><div class='norender notest'>\nvar capture;\n\nfunction setup() {\n  createCanvas(640, 480);\n  capture = createCapture(VIDEO);\n}\nfunction draw() {\n  background(0);
21\n  if (capture.loadedmetadata) {\n    var c = capture.get(0, 0, 100, 100);\n    image(c, 0, 0);\n  }\n}\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1381,description:"<p>Creates element with given tag in the DOM with given content.\nAppends to the container node if one is specified, otherwise\nappends to body.</p>\n",itemtype:"method",name:"createElement",params:[{name:"tag",description:"<p>tag for the new element</p>\n",type:"String"},{name:"content",description:"<p>html content to be inserted into the element</p>\n",type:"String",optional:!0}],return:{description:'pointer to <a href="#/p5.Element">p5.Element</a> holding created node',type:"p5.Element"},example:["\n<div class='norender'><code>\ncreateElement('h2', 'im an h2 p5.element!');\n</code></div>"],class:"p5",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1407,description:"<p>Adds specified class to the element.</p>\n",itemtype:"method",name:"addClass",params:[{name:"class",description:"<p>name of class to add</p>\n",type:"String"}],chainable:1,example:["\n <div class='norender'><code>\n var div = createDiv('div');\n div.addClass('myClass');\n </code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1432,description:"<p>Removes specified class from the element.</p>\n",itemtype:"method",name:"removeClass",params:[{name:"class",description:"<p>name of class to remove</p>\n",type:"String"}],chainable:1,example:["\n <div class='norender'><code>\n // In this example, a class is set when the div is created\n // and removed when mouse is pressed. This could link up\n // with a CSS style rule to toggle style properties.\nvar div;\nfunction setup() {\n   div = createDiv('div');\n   div.addClass('myClass');\n }\nfunction mousePressed() {\n   div.removeClass('myClass');\n }\n </code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1463,description:"<p>Checks if specified class already set to element</p>\n",itemtype:"method",name:"hasClass",return:{description:"a boolean value if element has specified class",type:"Boolean"},params:[{name:"c",description:"<p>class name of class to check</p>\n",type:"String"}],example:["\n <div class='norender'><code>\n var div;\nfunction setup() {\n   div = createDiv('div');\n   div.addClass('show');\n }\nfunction mousePressed() {\n   if (div.hasClass('show')) {\n     div.addClass('show');\n   } else {\n     div.removeClass('show');\n   }\n }\n </code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1492,description:"<p>Toggles element class</p>\n",itemtype:"method",name:"toggleClass",params:[{name:"c",description:"<p>class name to toggle</p>\n",type:"String"}],chainable:1,example:["\n <div class='norender'><code>\n var div;\nfunction setup() {\n   div = createDiv('div');\n   div.addClass('show');\n }\nfunction mousePressed() {\n   div.toggleClass('show');\n }\n </code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1525,description:'<p>Attaches the element  as a child to the parent specified.\n Accepts either a string ID, DOM node, or <a href="#/p5.Element">p5.Element</a>.\n If no argument is specified, an array of children DOM nodes is returned.</p>\n',itemtype:"method",name:"child",return:{description:"an array of child nodes",type:"Node[]"},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 notest'><code>\n // this example assumes there is a div already on the page\n // with id \"myChildDiv\"\n var div0 = createDiv('this is the parent');\n var elt = document.getElementById('myChildDiv');\n div0.child(elt);
21 // use element from page\n </code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom",overloads:[{line:1525,params:[],return:{description:"an array of child nodes",type:"Node[]"}},{line:1553,params:[{name:"child",description:'<p>the ID, DOM node, or <a href="#/p5.Element">p5.Element</a>\n                        to add to the current element</p>\n',type:"String|p5.Element",optional:!0}],chainable:1}]},{file:"lib/addons/p5.dom.js",line:1575,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",itemtype:"method",name:"center",params:[{name:"align",description:"<p>passing &#39;vertical&#39;, &#39;horizontal&#39; aligns element accordingly</p>\n",type:"String",optional:!0}],chainable:1,example:["\n<div><code>\nfunction setup() {\n  var div = createDiv('').size(10, 10);\n  div.style('background-color', 'orange');\n  div.center();\n}\n</code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1629,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",return:{description:"the inner HTML of the element",type:"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",overloads:[{line:1629,params:[],return:{description:"the inner HTML of the element",type:"String"}},{line:1650,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}],chainable:1}]},{file:"lib/addons/p5.dom.js",line:1668,description:"<p>Sets the position of the element relative to (0, 0) of the\n window. Essentially, set
21s 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",return:{description:"the x and y position of the element in an object",type:"Object"},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",overloads:[{line:1668,params:[],return:{description:"the x and y position of the element in an object",type:"Object"}},{line:1687,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}],chainable:1}]},{file:"lib/addons/p5.dom.js",line:1762,description:"<p>Sets the given style (css) property (1st arg) of the element with the\ngiven value (2nd arg). If a single argument is given, .style()\nreturns the value of the given property; however, if the single argument\nis given in css syntax (&#39;text-align:center&#39;), .style() sets the css\nappropriately.</p>\n",itemtype:"method",name:"style",return:{description:"value of property",type:"String"},example:["\n<div><code class='norender'>\nvar myDiv = createDiv('I like pandas.');\nmyDiv.style('font-size', '18px');\nmyDiv.style('color', '#ff0000');\n</code></div>\n<div><code class='norender'>\nvar col = color(25, 23, 200, 50);\nvar button = createButton('button');\nbutton.style('background-color', col);\nbutton.position(10, 10);\n</code></div>\n<div><code class='norender'>\nvar myDiv;\nfunction setup() {\n  background(200);\n  myDiv = createDiv('I like gray.');\n  myDiv.position(20, 20);\n}\n\nfunction draw() {\n  myDiv.style('font-size', mouseX + 'px');\n}\n</code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom",overloads:[{line:1762,params:[{name:"property",description:"<p>property to be set</p>\n",type:"String"}],return:{description:"value of property",type:"String"}},{line:1797,params:[{name:"property",description:"",type:"String"},{name:"value",description:"<p>value to assign to property</p>\n",type:"String|Number|p5.Color"}],chainable:1,return:{description:"current value of property, if no value is given as second argument",type:"String"}}]},{file:"lib/addons/p5.dom.js",line:1851,description:"<p>Adds a new attribute or changes the value of an existing attribute\n on the specified element. If no value is specified, returns the\n value of the given attribute, or null if attribute is not set.</p>\n",itemtype:"method",name:"attribute",return:{description:"value of attribute",type:"String"},example:["\n <div class='norender'><code>\n var myDiv = createDiv('I like pandas.');\n myDiv.attribute('align', 'center');\n </code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom",overloads:[{line:1851,params:[],return:{description:"value of attribute",type:"String"}},{line:1866,params:[{name:"attr",description:"<p>attribute to set</p>\n",type:"String"},{name:"value",description:"<p>value to assign to attribute</p>\n",type:"String"}],chainable:1}]},{file:"lib/addons/p5.dom.js",line:1895,description:"<p>Removes an attribute on the specified element.</p>\n",itemtype:"method",name:"removeAttribute",params:[{name:"attr",description:"<p>attribute to remove</p>\n",type:"String"}],chainable:1,example:["\n <div><code>\n var button;\n var checkbox;\nfunction setup() {\n   checkbox = createCheckbox('enable', true);\n   checkbox.changed(enableButton);\n   button = createButton('button');\n   button.position(10, 10);\n }\nfunction enableButton() {\n   if (this.checked()) {\n     // Re-enable the button\n     button.removeAttribute('disabled');\n   } else {\n     // Disable the button\n     button.attribute('disabled', '');\n   }\n }\n </code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:1940,description:"<p>Either returns the value of the element if no arguments\ngiven, or sets the value of the element.</p>\n",itemtype:"method",name:"value",return:{description:"value of the element",type:"String|Number"},example:["\n<div class='norender'><code>\n// gets the value\nvar inp;\nfunction setup() {\n  inp = createInput('');\n}
21\n\nfunction mousePressed() {\n  print(inp.value());\n}\n</code></div>\n<div class='norender'><code>\n// sets the value\nvar inp;\nfunction setup() {\n  inp = createInput('myValue');\n}\n\nfunction mousePressed() {\n  inp.value('myValue');\n}\n</code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom",overloads:[{line:1940,params:[],return:{description:"value of the element",type:"String|Number"}},{line:1970,params:[{name:"value",description:"",type:"String|Number"}],chainable:1}]},{file:"lib/addons/p5.dom.js",line:1986,description:"<p>Shows the current element. Essentially, setting display:block for the style.</p>\n",itemtype:"method",name:"show",chainable:1,example:["\n <div class='norender'><code>\n var div = createDiv('div');\n div.style('display', 'none');\n div.show(); // turns display to block\n </code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2004,description:"<p>Hides the current element. Essentially, setting display:none for the style.</p>\n",itemtype:"method",name:"hide",chainable:1,example:["\n<div class='norender'><code>\nvar div = createDiv('this is a div');\ndiv.hide();\n</code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2020,description:"<p>Sets the width and height of the element. AUTO can be used to\n only adjust one dimension at a time. If no arguments are given, it\n returns the width and height of the element in an object. In case of\n elements which need to be loaded, such as images, it is recommended\n to call the function after the element has finished loading.</p>\n",itemtype:"method",name:"size",return:{description:"the width and height of the element in an object",type:"Object"},example:["\n <div class='norender'><code>\n let div = createDiv('this is a div');\n div.size(100, 100);\n let img = createImg('assets/laDefense.jpg', () => {\n   img.size(10, AUTO);\n });\n </code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom",overloads:[{line:2020,params:[],return:{description:"the width and height of the element in an object",type:"Object"}},{line:2039,params:[{name:"w",description:"<p>width of the element, either AUTO, or a number</p>\n",type:"Number|Constant"},{name:"h",description:"<p>height of the element, either AUTO, or a number</p>\n",type:"Number|Constant",optional:!0}],chainable:1}]},{file:"lib/addons/p5.dom.js",line:2099,description:"<p>Removes the element and deregisters all listeners.</p>\n",itemtype:"method",name:"remove",example:["\n<div class='norender'><code>\nvar myDiv = createDiv('this is some text');\nmyDiv.remove();\n</code></div>"],class:"p5.Element",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2119,description:'<p>Registers a callback that gets called every time a file that is\ndropped on the element has been loaded.\np5 will load every dropped file into memory and pass it as a p5.File object to the callback.\nMultiple files dropped at the same time will result in multiple calls to the callback.</p>\n<p>You can optionally pass a second callback which will be registered to the raw\n<a href="https://developer.mozilla.org/en-US/docs/Web/Events/drop">drop</a> event.\nThe callback will thus be provided the original\n<a href="https://developer.mozilla.org/en-US/docs/Web/API/DragEvent">DragEvent</a>.\nDropping multiple files at the same time will trigger the second callback once per drop,\nwhereas the first callback will trigger for each loaded file.</p>\n',itemtype:"method",name:"drop",params:[{name:"callback",description:"<p>callback to receive loaded file, called for each file dropped.</p>\n",type:"Function"},{name:"fxn",description:"<p>callback triggered once when files are dropped with the drop event.</p>\n",type:"Function",optional:!0}],chainable:1,example:["\n<div><code>\nfunction setup() {\n  var c = createCanvas(100, 100);\n  background(200);\n  textAlign(CENTER);\n  text('drop file', width / 2, height / 2);\n  c.drop(gotFile);\n}\n\nfunction gotFile(file) {\n  background(200);\n  text('received file:', width / 2, height / 2);\n  text(file.name, width / 2, height / 2 + 50);\n}\n</code></div>\n\n<div><code>\nvar img;\n\nfunction setup() {\n  var c = createCanvas(100, 100);\n  background(200);\n  textAlign(CENTER);\n  text('drop image', width / 2, height / 2);\n  c.drop(gotFile);\n}\n\nfunction draw() {\n  if (img) {\n    image(img, 0, 0, width, height);\n  }\n}\n\nfunction gotFile(file) {\n  img = createImg(file.data).hide();\n}\n</code></div>"],alt:"Canvas turns into whatever image is dragged/dropped onto it.",class:"p5.Element",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2253,description:"<p>Path to the media element source.</p>\n",itemtype:"property",name:"src",return:{description:"src",type:"String"},example:["\n<div><code>\nvar ele;\n\nfunction setup() {\n  background(250);\n\n  //p5.MediaElement objects are usually created\n  //by calling the createAudio(), createVideo(),\n  //and createCapture() functions.\n\n  //In this example we create\n  //a new p5.MediaElement via createAudio().\n  ele = createAudio('assets/beat.mp3');\n\n  //We'll set up our example so that\n  //when you click on the text,\n  //an alert box displays the MediaElement's\n  //src field.\n  textAlign(CENTER);\n  text('Click Me!', width / 2, height / 2);\n}\n\nfunction mouseClicked() {\n  //here we test if the mouse is over the\n  //canvas element when it's clicked\n  if (mouseX >= 0 && mouseX <= width && mouseY >= 0 && mouseY <= height) {\n    //Show our p5.MediaElement's src field\n    alert(ele.src);\n  }\n}\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2319,description:"<p>Play an HTML5 media element.</p>\n",itemtype:"method",name:"play",chainable:1,example:["\n<div><code>\nvar ele;\n\nfunction setup() {\n  //p5.MediaElement objects are usually created\n  //by calling the createAudio(), createVideo(),\n  //and createCapture() functions.\n\n  //In this example we create\n  //a new p5.MediaElement via createAudio().\n  ele = createAudio('assets/beat.mp3');\n\n  background(250);\n  textAlign(CENTER);\n  text('Click to Play!', width / 2, height / 2);\n}\n\nfunction mouseClicked() {\n  //here we test if the mouse is over the\n  //canvas element when it's clicked\n  if (mouseX >= 0 && mouseX <= width && mouseY >= 0 && mouseY <= height) {\n    //Here we call the play() function on\n    //the p5.MediaElement we created above.\n    //This will start the audio sample.\n    ele.play();\n\n    background(200);\n    text('You clicked Play!', width / 2, height / 2);\n  }\n}\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2380,description:"<p>Stops an HTML5 media element (sets current time to zero).</p>\n",itemtype:"method",name:"stop",chainable:1,example:["\n<div><code>\n//This example both starts\n//and stops a sound sample\n//when the user clicks the canvas\n\n//We will store the p5.MediaElement\n//object in here\nvar ele;\n\n//while our audio is playing,\n//this will be set to true\nvar sampleIsPlaying = false;\n\nfunction setup() {\n  //Here we create a p5.MediaElement object\n  //using the createAudio() function.\n  ele = createAudio('assets/beat.mp3');\n  background(200);\n  textAlign(CENTER);\n  text('Click to play!', width / 2, height / 2);\n}\n\nfunction mouseClicked() {\n  //here we test if the mouse is over the\n  //canvas element when it's clicked\n  if (mouseX >= 0 && mouseX <= width && mouseY >= 0 && mouseY <= height) {\n    background(200);\n\n    if (sampleIsPlaying) {\n      //if the sample is currently playing\n      //calling the stop() function on\n      //our p5.MediaElement will stop\n      //it and reset its current\n      //time to 0 (i.e. it will start\n      //at the beginning the next time\n      //you play it)\n      ele.stop();\n\n      sampleIsPlaying = false;\n      text('Click to play!', width / 2, height / 2);\n    } else {\n      //loop our sound element until we\n      //call ele.stop() on it.\n      ele.loop();\n\n      sampleIsPlaying = true;\n      text('Click to stop!', width / 2, height / 2);\n    }\n  }\n}\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2444,description:"<p>Pauses an HTML5 media element.</p>\n",itemtype:"method",name:"pause",chainable:1,example:["\n<div><code>\n//This example both starts\n//and pauses a sound sample\n//when the user clicks the canvas\n\n//We will store the p5.MediaElement\n//object in here\nvar ele;\n\n//while our audio is playing,\n//this will be set to true\nvar sampleIsPlaying = false;\n\nfunction setup() {\n  //Here we create a p5.MediaElement object\n  //using the createAudio() function.\n  ele = createAudio('assets/lucky_dragons.mp3');\n  background(200);\n  textAlign(CENTER);\n  text('Click to play!', width / 2, height / 2);\n}\n\nfunction mouseClicked() {\n  //here we test if the mouse is over the\n  //canvas element when it's clicked\n  if (mouseX >= 0 && mouseX <= width && mouseY >= 0 && mouseY <= height) {\n    background(200);\n\n    if (sampleIsPlaying) {\n      //Calling pause() on our\n      //p5.MediaElement will stop it\n      //playing, but when we call the\n      //loop() or play() functions\n      //the sample will start from\n      //where we paused it.\n      ele.pause();\n\n      sampleIsPlaying = false;\n      text('Click to resume!', width / 2, height / 2);\n    } else {\n      //loop our sound element until we\n      //call ele.pause() on it.\n      ele.loop();\n\n      sampleIsPlaying = true;\n      text('Click to pause!', width / 2, height / 2);\n    }\n  }\n}\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2506,description:"<p>Set &#39;loop&#39; to true for an HTML5 media element, and starts playing.</p>\n",itemtype:"method",name:"loop",chainable:1,example:["\n<div><code>\n//Clicking the canvas will loop\n//the audio sample until the user\n//clicks again to stop it\n\n//We will store the p5.MediaElement\n//object in here\nvar ele;\n\n//while our audio is playing,\n//this will be set to true\nvar sampleIsLooping = false;\n\nfunction setup() {\n  //Here we create a p5.MediaElement object\n  //using the createAudio() function.\n  ele = createAudio('assets/lucky_dragons.mp3');\n  background(200);\n  textAlign(CENTER);\n  text('Click to loop!', width / 2, height / 2);\n}\n\nfunction mouseClicked() {\n  //here we test if the mouse is over the\n  //canvas element when it's clicked\n  if (mouseX >= 0 && mouseX <= width && mouseY >= 0 && mouseY <= height) {\n    background(200);\n\n    if (!sampleIsLooping) {\n      //loop our sound element until we\n      //call ele.stop() on it.\n      ele.loop();\n\n      sampleIsLooping = true;\n      text('Click to stop!', width / 2, height / 2);\n    } else {\n      ele.stop();\n\n      sampleIsLooping = false;\n      text('Click to loop!', width / 2, height / 2);\n    }\n  }\n}\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2562,description:"<p>Set &#39;loop&#39; to false for an HTML5 media element. Element will stop\nwhen it reaches the end.</p>\n",itemtype:"method",name:"noLoop",chainable:1,example:["\n<div><code>\n//This example both starts\n//and stops loop of sound sample\n//when the user clicks the canvas\n\n//We will store the p5.MediaElement\n//object in here\nvar ele;\n//while our audio is playing,\n//this will be set to true\nvar sampleIsPlaying = false;\n\nfunction setup() {\n  //Here we create a p5.MediaElement object\n  //using the createAudio() function.\n  ele = createAudio('assets/beat.mp3');\n  background(200);\n  textAlign(CENTER);\n  text('Click to play!', width / 2, height / 2);\n}\n\nfunction mouseClicked() {\n  //here we test if the mouse is over the\n  //canvas element when it's clicked\n  if (mouseX >= 0 && mouseX <= width && mouseY >= 0 && mouseY <= height) {\n    background(200);\n\n    if (sampleIsPlaying) {\n      ele.noLoop();\n      text('No more Loops!', width / 2, height / 2);\n    } else {\n      ele.loop();\n      sampleIsPlaying = true;\n      text('Click to stop looping!', width / 2, height / 2);\n    }\n  }\n}\n</code></div>\n"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2614,description:"<p>
21Set HTML5 media element to autoplay or not.</p>\n",itemtype:"method",name:"autoplay",params:[{name:"autoplay",description:"<p>whether the element should autoplay</p>\n",type:"Boolean"}],chainable:1,class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2626,description:"<p>Sets volume for this HTML5 media element. If no argument is given,\nreturns the current volume.</p>\n",itemtype:"method",name:"volume",return:{description:"current volume",type:"Number"},example:["\n<div><code>\nvar ele;\nfunction setup() {\n  // p5.MediaElement objects are usually created\n  // by calling the createAudio(), createVideo(),\n  // and createCapture() functions.\n  // In this example we create\n  // a new p5.MediaElement via createAudio().\n  ele = createAudio('assets/lucky_dragons.mp3');\n  background(250);\n  textAlign(CENTER);\n  text('Click to Play!', width / 2, height / 2);\n}\nfunction mouseClicked() {\n  // Here we call the volume() function\n  // on the sound element to set its volume\n  // Volume must be between 0.0 and 1.0\n  ele.volume(0.2);\n  ele.play();\n  background(200);\n  text('You clicked Play!', width / 2, height / 2);\n}\n</code></div>\n<div><code>\nvar audio;\nvar counter = 0;\n\nfunction loaded() {\n  audio.play();\n}\n\nfunction setup() {\n  audio = createAudio('assets/lucky_dragons.mp3', loaded);\n  textAlign(CENTER);\n}\n\nfunction draw() {\n  if (counter === 0) {\n    background(0, 255, 0);\n    text('volume(0.9)', width / 2, height / 2);\n  } else if (counter === 1) {\n    background(255, 255, 0);\n    text('volume(0.5)', width / 2, height / 2);\n  } else if (counter === 2) {\n    background(255, 0, 0);\n    text('volume(0.1)', width / 2, height / 2);\n  }\n}\n\nfunction mousePressed() {\n  counter++;\n  if (counter === 0) {\n    audio.volume(0.9);\n  } else if (counter === 1) {\n    audio.volume(0.5);\n  } else if (counter === 2) {\n    audio.volume(0.1);\n  } else {\n    counter = 0;\n    audio.volume(0.9);\n  }\n}\n</code>\n</div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom",overloads:[{line:2626,params:[],return:{description:"current volume",type:"Number"}},{line:2699,params:[{name:"val",description:"<p>volume between 0.0 and 1.0</p>\n",type:"Number"}],chainable:1}]},{file:"lib/addons/p5.dom.js",line:2712,description:"<p>If no arguments are given, returns the current playback speed of the\nelement. The speed parameter sets the speed where 2.0 will play the\nelement twice as fast, 0.5 will play at half the speed, and -1 will play\nthe element in normal speed in reverse.(Note that not all browsers support\nbackward playback and even if they do, playback might not be smooth.)</p>\n",itemtype:"method",name:"speed",return:{description:"current playback speed of the element",type:"Number"},example:["\n<div class='norender notest'><code>\n//Clicking the canvas will loop\n//the audio sample until the user\n//clicks again to stop it\n\n//We will store the p5.MediaElement\n//object in here\nvar ele;\nvar button;\n\nfunction setup() {\n  createCanvas(710, 400);\n  //Here we create a p5.MediaElement object\n  //using the createAudio() function.\n  ele = createAudio('assets/beat.mp3');\n  ele.loop();\n  background(200);\n\n  button = createButton('2x speed');\n  button.position(100, 68);\n  button.mousePressed(twice_speed);\n\n  button = createButton('half speed');\n  button.position(200, 68);\n  button.mousePressed(half_speed);\n\n  button = createButton('reverse play');\n  button.position(300, 68);\n  button.mousePressed(reverse_speed);\n\n  button = createButton('STOP');\n  button.position(400, 68);\n  button.mousePressed(stop_song);\n\n  button = createButton('PLAY!');\n  button.position(500, 68);\n  button.mousePressed(play_speed);\n}\n\nfunction twice_speed() {\n  ele.speed(2);\n}\n\nfunction half_speed() {\n  ele.speed(0.5);\n}\n\nfunction reverse_speed() {\n  ele.speed(-1);\n}\n\nfunction stop_song() {\n  ele.stop();\n}\n\nfunction play_speed() {\n  ele.play();\n}\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom",overloads:[{line:2712,params:[],return:{description:"current playback speed of the element",type:"Number"}},{line:2783,params:[{name:"speed",description:"<p>speed multiplier for element playback</p>\n",type:"Number"}],chainable:1}]},{file:"lib/addons/p5.dom.js",line:2800,description:"<p>If no arguments are given, returns the current time of the element.\nIf an argument is given the current time of the element is set to it.</p>\n",itemtype:"method",name:"time",return:{description:"current time (in seconds)",type:"Number"},example:["\n<div><code>\nvar ele;\nvar beginning = true;\nfunction setup() {\n  //p5.MediaElement objects are usually created\n  //by calling the createAudio(), createVideo(),\n  //and createCapture() functions.\n\n  //In this example we create\n  //a new p5.MediaElement via createAudio().\n  ele = createAudio('assets/lucky_dragons.mp3');\n  background(250);\n  textAlign(CENTER);\n  text('start at beginning', width / 2, height / 2);\n}
21\n\n// this function fires with click anywhere\nfunction mousePressed() {\n  if (beginning === true) {\n    // here we start the sound at the beginning\n    // time(0) is not necessary here\n    // as this produces the same result as\n    // play()\n    ele.play().time(0);\n    background(200);\n    text('jump 2 sec in', width / 2, height / 2);\n    beginning = false;\n  } else {\n    // here we jump 2 seconds into the sound\n    ele.play().time(2);\n    background(250);\n    text('start at beginning', width / 2, height / 2);\n    beginning = true;\n  }\n}\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom",overloads:[{line:2800,params:[],return:{description:"current time (in seconds)",type:"Number"}},{line:2845,params:[{name:"time",description:"<p>time to jump to (in seconds)</p>\n",type:"Number"}],chainable:1}]},{file:"lib/addons/p5.dom.js",line:2859,description:"<p>Returns the duration of the HTML5 media element.</p>\n",itemtype:"method",name:"duration",return:{description:"duration",type:"Number"},example:["\n<div><code>\nvar ele;\nfunction setup() {\n  //p5.MediaElement objects are usually created\n  //by calling the createAudio(), createVideo(),\n  //and createCapture() functions.\n  //In this example we create\n  //a new p5.MediaElement via createAudio().\n  ele = createAudio('assets/doorbell.mp3');\n  background(250);\n  textAlign(CENTER);\n  text('Click to know the duration!', 10, 25, 70, 80);\n}\nfunction mouseClicked() {\n  ele.play();\n  background(200);\n  //ele.duration dislpays the duration\n  text(ele.duration() + ' seconds', width / 2, height / 2);\n}\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:2990,description:"<p>Schedule an event to be called when the audio or video\nelement reaches the end. If the element is looping,\nthis will not be called. The element is passed in\nas the argument to the onended callback.</p>\n",itemtype:"method",name:"onended",params:[{name:"callback",description:"<p>function to call when the\n                            soundfile has ended. The\n                            media element will be passed\n                            in as the argument to the\n                            callback.</p>\n",type:"Function"}],chainable:1,example:["\n<div><code>\nfunction setup() {\n  var audioEl = createAudio('assets/beat.mp3');\n  audioEl.showControls();\n  audioEl.onended(sayDone);\n}\n\nfunction sayDone(elt) {\n  alert('done playing ' + elt.src);\n}\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3021,class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3023,description:"<p>Send the audio output of this element to a specified audioNode or\np5.sound object. If no element is provided, connects to p5&#39;s master\noutput. That connection is established when this method is first called.\nAll connections are removed by the .disconnect() method.</p>\n<p>This method is meant to be used with the p5.sound.js addon library.</p>\n",itemtype:"method",name:"connect",params:[{name:"audioNode",description:"<p>AudioNode from the Web Audio API,\nor an object from the p5.sound library</p>\n",type:"AudioNode|Object"}],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3072,description:"<p>Disconnect all Web Audio routing, including to master output.\nThis is useful if you want to re-route the output through\naudio effects, for example.</p>\n",itemtype:"method",name:"disconnect",class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3087,class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3089,description:"<p>Show the default MediaElement controls, as determined by the web browser.</p>\n",itemtype:"method",name:"showControls",example:["\n<div><code>\nvar ele;\nfunction setup() {\n  //p5.MediaElement objects are usually created\n  //by calling the createAudio(), createVideo(),\n  //and createCapture() functions.\n  //In this example we create\n  //a new p5.MediaElement via createAudio()\n  ele = createAudio('assets/lucky_dragons.mp3');\n  background(200);\n  textAlign(CENTER);\n  text('Click to Show Controls!', 10, 25, 70, 80);\n}\nfunction mousePressed() {\n  ele.showControls();\n  background(200);\n  text('Controls Shown', width / 2, height / 2);\n}\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3120,description:"<p>Hide the default mediaElement controls.</p>\n",itemtype:"method",name:"hideControls",example:["\n<div><code>\nvar ele;\nfunction setup() {\n  //p5.MediaElement objects are usually created\n  //by calling the createAudio(), createVideo(),\n  //and createCapture() functions.\n  //In this example we create\n  //a new p5.MediaElement via createAudio()\n  ele = createAudio('assets/lucky_dragons.mp3');\n  ele.showControls();\n  background(200);\n  textAlign(CENTER);\n  text('Click to hide Controls!', 10, 25, 70, 80);\n}\nfunction mousePressed() {\n  ele.hideControls();\n  background(200);\n  text('Controls hidden', width / 2, height / 2);\n}\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3149,class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3160,description:"<p>Schedule events to trigger every time a MediaElement\n(audio/video) reaches a playback cue point.</p>\n<p>Accepts a callback function, a time (in seconds) at which to trigger\nthe callback, and an optional parameter for the callback.</p>\n<p>Time will be passed as the first parameter to the callback function,\nand param will be the second parameter.</p>\n",itemtype:"method",name:"addCue",params:[{name:"time",description:"<p>Time in seconds, relative to this media\n                            element&#39;s playback. For example, to trigger\n                            an event every time playback reaches two\n                            seconds, pass in the number 2. This will be\n                            passed as the first parameter to\n                            the callback function.</p>\n",type:"Number"},{name:"callback",description:"<p>Name of a function that will be\n                            called at the given time. The callback will\n                            receive time and (optionally) param as its\n                            two parameters.</p>\n",type:"Function"},{name:"value",description:"<p>An object to be passed as the\n                            second parameter to the\n                            callback function.</p>\n",type:"Object",optional:!0}],return:{description:"id ID of this cue,\n                    useful for removeCue(id)",type:"Number"},example:["\n<div><code>\n//\n//\nfunction setup() {\n  noCanvas();\n\n  var audioEl = createAudio('assets/beat.mp3');\n  audioEl.showControls();
21\n\n  // schedule three calls to changeBackground\n  audioEl.addCue(0.5, changeBackground, color(255, 0, 0));\n  audioEl.addCue(1.0, changeBackground, color(0, 255, 0));\n  audioEl.addCue(2.5, changeBackground, color(0, 0, 255));\n  audioEl.addCue(3.0, changeBackground, color(0, 255, 255));\n  audioEl.addCue(4.2, changeBackground, color(255, 255, 0));\n  audioEl.addCue(5.0, changeBackground, color(255, 255, 0));\n}\n\nfunction changeBackground(val) {\n  background(val);\n}\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3224,description:"<p>Remove a callback based on its ID. The ID is returned by the\naddCue method.</p>\n",itemtype:"method",name:"removeCue",params:[{name:"id",description:"<p>ID of the cue, as returned by addCue</p>\n",type:"Number"}],example:["\n<div><code>\nvar audioEl, id1, id2;\nfunction setup() {\n  background(255, 255, 255);\n  audioEl = createAudio('assets/beat.mp3');\n  audioEl.showControls();\n  // schedule five calls to changeBackground\n  id1 = audioEl.addCue(0.5, changeBackground, color(255, 0, 0));\n  audioEl.addCue(1.0, changeBackground, color(0, 255, 0));\n  audioEl.addCue(2.5, changeBackground, color(0, 0, 255));\n  audioEl.addCue(3.0, changeBackground, color(0, 255, 255));\n  id2 = audioEl.addCue(4.2, changeBackground, color(255, 255, 0));\n  text('Click to remove first and last Cue!', 10, 25, 70, 80);\n}\nfunction mousePressed() {\n  audioEl.removeCue(id1);\n  audioEl.removeCue(id2);\n}\nfunction changeBackground(val) {\n  background(val);\n}\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3266,description:"<p>Remove all of the callbacks that had originally been scheduled\nvia the addCue method.</p>\n",itemtype:"method",name:"clearCues",params:[{name:"id",description:"<p>ID of the cue, as returned by addCue</p>\n",type:"Number"}],example:["\n<div><code>\nvar audioEl;\nfunction setup() {\n  background(255, 255, 255);\n  audioEl = createAudio('assets/beat.mp3');\n  //Show the default MediaElement controls, as determined by the web browser\n  audioEl.showControls();\n  // schedule calls to changeBackground\n  background(200);\n  text('Click to change Cue!', 10, 25, 70, 80);\n  audioEl.addCue(0.5, changeBackground, color(255, 0, 0));\n  audioEl.addCue(1.0, changeBackground, color(0, 255, 0));\n  audioEl.addCue(2.5, changeBackground, color(0, 0, 255));\n  audioEl.addCue(3.0, changeBackground, color(0, 255, 255));\n  audioEl.addCue(4.2, changeBackground, color(255, 255, 0));\n}\nfunction mousePressed() {\n  // here we clear the scheduled callbacks\n  audioEl.clearCues();\n  // then we add some more callbacks\n  audioEl.addCue(1, changeBackground, color(2, 2, 2));\n  audioEl.addCue(3, changeBackground, color(255, 255, 0));\n}\nfunction changeBackground(val) {\n  background(val);\n}\n</code></div>"],class:"p5.MediaElement",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3332,description:"<p>Underlying File object. All normal File methods can be called on this.</p>\n",itemtype:"property",name:"file",class:"p5.File",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3344,description:"<p>File type (image, text, etc.)</p>\n",itemtype:"property",name:"type",class:"p5.File",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3350,description:"<p>File subtype (usually the file extension jpg, png, xml, etc.)</p>\n",itemtype:"property",name:"subtype",class:"p5.File",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3356,description:"<p>File name</p>\n",itemtype:"property",name:"name",class:"p5.File",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3362,description:"<p>File size</p>\n",itemtype:"property",name:"size",class:"p5.File",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.dom.js",line:3369,description:"<p>URL string containing image data.</p>\n",itemtype:"property",name:"data",class:"p5.File",module:"p5.dom",submodule:"p5.dom"},{file:"lib/addons/p5.sound.js",line:46,description:'<p>p5.sound \n<a href="https://p5js.org/reference/#/libraries/p5.sound">https://p5js.org/reference/#/libraries/p5.sound</a></p>\n<p>From the Processing Foundation and contributors\n<a href="https://github.com/processing/p5.js-sound/graphs/contributors">https://github.com/processing/p5.js-sound/graphs/contributors</a></p>\n<p>MIT License (MIT)\n<a href="https://github.com/processing/p5.js-sound/blob/master/LICENSE">https://github.com/processing/p5.js-sound/blob/master/LICENSE</a></p>\n<p>Some of the many audio libraries &amp; resources that inspire p5.sound:</p>\n<ul>\n<li>TONE.js (c) Yotam Mann. Licensed under The MIT License (MIT). <a href="https://github.com/TONEnoTONE/Tone.js">https://github.com/TONEnoTONE/Tone.js</a></li>\n<li>buzz.js (c) Jay Salvat. Licensed under The MIT License (MIT). <a href="http://buzz.jaysalvat.com/">http://buzz.jaysalvat.com/</a></li>\n<li>Boris Smus Web Audio API book, 2013. Licensed under the Apache License <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a></li>\n<li>wavesurfer.js <a href="https://github.com/katspaugh/wavesurfer.js">https://github.com/katspaugh/wavesurfer.js</a></li>\n<li>Web Audio Components by Jordan Santell <a href="https://github.com/web-audio-components">https://github.com/web-audio-components</a></li>\n<li><p>Wilm Thoben&#39;s Sound library for Processing <a href="https://github.com/processing/processing/tree/master/java/libraries/sound">https://github.com/processing/processing/tree/master/java/libraries/sound</a></p>\n<p>Web Audio API: <a href="http://w3.org/TR/webaudio/">http://w3.org/TR/webaudio/</a></p>\n</li>\n</ul>\n',class:"p5.sound",module:"p5.sound",submodule:"p5.sound"}
21,{file:"lib/addons/p5.sound.js",line:214,description:"<p>Determine which filetypes are supported (inspired by buzz.js)\nThe audio element (el) will only be used to test browser support for various audio formats</p>\n",class:"p5.sound",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:363,class:"p5.sound",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:740,class:"p5.sound",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:810,class:"p5.sound",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1005,description:"<p>Returns the Audio Context for this sketch. Useful for users\nwho would like to dig deeper into the <a target='_blank' href=\n'http://webaudio.github.io/web-audio-api/'>Web Audio API\n</a>.</p>\n\n<p>Some browsers require users to startAudioContext\nwith a user gesture, such as touchStarted in the example below.</p>",itemtype:"method",name:"getAudioContext",return:{description:"AudioContext for this sketch",type:"Object"},example:["\n<div><code>\n function draw() {\n   background(255);\n   textAlign(CENTER);\n\n   if (getAudioContext().state !== 'running') {\n     text('click to start audio', width/2, height/2);\n   } else {\n     text('audio is enabled', width/2, height/2);\n   }\n }\n\n function touchStarted() {\n   if (getAudioContext().state !== 'running') {\n     getAudioContext().resume();\n   }\n   var synth = new p5.MonoSynth();\n   synth.play('A4', 0.5, 0, 0.2);\n }\n\n</div></code>"],class:"p5.sound",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1042,description:'<p>It is a good practice to give users control over starting audio playback.\nThis practice is enforced by Google Chrome&#39;s autoplay policy as of r70\n(<a href="https://goo.gl/7K7WLu">info</a>), iOS Safari, and other browsers.\n</p>\n\n<p>\nuserStartAudio() starts the <a href="https://developer.mozilla.org/en-US/docs/Web/API/AudioContext"\ntarget="_blank" title="Audio Context @ MDN">Audio Context</a> on a user gesture. It utilizes\nthe <a href="https://github.com/tambien/StartAudioContext">StartAudioContext</a> library by\nYotam Mann (MIT Licence, 2016). Read more at <a href="https://github.com/tambien/StartAudioContext">https://github.com/tambien/StartAudioContext</a>.\n</p>\n\n<p>Starting the audio context on a user gesture can be as simple as <code>userStartAudio()</code>.\nOptional parameters let you decide on a specific element that will start the audio context,\nand/or call a function once the audio context is started.</p>',params:[{name:"element(s)",description:"<p>This argument can be an Element,\n                              Selector String, NodeList, p5.Element,\n                              jQuery Element, or an Array of any of those.</p>\n",type:"Element|Array",optional:!0},{name:"callback",description:"<p>Callback to invoke when the AudioContext has started</p>\n",type:"Function",optional:!0}],return:{description:"Returns a Promise which is resolved when\n                                     the AudioContext state is 'running'",type:"Promise"},itemtype:"method",name:"userStartAudio",example:["\n<div><code>\nfunction setup() {\n  var myDiv = createDiv('click to start audio');\n  myDiv.position(0, 0);\n\n  var mySynth = new p5.MonoSynth();\n\n  // This won't play until the context has started\n  mySynth.play('A6');\n\n  // Start the audio context on a click/touch event\n  userStartAudio().then(function() {\n     myDiv.remove();\n   });\n}\n</code></div>"],class:"p5.sound",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1099,description:"<p>Master contains AudioContext and the master sound output.</p>\n",class:"p5.sound",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1132,description:"<p>Returns a number representing the master amplitude (volume) for sound\nin this sketch.</p>\n",itemtype:"method",name:"getMasterVolume",return:{description:"Master amplitude (volume) for sound in this sketch.\n                 Should be between 0.0 (silence) and 1.0.",type:"Number"},class:"p5.sound",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1143,description:"<p>Scale the output of all sound in this sketch</p>\nScaled between 0.0 (silence) and 1.0 (full volume).\n1.0 is the maximum amplitude of a digital sound, so multiplying\nby greater than 1.0 may cause digital distortion. To\nfade, provide a <code>rampTime</code> parameter. For more\ncomplex fades, see the Envelope class.\n\nAlternately, you can pass in a signal source such as an\noscillator to modulate the amplitude with an audio signal.\n\n<p><b>How This Works</b>: When you load the p5.sound module, it\ncreates a single instance of p5sound. All sound objects in this\nmodule output to p5sound before reaching your computer&#39;s output.\nSo if you change the amplitude of p5sound, it impacts all of the\nsound in this module.</p>\n\n<p>If no value is provided, returns a Web Audio API Gain Node</p>",itemtype:"method",name:"masterVolume",params:[{name:"volume",description:"<p>Volume (amplitude) between 0.0\n                                   and 1.0 or modulating signal/oscillator</p>\n",type:"Number|Object"},{name:"rampTime",description:"<p>Fade for t seconds</p>\n",type:"Number",optional:!0},{name:"timeFromNow",description:"<p>Schedule this event to happen at\n                               t seconds 
21in the future</p>\n",type:"Number",optional:!0}],class:"p5.sound",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1185,description:"<p><code>p5.soundOut</code> is the p5.sound master output. It sends output to\nthe destination of this window&#39;s web audio context. It contains\nWeb Audio API nodes including a dyanmicsCompressor (<code>.limiter</code>),\nand Gain Nodes for <code>.input</code> and <code>.output</code>.</p>\n",itemtype:"property",name:"soundOut",type:"Object",class:"p5.sound",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1210,class:"p5",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1213,description:"<p>Returns a number representing the sample rate, in samples per second,\nof all sound objects in this audio context. It is determined by the\nsampling rate of your operating system&#39;s sound card, and it is not\ncurrently possile to change.\nIt is often 44100, or twice the range of human hearing.</p>\n",itemtype:"method",name:"sampleRate",return:{description:"samplerate samples per second",type:"Number"},class:"p5",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1226,description:"<p>Returns the closest MIDI note value for\na given frequency.</p>\n",itemtype:"method",name:"freqToMidi",params:[{name:"frequency",description:"<p>A freqeuncy, for example, the &quot;A&quot;\n                           above Middle C is 440Hz</p>\n",type:"Number"}],return:{description:"MIDI note value",type:"Number"},class:"p5",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1240,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:1302,description:'<p>List the SoundFile formats that you will include. LoadSound\nwill search your directory for these extensions, and will pick\na format that is compatable with the client&#39;s web browser.\n<a href="http://media.io/">Here</a> is a free online file\nconverter.</p>\n',itemtype:"method",name:"soundFormats",params:[{name:"formats",description:"<p>i.e. &#39;mp3&#39;, &#39;wav&#39;, &#39;ogg&#39;</p>\n",type:"String",optional:!0,multiple:!0}],example:["\n<div><code>\nfunction preload() {\n  // set the global sound formats\n  soundFormats('mp3', 'ogg');\n\n  // load either beatbox.mp3, or .ogg, depending on browser\n  mySound = loadSound('assets/beatbox.mp3');\n}\n\nfunction setup() {\n  mySound.play();\n}\n</code></div>"],class:"p5",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1415,description:"<p>Used by Osc and Envelope to chain signal math</p>\n",class:"p5",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1763,description:'<p>loadSound() returns a new p5.SoundFile from a specified\npath. If called during preload(), the p5.SoundFile will be ready\nto play in time for setup() and draw(). If called outside of\npreload, the p5.SoundFile will not be ready immediately, so\nloadSound accepts a callback as the second parameter. Using a\n<a href="https://github.com/processing/p5.js/wiki/Local-server">\nlocal server</a> is recommended when loading external files.</p>\n',itemtype:"method",name:"loadSound",params:[{name:"path",description:"<p>Path to the sound file, or an array with\n                                  paths to soundfiles in multiple formats\n                                  i.e. [&#39;sound.ogg&#39;, &#39;sound.mp3&#39;].\n                                  Alternately, accepts an object: either\n                                  from the HTML5 File API, or a p5.File.</p>\n",type:"String|Array"},{name:"successCallback",description:"<p>Name of a function to call once file loads</p>\n",type:"Function",optional:!0},{name:"errorCallback",description:"<p>Name of a function to call if there is\n                                    an error loading the file.</p>\n",type:"Function",optional:!0},{name:"whileLoading",description:"<p>Name of a function to call while file is loading.\n                               This function will receive the percentage loaded\n                               so far, from 0.0 to 1.0.</p>\n",type:"Function",optional:!0}],return:{description:"Returns a p5.SoundFile",type:"SoundFile"},example:["\n<div><code>\nfunction preload() {\n mySound = loadSound('assets/doorbell.mp3');\n}\n\nfunction setup() {\n  mySound.setVolume(0.1);\n  mySound.play();\n}\n</code></div>"],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1919,description:"<p>Returns true if the sound file finished loading successfully.</p>\n",itemtype:"method",name:"isLoaded",return:{description:"",type:"Boolean"},class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:1932,description:"<p>Play the p5.SoundFile</p>\n",itemtype:"method",name:"play",params:[{name:"startTime",description:"<p>(optional) schedule playback to start (in seconds from now).</p>\n",type:"Number",optional:!0},{name:"rate",description:"<p>(optional) playback rate</p>\n",type:"Number",optional:!0},{name:"amp",description:"<p>(optional) amplitude (volume)\n                                    of playback</p>\n",type:"Number",optional:!0},{name:"cueStart",description:"<p>(optional) cue start time in seconds</p>\n",type:"Number",optional:!0},{name:"duration",description:"<p>(optional) duration of playback in seconds</p>\n",type:"Number",optional:!0}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2022,description:"<p>p5.SoundFile has two play modes: <code>restart</code> and\n<code>sustain</code>. Play Mode determines what happens to a\np5.SoundFile if it is triggered while in the middle of playback.\nIn sustain mode, playback will continue simultaneous to the\nnew playback. In restart mode, play() will stop playback\nand start over. With untilDone, a sound will play only if it&#39;s\nnot already playing. Sustain is the default mode.</p>\n",itemtype:"method",name:"playMode",params:[{name:"str",description:"<p>&#39;restart&#39; or &#39;sustain&#39; or &#39;untilDone&#39;</p>\n",type:"String"}],example:["\n<div><code>\nvar mySound;\nfunction preload(){\n  mySound = loadSound('assets/Damscray_DancingTiger.mp3');\n}\nfunction mouseClicked() {\n  mySound.playMode('sustain');\n  mySound.play();\n}\nfunction keyPressed() {\n  mySound.playMode('restart');\n  mySound.play();\n}\n\n </code></div>"],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2066,description:"<p>Pauses a file that is currently playing. If the file is not\nplaying, then nothing will happen.</p>\n<p>After pausing, .play() will resume from the paused\nposition.\nIf p5.SoundFile had been set to loop before it was paused,\nit will continue to loop after it is unpaused with .play().</p>\n",itemtype:"method",name:"pause",params:[{name:"startTime",description:"<p>(optional) schedule event to occur\n                             seconds from now</p>\n",type:"Number",optional:!0}],example:["\n<div><code>\nvar soundFile;\n\nfunction preload() {\n  soundFormats('ogg', 'mp3');\n  soundFile = loadSound('assets/Damscray_-_Dancing_Tiger_02.mp3');\n}\nfunction setup() {\n  background(0, 255, 0);\n  soundFile.setVolume(0.1);\n  soundFile.loop();\n}\nfunction keyTyped() {\n  if (key == 'p') {\n    soundFile.pause();\n    background(255, 0, 0);\n  }\n}\n\nfunction keyReleased() {\n  if (key == 'p') {\n    soundFile.play();\n    background(0, 255, 0);\n  }\n}\n</code>\n</div>"],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2122,description:"<p>
21Loop the p5.SoundFile. Accepts optional parameters to set the\nplayback rate, playback volume, loopStart, loopEnd.</p>\n",itemtype:"method",name:"loop",params:[{name:"startTime",description:"<p>(optional) schedule event to occur\n                            seconds from now</p>\n",type:"Number",optional:!0},{name:"rate",description:"<p>(optional) playback rate</p>\n",type:"Number",optional:!0},{name:"amp",description:"<p>(optional) playback volume</p>\n",type:"Number",optional:!0},{name:"cueLoopStart",description:"<p>(optional) startTime in seconds</p>\n",type:"Number",optional:!0},{name:"duration",description:"<p>(optional) loop duration in seconds</p>\n",type:"Number",optional:!0}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2138,description:"<p>Set a p5.SoundFile&#39;s looping flag to true or false. If the sound\nis currently playing, this change will take effect when it\nreaches the end of the current playback.</p>\n",itemtype:"method",name:"setLoop",params:[{name:"Boolean",description:"<p>set looping to true or false</p>\n",type:"Boolean"}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2159,description:"<p>Returns &#39;true&#39; if a p5.SoundFile is currently looping and playing, &#39;false&#39; if not.</p>\n",itemtype:"method",name:"isLooping",return:{description:"",type:"Boolean"},class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2174,description:"<p>Returns true if a p5.SoundFile is playing, false if not (i.e.\npaused or stopped).</p>\n",itemtype:"method",name:"isPlaying",return:{description:"",type:"Boolean"},class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2184,description:"<p>Returns true if a p5.SoundFile is paused, false if not (i.e.\nplaying or stopped).</p>\n",itemtype:"method",name:"isPaused",return:{description:"",type:"Boolean"},class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2194,description:"<p>Stop soundfile playback.</p>\n",itemtype:"method",name:"stop",params:[{name:"startTime",description:"<p>(optional) schedule event to occur\n                            in seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2239,description:"<p>Multiply the output volume (amplitude) of a sound file\nbetween 0.0 (silence) and 1.0 (full volume).\n1.0 is the maximum amplitude of a digital sound, so multiplying\nby greater than 1.0 may cause digital distortion. To\nfade, provide a <code>rampTime</code> parameter. For more\ncomplex fades, see the Envelope class.</p>\n<p>Alternately, you can pass in a signal source such as an\noscillator to modulate the amplitude with an audio signal.</p>\n",itemtype:"method",name:"setVolume",params:[{name:"volume",description:"<p>Volume (amplitude) between 0.0\n                                   and 1.0 or modulating signal/oscillator</p>\n",type:"Number|Object"},{name:"rampTime",description:"<p>Fade for t seconds</p>\n",type:"Number",optional:!0},{name:"timeFromNow",description:"<p>Schedule this event to happen at\n                               t seconds in the future</p>\n",type:"Number",optional:!0}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2280,description:"<p>Set the stereo panning of a p5.sound object to\na floating point number between -1.0 (left) and 1.0 (right).\nDefault is 0.0 (center).</p>\n",itemtype:"method",name:"pan",params:[{name:"panValue",description:"<p>Set the stereo panner</p>\n",type:"Number",optional:!0},{name:"timeFromNow",description:"<p>schedule this event to happen\n                                seconds from now</p>\n",type:"Number",optional:!0}],example:["\n<div><code>\n\n var ball = {};\n var soundFile;\n\n function preload() {\n   soundFormats('ogg', 'mp3');\n   soundFile = loadSound('assets/beatbox.mp3');\n }\n\n function draw() {\n   background(0);\n   ball.x = constrain(mouseX, 0, width);\n   ellipse(ball.x, height/2, 20, 20)\n }\n\n function mousePressed(){\n   // map the ball's x location to a panning degree\n   // between -1.0 (left) and 1.0 (right)\n   var panning = map(ball.x, 0., width,-1.0, 1.0);
21\n   soundFile.pan(panning);\n   soundFile.play();\n }\n </div></code>"],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2319,description:"<p>Returns the current stereo pan position (-1.0 to 1.0)</p>\n",itemtype:"method",name:"getPan",return:{description:"Returns the stereo pan setting of the Oscillator\n                         as a number between -1.0 (left) and 1.0 (right).\n                         0.0 is center and default.",type:"Number"},class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2330,description:"<p>Set the playback rate of a sound file. Will change the speed and the pitch.\nValues less than zero will reverse the audio buffer.</p>\n",itemtype:"method",name:"rate",params:[{name:"playbackRate",description:"<p>Set the playback rate. 1.0 is normal,\n                                   .5 is half-speed, 2.0 is twice as fast.\n                                   Values less than zero play backwards.</p>\n",type:"Number",optional:!0}],example:["\n<div><code>\nvar song;\n\nfunction preload() {\n  song = loadSound('assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup() {\n  song.loop();\n}\n\nfunction draw() {\n  background(200);\n\n  // Set the rate to a range between 0.1 and 4\n  // Changing the rate also alters the pitch\n  var speed = map(mouseY, 0.1, height, 0, 2);\n  speed = constrain(speed, 0.01, 4);\n  song.rate(speed);\n\n  // Draw a circle to show what is going on\n  stroke(0);\n  fill(51, 100);\n  ellipse(mouseX, 100, 48, 48);\n}\n\n </code>\n </div>\n"],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2403,description:"<p>Returns the duration of a sound file in seconds.</p>\n",itemtype:"method",name:"duration",return:{description:"The duration of the soundFile in seconds.",type:"Number"},class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2417,description:"<p>Return the current position of the p5.SoundFile playhead, in seconds.\nTime is relative to the normal buffer direction, so if <code>reverseBuffer</code>\nhas been called, currentTime will count backwards.</p>\n",itemtype:"method",name:"currentTime",return:{description:"currentTime of the soundFile in seconds.",type:"Number"},class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2428,description:"<p>Move the playhead of the song to a position, in seconds. Start timing\nand playback duration. If none are given, will reset the file to play\nentire duration from start to finish.</p>\n",itemtype:"method",name:"jump",params:[{name:"cueTime",description:"<p>cueTime of the soundFile in seconds.</p>\n",type:"Number"},{name:"duration",description:"<p>duration in seconds.</p>\n",type:"Number"}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2451,description:"<p>Return the number of channels in a sound file.\nFor example, Mono = 1, Stereo = 2.</p>\n",itemtype:"method",name:"channels",return:{description:"[channels]",type:"Number"},class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2461,description:"<p>Return the sample rate of the sound file.</p>\n",itemtype:"method",name:"sampleRate",return:{description:"[sampleRate]",type:"Number"},class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2470,description:"<p>Return the number of samples in a sound file.\nEqual to sampleRate * duration.</p>\n",itemtype:"method",name:"frames",return:{description:"[sampleCount]",type:"Number"},class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2480,description:"<p>Returns an array of amplitude peaks in a p5.SoundFile that can be\nused to draw a static waveform. Scans through the p5.SoundFile&#39;s\naudio buffer to find the greatest amplitudes. Accepts one\nparameter, &#39;length&#39;, which determines size of the array.\nLarger arrays result in more precise waveform visualizations.</p>\n<p>Inspired by Wavesurfer.js.</p>\n",itemtype:"method",name:"getPeaks",params:[{name:"length",description:"<p>length is the size of the returned array.\n                         Larger length results in more precision.\n                         Defaults to 5*width of the browser window.</p>\n",type:"Number",optional:!0}],return:{description:"Array of peaks.",type:"Float32Array"},class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2532,description:"<p>Reverses the p5.SoundFile&#39;s buffer source.\nPlayback must be handled separately (see example).</p>\n",itemtype:"method",name:"reverseBuffer",example:["\n<div><code>\nvar drum;\n\nfunction preload() {\n  drum = loadSound('assets/drum.mp3');\n}\n\nfunction setup() {\n  drum.reverseBuffer();\n  drum.play();\n}\n\n </code>\n </div>"],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2572,description:"<p>Schedule an event to be called when the soundfile\nreaches the end of a buffer. If the soundfile is\nplaying through once, this will be called when it\nends. If it is looping, it will be called when\nstop is called.</p>\n",itemtype:"method",name:"onended",params:[{name:"callback",description:"<p>function to call when the\n                            soundfile has ended.</p>\n",type:"Function"}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2625,description:"<p>Connects the output of a p5sound object to input of another\np5.sound object. For example, you may connect a p5.SoundFile to an\nFFT or an Effect. If no parameter is given, it will connect to\nthe master output. Most p5sound objects connect to the master\noutput when they are created.</p>\n",itemtype:"method",name:"connect",params:[{name:"object",description:"<p>Audio object that accepts an input</p>\n",type:"Object",optional:!0}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2646,description:"<p>Disconnects the output of this p5sound object.</p>\n",itemtype:"method",name:"disconnect",class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2656,class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2661,description:"<p>
21Reset the source for this SoundFile to a\nnew path (URL).</p>\n",itemtype:"method",name:"setPath",params:[{name:"path",description:"<p>path to audio file</p>\n",type:"String"},{name:"callback",description:"<p>Callback</p>\n",type:"Function"}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2674,description:"<p>Replace the current Audio Buffer with a new Buffer.</p>\n",itemtype:"method",name:"setBuffer",params:[{name:"buf",description:"<p>Array of Float32 Array(s). 2 Float32 Arrays\n                   will create a stereo source. 1 will create\n                   a mono source.</p>\n",type:"Array"}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2741,description:"<p>processPeaks returns an array of timestamps where it thinks there is a beat.</p>\n<p>This is an asynchronous function that processes the soundfile in an offline audio context,\nand sends the results to your callback function.</p>\n<p>The process involves running the soundfile through a lowpass filter, and finding all of the\npeaks above the initial threshold. If the total number of peaks are below the minimum number of peaks,\nit decreases the threshold and re-runs the analysis until either minPeaks or minThreshold are reached.</p>\n",itemtype:"method",name:"processPeaks",params:[{name:"callback",description:"<p>a function to call once this data is returned</p>\n",type:"Function"},{name:"initThreshold",description:"<p>initial threshold defaults to 0.9</p>\n",type:"Number",optional:!0},{name:"minThreshold",description:"<p>minimum threshold defaults to 0.22</p>\n",type:"Number",optional:!0},{name:"minPeaks",description:"<p>minimum number of peaks defaults to 200</p>\n",type:"Number",optional:!0}],return:{description:"Array of timestamped peaks",type:"Array"},class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2934,class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:2943,description:"<p>Schedule events to trigger every time a MediaElement\n(audio/video) reaches a playback cue point.</p>\n<p>Accepts a callback function, a time (in seconds) at which to trigger\nthe callback, and an optional parameter for the callback.</p>\n<p>Time will be passed as the first parameter to the callback function,\nand param will be the second parameter.</p>\n",itemtype:"method",name:"addCue",params:[{name:"time",description:"<p>Time in seconds, relative to this media\n                           element&#39;s playback. For example, to trigger\n                           an event every time playback reaches two\n                           seconds, pass in the number 2. This will be\n                           passed as the first parameter to\n                           the callback function.</p>\n",type:"Number"},{name:"callback",description:"<p>Name of a function that will be\n                           called at the given time. The callback will\n                           receive time and (optionally) param as its\n                           two parameters.</p>\n",type:"Function"},{name:"value",description:"<p>An object to be passed as the\n                           second parameter to the\n                           callback function.</p>\n",type:"Object",optional:!0}],return:{description:"id ID of this cue,\n                    useful for removeCue(id)",type:"Number"},example:['\n<div><code>\nvar mySound;\nfunction preload() {\n  mySound = loadSound(\'assets/beat.mp3\');\n}\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  // schedule calls to changeText\n  mySound.addCue(0.50, changeText, "hello" );\n  mySound.addCue(1.00, changeText, "p5" );\n  mySound.addCue(1.50, changeText, "what" );\n  mySound.addCue(2.00, changeText, "do" );\n  mySound.addCue(2.50, changeText, "you" );\n  mySound.addCue(3.00, changeText, "want" );\n  mySound.addCue(4.00, changeText, "to" );\n  mySound.addCue(5.00, changeText, "make" );
21\n  mySound.addCue(6.00, changeText, "?" );\n}\n\nfunction changeText(val) {\n  background(0);\n  text(val, width/2, height/2);\n}\n\nfunction mouseClicked() {\n  if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n    if (mySound.isPlaying() ) {\n      mySound.stop();\n    } else {\n      mySound.play();\n    }\n  }\n}\n</code></div>'],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3021,description:"<p>Remove a callback based on its ID. The ID is returned by the\naddCue method.</p>\n",itemtype:"method",name:"removeCue",params:[{name:"id",description:"<p>ID of the cue, as returned by addCue</p>\n",type:"Number"}],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3040,description:"<p>Remove all of the callbacks that had originally been scheduled\nvia the addCue method.</p>\n",itemtype:"method",name:"clearCues",class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3065,description:'<p>Save a p5.SoundFile as a .wav file. The browser will prompt the user\nto download the file to their device. To upload a file to a server, see\n<a href="/docs/reference/#/p5.SoundFile/getBlob">getBlob</a></p>\n',itemtype:"method",name:"save",params:[{name:"fileName",description:"<p>name of the resulting .wav file.</p>\n",type:"String",optional:!0}],example:["\n <div><code>\n var inp, button, mySound;\n var fileName = 'cool';\n function preload() {\n   mySound = loadSound('assets/doorbell.mp3');\n }\n function setup() {\n   btn = createButton('click to save file');\n   btn.position(0, 0);\n   btn.mouseClicked(handleMouseClick);\n }\n\n function handleMouseClick() {\n   mySound.save(fileName);\n }\n</code></div>"],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3094,description:'<p>This method is useful for sending a SoundFile to a server. It returns the\n.wav-encoded audio data as a &quot;<a target="_blank" title="Blob reference at\nMDN" href="https://developer.mozilla.org/en-US/docs/Web/API/Blob">Blob</a>&quot;.\nA Blob is a file-like data object that can be uploaded to a server\nwith an <a href="/docs/reference/#/p5/httpDo">http</a> request. We&#39;ll\nuse the <code>httpDo</code> options object to send a POST request with some\nspecific options: we encode the request as <code>multipart/form-data</code>,\nand attach the blob as one of the form values using <code>FormData</code>.</p>\n',itemtype:"method",name:"getBlob",return:{description:"A file-like data object",type:"Blob"},example:["\n <div><code>\n\n function preload() {\n   mySound = loadSound('assets/doorbell.mp3');\n }\n\n function setup() {\n   noCanvas();\n   var soundBlob = mySound.getBlob();\n\n   // Now we can send the blob to a server...\n   var serverUrl = 'https://jsonplaceholder.typicode.com/posts';\n   var httpRequestOptions = {\n     method: 'POST',\n     body: new FormData().append('soundBlob', soundBlob),\n     headers: new Headers({\n       'Content-Type': 'multipart/form-data'\n     })\n   };\n   httpDo(serverUrl, httpRequestOptions);\n\n   // We can also create an `ObjectURL` pointing to the Blob\n   var blobUrl = URL.createObjectURL(soundBlob);\n\n   // The `<Audio>` Element accepts Object URL's\n   var htmlAudioElt = createAudio(blobUrl).showControls();\n\n   createDiv();\n\n   // The ObjectURL exists as long as this tab is open\n   var input = createInput(blobUrl);\n   input.attribute('readonly', true);\n   input.mouseClicked(function() { input.elt.select() });\n }\n\n</code></div>"],class:"p5.SoundFile",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3257,description:"<p>Connects to the p5sound instance (master output) by default.\nOptionally, you can pass in a specific source (i.e. a soundfile).</p>\n",itemtype:"method",name:"setInput",params:[{name:"snd",description:"<p>set the sound source\n                                     (optional, defaults to\n                                     master output)</p>\n",type:"SoundObject|undefined",optional:!0},{name:"smoothing",description:"<p>a range between 0.0 and 1.0\n                                      to smooth amplitude readings</p>\n",type:"Number|undefined",optional:!0}],example:["\n<div><code>\nfunction preload(){\n  sound1 = loadSound('assets/beat.mp3');\n  sound2 = loadSound('assets/drum.mp3');\n}\nfunction setup(){\n  amplitude = new p5.Amplitude();\n  sound1.play();\n  sound2.play();\n  amplitude.setInput(sound2);\n}\nfunction draw() {\n  background(0);\n  fill(255);\n  var level = amplitude.getLevel();\n  var size = map(level, 0, 1, 0, 200);\n  ellipse(width/2, height/2, size, size);\n}\nfunction mouseClicked(){\n  sound1.stop();\n  sound2.stop();\n}\n</code></div>"],class:"p5.Amplitude",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3364,description:"<p>Returns a single Amplitude reading at the moment it is called.\nFor continuous readings, run in the draw loop.</p>\n",itemtype:"method",name:"getLevel",params:[{name:"channel",description:"<p>Optionally return only channel 0 (left) or 1 (right)</p>\n",type:"Number",optional:!0}],return:{description:"Amplitude as a number between 0.0 and 1.0",type:"Number"},example:["\n<div><code>\nfunction preload(){\n  sound = loadSound('assets/beat.mp3');\n}\nfunction setup() {\n  amplitude = new p5.Amplitude();\n  sound.play();\n}\nfunction draw() {\n  background(0);\n  fill(255);\n  var level = amplitude.getLevel();\n  var size = map(level, 0, 1, 0, 200);\n  ellipse(width/2, height/2, size, size);\n}\nfunction mouseClicked(){\n  sound.stop();\n}\n</code></div>"],class:"p5.Amplitude",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3405,description:"<p>Determines whether the results of Amplitude.process() will be\nNormalized. To normalize, Amplitude finds the difference the\nloudest reading it has processed and the maximum amplitude of\n1.0. Amplitude adds this difference to all values to produce\nresults that will reliably map between 0.0 and 1.0. However,\nif a louder moment occurs, the amount that Normalize adds to\nall the values will change. Accepts an optional boolean parameter\n(true or false). Normalizing is off by default.</p>\n",itemtype:"method",name:"toggleNormalize",params:[{name:"boolean",description:"<p>set normalize to true (1) or false (0)</p>\n",type:"Boolean",optional:!0}],class:"p5.Amplitude",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3425,description:"<p>Smooth Amplitude analysis by averaging with the last analysis\nframe. Off by default.</p>\n",itemtype:"method",name:"smooth",params:[{name:"set",description:"<p>smoothing from 0.0 &lt;= 1</p>\n",type:"Number"}],class:"p5.Amplitude",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3599,description:"<p>Set the input source for the FFT analysis. If no source is\nprovided, FFT will analyze all sound in the sketch.</p>\n",itemtype:"method",name:"setInput",params:[{name:"source",description:"<p>p5.sound object (or web audio API source node)</p>\n",type:"Object",optional:!0}],class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3618,description:"<p>Returns an array of amplitude values (between -1.0 and +1.0) that represent\na snapshot of amplitude readings in a single buffer. Length will be\nequal to bins (defaults to 1024). Can be used to draw the waveform\nof a sound.</p>\n",itemtype:"method",name:"waveform",params:[{name:"bins",description:"<p>Must be a power of two between\n                          16 and 1024. Defaults to 1024.</p>\n",type:"Number",optional:!0},{name:"precision",description:"<p>If any value is provided, will return results\n                            in a Float32 Array which is more precise\n                            than a regular array.</p>\n",type:"String",optional:!0}],return:{description:"Array    Array of amplitude values (-1 to 1)\n                          over time. Array length = bins.",type:"Array"},class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3661,description:"<p>Returns an array of amplitude values (between 0 and 255)\nacross the frequency spectrum. Length is equal to FFT bins\n(1024 by default). The array indices correspond to frequencies\n(i.e. pitches), from the lowest to the highest that humans can\nhear. Each value represents amplitude at that slice of the\nfrequency spectrum. Must be called prior to using\n<code>getEnergy()</code>.</p>\n",itemtype:"method",name:"analyze",params:[{name:"bins",description:"<p>Must be a power of two between\n                           16 and 1024. Defaults to 1024.</p>\n",type:"Number",optional:!0},{name:"scale",description:"<p>If &quot;dB,&quot; returns decibel\n                           float measurements between\n                           -14
210 and 0 (max).\n                           Otherwise returns integers from 0-255.</p>\n",type:"Number",optional:!0}],return:{description:"spectrum    Array of energy (amplitude/volume)\n                            values across the frequency spectrum.\n                            Lowest energy (silence) = 0, highest\n                            possible is 255.",type:"Array"},example:["\n<div><code>\nvar osc;\nvar fft;\n\nfunction setup(){\n  createCanvas(100,100);\n  osc = new p5.Oscillator();\n  osc.amp(0);\n  osc.start();\n  fft = new p5.FFT();\n}\n\nfunction draw(){\n  background(0);\n\n  var freq = map(mouseX, 0, 800, 20, 15000);\n  freq = constrain(freq, 1, 20000);\n  osc.freq(freq);\n\n  var spectrum = fft.analyze();\n  noStroke();\n  fill(0,255,0); // spectrum is green\n  for (var i = 0; i< spectrum.length; i++){\n    var x = map(i, 0, spectrum.length, 0, width);\n    var h = -height + map(spectrum[i], 0, 255, height, 0);\n    rect(x, height, width / spectrum.length, h );\n  }\n\n  stroke(255);\n  text('Freq: ' + round(freq)+'Hz', 10, 10);\n\n  isMouseOverCanvas();\n}\n\n// only play sound when mouse is over canvas\nfunction isMouseOverCanvas() {\n  var mX = mouseX, mY = mouseY;\n  if (mX > 0 && mX < width && mY < height && mY > 0) {\n    osc.amp(0.5, 0.2);\n  } else {\n    osc.amp(0, 0.2);\n  }\n}\n</code></div>\n\n"],class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3753,description:'<p>Returns the amount of energy (volume) at a specific\n<a href="https://en.wikipedia.org/wiki/Audio_frequency" target="_blank">\nfrequency</a>, or the average amount of energy between two\nfrequencies. Accepts Number(s) corresponding\nto frequency (in Hz), or a String corresponding to predefined\nfrequency ranges (&quot;bass&quot;, &quot;lowMid&quot;, &quot;mid&quot;, &quot;highMid&quot;, &quot;treble&quot;).\nReturns a range between 0 (no energy/volume at that frequency) and\n255 (maximum energy).\n<em>NOTE: analyze() must be called prior to getEnergy(). Analyze()\ntells the FFT to analyze frequency data, and getEnergy() uses\nthe results determine the value at a specific frequency or\nrange of frequencies.</em></p></p>\n',itemtype:"method",name:"getEnergy",params:[{name:"frequency1",description:"<p>Will return a value representing\n                              energy at this frequency. Alternately,\n                              the strings &quot;bass&quot;, &quot;lowMid&quot; &quot;mid&quot;,\n                              &quot;highMid&quot;, and &quot;treble&quot; will return\n                              predefined frequency ranges.</p>\n",type:"Number|String"},{name:"frequency2",description:"<p>If a second frequency is given,\n                              will return average amount of\n                              energy that exists between the\n                              two frequencies.</p>\n",type:"Number",optional:!0}],return:{description:"Energy   Energy (volume/amplitude) from\n                            0 and 255.",type:"Number"},class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3835,description:'<p>Returns the\n<a href="http://en.wikipedia.org/wiki/Spectral_centroid" target="_blank">\nspectral centroid</a> of the input signal.\n<em>NOTE: analyze() must be called prior to getCentroid(). Analyze()\ntells the FFT to analyze frequency data, and getCentroid() uses\nthe results determine the spectral centroid.</em></p></p>\n',itemtype:"method",name:"getCentroid",return:{description:"Spectral Centroid Frequency   Frequency of the spectral centroid in Hz.",type:"Number"},example:['\n<div><code>\n\n\nfunction setup(){\ncnv = createCanvas(100,100);\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\nfor (var i = 0; i< spectrum.length; i++){\n  var x = map(log(i), 0, log(spectrum.length), 0, width);
21\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\ntext("centroid: ", 10, 20);\ntext(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:3915,description:"<p>Smooth FFT analysis by averaging with the last analysis frame.</p>\n",itemtype:"method",name:"smooth",params:[{name:"smoothing",description:"<p>0.0 &lt; smoothing &lt; 1.0.\n                             Defaults to 0.8.</p>\n",type:"Number"}],class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:3937,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:3967,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:3997,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:4055,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4076,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4135,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4453,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4625,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4783,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4824,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:4881,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5049,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5097,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5128,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5149,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5169,class:"p5.FFT",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5268,description:"<p>Fade to value, for smooth transitions</p>\n",itemtype:"method",name:"fade",params:[{name:"value",description:"<p>Value to set this signal</p>\n",type:"Number"},{name:"secondsFromNow",description:"<p>Length of fade, in seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.Signal",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5279,description:"<p>Connect a p5.sound object or Web Audio node to this\np5.Signal so that its amplitude values can be scaled.</p>\n",itemtype:"method",name:"setInput",params:[{name:"input",description:"",type:"Object"}],class:"p5.Signal",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5293,description:"<p>Add a constant value to this audio signal,\nand return the resulting audio signal. Does\nnot change the value of the original signal,\ninstead it returns a new p5.SignalAdd.</p>\n",itemtype:"method",name:"add",params:[{name:"number",description:"",type:"Number"}],return:{description:"object",type:"p5.Signal"},class:"p5.Signal",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5312,description:"<p>
21Multiply this signal by a constant value,\nand return the resulting audio signal. Does\nnot change the value of the original signal,\ninstead it returns a new p5.SignalMult.</p>\n",itemtype:"method",name:"mult",params:[{name:"number",description:"<p>to multiply</p>\n",type:"Number"}],return:{description:"object",type:"p5.Signal"},class:"p5.Signal",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5331,description:"<p>Scale this signal value to a given range,\nand return the result as an audio signal. Does\nnot change the value of the original signal,\ninstead it returns a new p5.SignalScale.</p>\n",itemtype:"method",name:"scale",params:[{name:"number",description:"<p>to multiply</p>\n",type:"Number"},{name:"inMin",description:"<p>input range minumum</p>\n",type:"Number"},{name:"inMax",description:"<p>input range maximum</p>\n",type:"Number"},{name:"outMin",description:"<p>input range minumum</p>\n",type:"Number"},{name:"outMax",description:"<p>input range maximum</p>\n",type:"Number"}],return:{description:"object",type:"p5.Signal"},class:"p5.Signal",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5465,description:"<p>Start an oscillator. Accepts an optional parameter to\ndetermine how long (in seconds from now) until the\noscillator starts.</p>\n",itemtype:"method",name:"start",params:[{name:"time",description:"<p>startTime in seconds from now.</p>\n",type:"Number",optional:!0},{name:"frequency",description:"<p>frequency in Hz.</p>\n",type:"Number",optional:!0}],class:"p5.Oscillator",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5505,description:"<p>Stop an oscillator. Accepts an optional parameter\nto determine how long (in seconds from now) until the\noscillator stops.</p>\n",itemtype:"method",name:"stop",params:[{name:"secondsFromNow",description:"<p>Time, in seconds from now.</p>\n",type:"Number"}],class:"p5.Oscillator",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5521,description:"<p>Set the amplitude between 0 and 1.0. Or, pass in an object\nsuch as an oscillator to modulate amplitude with an audio signal.</p>\n",itemtype:"method",name:"amp",params:[{name:"vol",description:"<p>between 0 and 1.0\n                            or a modulating signal/oscillator</p>\n",type:"Number|Object"},{name:"rampTime",description:"<p>create a fade that lasts rampTime</p>\n",type:"Number",optional:!0},{name:"timeFromNow",description:"<p>schedule this event to happen\n                              seconds from now</p>\n",type:"Number",optional:!0}],return:{description:"gain  If no value is provided,\n                            returns the Web Audio API\n                            AudioParam that controls\n                            this oscillator's\n                            gain/amplitude/volume)",type:"AudioParam"},class:"p5.Oscillator",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5556,description:"<p>Set frequency of an oscillator to a value. Or, pass in an object\nsuch as an oscillator to modulate the frequency with an audio signal.</p>\n",itemtype:"method",name:"freq",params:[{name:"Frequency",description:"<p>Frequency in Hz\n                                      or modulating signal/oscillator</p>\n",type:"Number|Object"},{name:"rampTime",description:"<p>Ramp time (in seconds)</p>\n",type:"Number",optional:!0},{name:"timeFromNow",description:"<p>Schedule this event to happen\n                                 at x seconds from now</p>\n",type:"Number",optional:!0}],return:{description:"Frequency If no value is provided,\n                                returns the Web Audio API\n                                AudioParam that controls\n                                this oscillator's frequency",type:"AudioParam"},example:["\n<div><code>\nvar osc = new p5.Oscillator(300);\nosc.start();\nosc.freq(40, 10);\n</code></div>"],class:"p5.Oscillator",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5615,description:"<p>Set type to &#39;sine&#39;, &#39;triangle&#39;, &#39;sawtooth&#39; or &#39;square&#39;.</p>\n",itemtype:"method",name:"setType",params:[{name:"type",description:"<p>&#39;sine&#39;, &#39;triangle&#39;, &#39;sawtooth&#39; or &#39;square&#39;.</p>\n",type:"String"}],class:"p5.Oscillator",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5627,description:"<p>Connect to a p5.sound / Web Audio object.</p>\n",itemtype:"method",name:"connect",params:[{name:"unit",description:"<p>A p5.sound or Web Audio object</p>\n",type:"Object"}],class:"p5.Oscillator",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5644,description:"<p>Disconnect all outputs</p>\n",itemtype:"method",name:"disconnect",class:"p5.Oscillator",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5661,description:"<p>Pan between Left (-1) and Right (1)</p>\n",itemtype:"method",name:"pan",params:[{name:"panning",description:"<p>Number between -1 and 1</p>\n",type:"Number"},{name:"timeFromNow",description:"<p>schedule this event to happen\n                              seconds from now</p>\n",type:"Number"}],class:"p5.Oscillator",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5693,description:"<p>Set the phase of an oscillator between 0.0 and 1.0.\nIn this implementation, phase is a delay time\nbased on the oscillator&#39;s current frequency.</p>\n",itemtype:"method",name:"phase",params:[{name:"phase",description:"<p>float between 0.0 and 1.0</p>\n",type:"Number"}],class:"p5.Oscillator",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5747,description:"<p>Add a value to the p5.Oscillator&#39;s output amplitude,\nand return the oscillator. Calling this method again\nwill override the initial add() with a new value.</p>\n",itemtype:"method",name:"add",params:[{name:"number",description:"<p>Constant number to add</p>\n",type:"Number"}],return:{description:"Oscillator Returns this oscillator\n                                   with scaled output",type:"p5.Oscillator"},class:"p5.Oscillator",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5764,description:"<p>Multiply the p5.Oscillator&#39;s output amplitude\nby a fixed value (i.e. turn it up!). Calling this method\nagain will override the initial mult() with a new value.</p>\n",itemtype:"method",name:"mult",params:[{name:"number",description:"<p>Constant number to multiply</p>\n",type:"Number"}],return:{description:"Oscillator Returns this oscillator\n                                   with multiplied output",type:"p5.Oscillator"},class:"p5.Oscillator",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5780,description:"<p>Scale this oscillator&#39;s amplitude values to a given\nrange, and return the oscillator. Calling this method\nagain will override the initial scale() with new values.</p>
21\n",itemtype:"method",name:"scale",params:[{name:"inMin",description:"<p>input range minumum</p>\n",type:"Number"},{name:"inMax",description:"<p>input range maximum</p>\n",type:"Number"},{name:"outMin",description:"<p>input range minumum</p>\n",type:"Number"},{name:"outMax",description:"<p>input range maximum</p>\n",type:"Number"}],return:{description:"Oscillator Returns this oscillator\n                                   with scaled output",type:"p5.Oscillator"},class:"p5.Oscillator",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:5879,class:"p5.SqrOsc",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6082,class:"p5.SqrOsc",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6369,description:"<p>Time until envelope reaches attackLevel</p>\n",itemtype:"property",name:"attackTime",class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6374,description:"<p>Level once attack is complete.</p>\n",itemtype:"property",name:"attackLevel",class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6379,description:"<p>Time until envelope reaches decayLevel.</p>\n",itemtype:"property",name:"decayTime",class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6384,description:"<p>Level after decay. The envelope will sustain here until it is released.</p>\n",itemtype:"property",name:"decayLevel",class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6389,description:"<p>Duration of the release portion of the envelope.</p>\n",itemtype:"property",name:"releaseTime",class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6394,description:"<p>Level at the end of the release.</p>\n",itemtype:"property",name:"releaseLevel",class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6430,description:"<p>Reset the envelope with a series of time/value pairs.</p>\n",itemtype:"method",name:"set",params:[{name:"attackTime",description:"<p>Time (in seconds) before level\n                               reaches attackLevel</p>\n",type:"Number"},{name:"attackLevel",description:"<p>Typically an amplitude between\n                               0.0 and 1.0</p>\n",type:"Number"},{name:"decayTime",description:"<p>Time</p>\n",type:"Number"},{name:"decayLevel",description:"<p>Amplitude (In a standard ADSR envelope,\n                               decayLevel = sustainLevel)</p>\n",type:"Number"},{name:"releaseTime",description:"<p>Release Time (in seconds)</p>\n",type:"Number"},{name:"releaseLevel",description:"<p>Amplitude</p>\n",type:"Number"}],example:["\n<div><code>\nvar t1 = 0.1;
21 // attack time in seconds\nvar l1 = 0.7; // attack level 0.0 to 1.0\nvar t2 = 0.3; // decay time in seconds\nvar l2 = 0.1; // decay level  0.0 to 1.0\nvar t3 = 0.2; // sustain time in seconds\nvar l3 = 0.5; // sustain level  0.0 to 1.0\n// release level defaults to zero\n\nvar env;\nvar triOsc;\n\nfunction setup() {\n  background(0);\n  noStroke();\n  fill(255);\n  textAlign(CENTER);\n  text('click to play', width/2, height/2);\n\n  env = new p5.Envelope(t1, l1, t2, l2, t3, l3);\n  triOsc = new p5.Oscillator('triangle');\n  triOsc.amp(env); // give the env control of the triOsc's amp\n  triOsc.start();\n}\n\n// mouseClick triggers envelope if over canvas\nfunction mouseClicked() {\n  // is mouse over canvas?\n  if (mouseX > 0 && mouseX < width && mouseY > 0 && mouseY < height) {\n    env.play(triOsc);\n  }\n}\n</code></div>\n"],class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6489,description:'<p>Set values like a traditional\n<a href="https://en.wikipedia.org/wiki/Synthesizer#/media/File:ADSR_parameter.svg">\nADSR envelope\n</a>.</p>\n',itemtype:"method",name:"setADSR",params:[{name:"attackTime",description:"<p>Time (in seconds before envelope\n                              reaches Attack Level</p>\n",type:"Number"},{name:"decayTime",description:"<p>Time (in seconds) before envelope\n                              reaches Decay/Sustain Level</p>\n",type:"Number",optional:!0},{name:"susRatio",description:"<p>Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n                              where 1.0 = attackLevel, 0.0 = releaseLevel.\n                              The susRatio determines the decayLevel and the level at which the\n                              sustain portion of the envelope will sustain.\n                              For example, if attackLevel is 0.4, releaseLevel is 0,\n                              and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n                              increased to 1.0 (using <code>setRange</code>),\n                              then decayLevel would increase proportionally, to become 0.5.</p>\n",type:"Number",optional:!0},{name:"releaseTime",description:"<p>Time in seconds from now (defaults to 0)</p>\n",type:"Number",optional:!0}],example:["\n<div><code>\nvar attackLevel = 1.0;\nvar releaseLevel = 0;\n\nvar attackTime = 0.001;\nvar decayTime = 0.2;\nvar susPercent = 0.2;\nvar releaseTime = 0.5;\n\nvar env, triOsc;\n\nfunction setup() {\n  var cnv = createCanvas(100, 100);\n\n  textAlign(CENTER);\n  text('click to play', width/2, height/2);\n\n  env = new p5.Envelope();\n  env.setADSR(attackTime, decayTime, susPercent, releaseTime);\n  env.setRange(attackLevel, releaseLevel);\n\n  triOsc = new p5.Oscillator('triangle');\n  triOsc.amp(env);\n  triOsc.start();\n  triOsc.freq(220);\n\n  cnv.mousePressed(playEnv);\n}\n\nfunction playEnv()  {\n  env.play();\n}\n</code></div>"],class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6554,description:"<p>Set max (attackLevel) and min (releaseLevel) of envelope.</p>\n",itemtype:"method",name:"setRange",params:[{name:"aLevel",description:"<p>attack level (defaults to 1)</p>\n",type:"Number"},{name:"rLevel",description:"<p>release level (defaults to 0)</p>\n",type:"Number"}],example:["\n<div><code>\nvar attackLevel = 1.0;\nvar releaseLevel = 0;\n\nvar attackTime = 0.001;\nvar decayTime = 0.2;\nvar susPercent = 0.2;\nvar releaseTime = 0.5;\n\nvar env, triOsc;\n\nfunction setup() {\n  var cnv = createCanvas(100, 100);\n\n  textAlign(CENTER);\n  text('click to play', width/2, height/2);\n\n  env = new p5.Envelope();\n  env.setADSR(attackTime, decayTime, susPercent, releaseTime);\n  env.setRange(attackLevel, releaseLevel);\n\n  triOsc = new p5.Oscillator('triangle');\n  triOsc.amp(env);\n  triOsc.start();\n  triOsc.freq(220);\n\n  cnv.mousePressed(playEnv);\n}\n\nfunction playEnv()  {\n  env.play();\n}\n</code></div>"],class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6633,description:"<p>Assign a parameter to be controlled by this envelope.\nIf a p5.Sound object is given, then the p5.Envelope will c
21ontrol its\noutput gain. If multiple inputs are provided, the env will\ncontrol all of them.</p>\n",itemtype:"method",name:"setInput",params:[{name:"inputs",description:"<p>A p5.sound object or\n                              Web Audio Param.</p>\n",type:"Object",optional:!0,multiple:!0}],class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6648,description:"<p>Set whether the envelope ramp is linear (default) or exponential.\nExponential ramps can be useful because we perceive amplitude\nand frequency logarithmically.</p>\n",itemtype:"method",name:"setExp",params:[{name:"isExp",description:"<p>true is exponential, false is linear</p>\n",type:"Boolean"}],class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6666,description:'<p>Play tells the envelope to start acting on a given input.\nIf the input is a p5.sound object (i.e. AudioIn, Oscillator,\nSoundFile), then Envelope will control its output volume.\nEnvelopes can also be used to control any <a href="\nhttp://docs.webplatform.org/wiki/apis/webaudio/AudioParam">\nWeb Audio Audio Param.</a></p>\n',itemtype:"method",name:"play",params:[{name:"unit",description:"<p>A p5.sound object or\n                              Web Audio Param.</p>\n",type:"Object"},{name:"startTime",description:"<p>time from now (in seconds) at which to play</p>\n",type:"Number",optional:!0},{name:"sustainTime",description:"<p>time to sustain before releasing the envelope</p>\n",type:"Number",optional:!0}],example:["\n<div><code>\nvar attackLevel = 1.0;\nvar releaseLevel = 0;\n\nvar attackTime = 0.001;\nvar decayTime = 0.2;\nvar susPercent = 0.2;\nvar releaseTime = 0.5;\n\nvar env, triOsc;\n\nfunction setup() {\n  var cnv = createCanvas(100, 100);\n\n  textAlign(CENTER);\n  text('click to play', width/2, height/2);\n\n  env = new p5.Envelope();\n  env.setADSR(attackTime, decayTime, susPercent, releaseTime);\n  env.setRange(attackLevel, releaseLevel);\n\n  triOsc = new p5.Oscillator('triangle');\n  triOsc.amp(env);\n  triOsc.start();\n  triOsc.freq(220);\n\n  cnv.mousePressed(playEnv);\n}\n\nfunction playEnv()  {\n  // trigger env on triOsc, 0 seconds from now\n  // After decay, sustain for 0.2 seconds before release\n  env.play(triOsc, 0, 0.2);\n}\n</code></div>"],class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6727,description:'<p>Trigger the Attack, and Decay portion of the Envelope.\nSimilar to holding down a key on a piano, but it will\nhold the sustain level until you let go. Input can be\nany p5.sound object, or a <a href="\nhttp://docs.webplatform.org/wiki/apis/webaudio/AudioParam">\nWeb Audio Param</a>.</p>\n',itemtype:"method",name:"triggerAttack",params:[{name:"unit",description:"<p>p5.sound Object or Web Audio Param</p>\n",type:"Object"},{name:"secondsFromNow",description:"<p>time from now (in seconds)</p>\n",type:"Number"}],example:["\n<div><code>\n\nvar attackLevel = 1.0;\nvar releaseLevel = 0;\n\nvar attackTime = 0.001;\nvar decayTime = 0.3;\nvar susPercent = 0.4;\nvar releaseTime = 0.5;\n\nvar env, triOsc;\n\nfunction setup() {\n  var cnv = createCanvas(100, 100);\n  background(200);\n  textAlign(CENTER);\n  text('click to play', width/2, height/2);\n\n  env = new p5.Envelope();\n  env.setADSR(attackTime, decayTime, susPercent, releaseTime);\n  env.setRange(attackLevel, releaseLevel);\n\n  triOsc = new p5.Oscillator('triangle');\n  triOsc.amp(env);\n  triOsc.start();\n  triOsc.freq(220);\n\n  cnv.mousePressed(envAttack);\n}\n\nfunction envAttack()  {\n  console.log('trigger attack');\n  env.triggerAttack();\n\n  background(0,255,0);\n  text('attack!', width/2, height/2);\n}\n\nfunction mouseReleased() {\n  env.triggerRelease();\n\n  background(200);\n  text('click to play', width/2, height/2);\n}\n</code></div>"],class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6834,description:"<p>Trigger the Release of the Envelope. This is similar to releasing\nthe key on a piano and letting the sound fade according to the\nrelease level and release time.</p>\n",itemtype:"method",name:"triggerRelease",params:[{name:"unit",description:"<p>p5.sound Object or Web Audio Param</p>\n",type:"Object"},{name:"secondsFromNow",description:"<p>time to trigger the release</p>\n",type:"Number"}],example:["\n<div><code>\n\nvar attackLevel = 1.0;\nvar releaseLevel = 0;\n\nvar attackTime = 0.001;\nvar decayTime = 0.3;\nvar susPercent = 0.4;\nvar releaseTime = 0.5;\n\nvar env, triOsc;\n\nfunction setup() {\n  var cnv = createCanvas(100, 100);\n  background(200);\n  textAlign(CENTER);\n  text('click to play', width/2, height/2);\n\n  env = new p5.Envelope();\n  env.setADSR(attackTime, decayTime, susPercent, releaseTime);\n  env.setRange(attackLevel, releaseLevel);\n\n  triOsc = new p5.Oscillator('triangle');\n  triOsc.amp(env);\n  triOsc.start();\n  triOsc.freq(220);\n\n  cnv.mousePressed(envAttack);\n}\n\nfunction envAttack()  {\n  console.log('trigger attack');\n  env.triggerAttack();\n\n  background(0,255,0);\n  text('attack!', width/2, height/2);\n}\n\nfunction mouseReleased() {\n  env.triggerRelease();\n\n  background(200);\n  text('click to play', width/2, height/2);\n}\n</code></div>"],class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:6931,description:'<p>Exponentially ramp to a value using the first two\nvalues from <code><a href="#/p5.Envelope/setADSR">setADSR(attackTime, decayTime)</a></code>\nas <a href="https://en.wikipedia.org/wiki/RC_time_constant">\ntime constants</a> for simple exponential ramps.\nIf the value is higher than current value, it uses attackTime,\nwhile a decrease uses decayTime.</p>\n',itemtype:"method",name:"ramp",params:[{name:"unit",description:"<p>p5.sound Object or Web Audio Param</p>\n",type:"Object"},{name:"secondsFromNow",description:"<p>When to trigger the ramp</p>\n",type:"Number"},{name:"v",description:"<p>Target value</p>\n",type:"Number"},{name:"v2",description:"<p>Second target value (optional)</p>\n",type:"Number",optional:!0}],example:["\n<div><code>\nvar env, osc, amp, cnv;\n\nvar attackTime = 0.001;\nvar decayTime = 0.2;\nvar attackLevel = 1;\nvar decayLevel = 0;\n\nfunction setup() {\n  cnv = createCanvas(100, 100);\n  fill(0,255,0);\n  noStroke();\n\n  env = new p5.Envelope();\n  env.setADSR(attackTime, decayTime);\n\n  osc = new p5.Oscillator();\n  osc.amp(env);\n  osc.start();\n\n  amp = new p5.Amplitude();\n\n  cnv.mousePressed(triggerRamp);\n}\n\nfunction triggerRamp() {\n  env.ramp(osc, 0, attackLevel, decayLevel);\n}\n\nfunction draw() {\n  background(20,20,20);\n  text('click me', 10, 20);
21\n  var h = map(amp.getLevel(), 0, 0.4, 0, height);;\n\n  rect(0, height, width, -h);\n}\n</code></div>"],class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7038,description:"<p>Add a value to the p5.Oscillator&#39;s output amplitude,\nand return the oscillator. Calling this method\nagain will override the initial add() with new values.</p>\n",itemtype:"method",name:"add",params:[{name:"number",description:"<p>Constant number to add</p>\n",type:"Number"}],return:{description:"Envelope Returns this envelope\n                                   with scaled output",type:"p5.Envelope"},class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7054,description:"<p>Multiply the p5.Envelope&#39;s output amplitude\nby a fixed value. Calling this method\nagain will override the initial mult() with new values.</p>\n",itemtype:"method",name:"mult",params:[{name:"number",description:"<p>Constant number to multiply</p>\n",type:"Number"}],return:{description:"Envelope Returns this envelope\n                                   with scaled output",type:"p5.Envelope"},class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7070,description:"<p>Scale this envelope&#39;s amplitude values to a given\nrange, and return the envelope. Calling this method\nagain will override the initial scale() with new values.</p>\n",itemtype:"method",name:"scale",params:[{name:"inMin",description:"<p>input range minumum</p>\n",type:"Number"},{name:"inMax",description:"<p>input range maximum</p>\n",type:"Number"},{name:"outMin",description:"<p>input range minumum</p>\n",type:"Number"},{name:"outMax",description:"<p>input range maximum</p>\n",type:"Number"}],return:{description:"Envelope Returns this envelope\n                                   with scaled output",type:"p5.Envelope"},class:"p5.Envelope",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7178,description:"<p>Set the width of a Pulse object (an oscillator that implements\nPulse Width Modulation).</p>\n",itemtype:"method",name:"width",params:[{name:"width",description:"<p>Width between the pulses (0 to 1.0,\n                       defaults to 0)</p>\n",type:"Number",optional:!0}],class:"p5.Pulse",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7365,description:"<p>Set type of noise to &#39;white&#39;, &#39;pink&#39; or &#39;brown&#39;.\nWhite is the default.</p>\n",itemtype:"method",name:"setType",params:[{name:"type",description:"<p>&#39;white&#39;, &#39;pink&#39; or &#39;brown&#39;</p>\n",type:"String",optional:!0}],class:"p5.Noise",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7478,itemtype:"property",name:"input",type:"GainNode",class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7482,itemtype:"property",name:"output",type:"GainNode",class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7486,itemtype:"property",name:"stream",type:"MediaStream|null",class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7490,itemtype:"property",name:"mediaStream",type:"MediaStreamAudioSourceNode|null",class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7494,itemtype:"property",name:"currentSource",type:"Number|null",class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7498,description:"<p>Client must allow browser to access their microphone / audioin source.\nDefault: false. Will become true when the client enables acces.</p>\n",itemtype:"property",name:"enabled",type:"Boolean",class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7505,description:"<p>Input amplitude, connect to it by default but not to master out</p>\n",itemtype:"property",name:"amplitude",type:"p5.Amplitude",class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7518,description:"<p>Start processing audio input. This enables the use of other\nAudioIn methods like getLevel(). Note that by default, AudioIn\nis not connected to p5.sound&#39;s output. So you won&#39;t hear\nanything unless you use the connect() method.<br/></p>\n<p>Certain browsers limit access to the user&#39;s microphone. For example,\nChrome only allows access from localhost and over https. For this reason,\nyou may want to include an errorCallback—a function that is called 
21in case\nthe browser won&#39;t provide mic access.</p>\n",itemtype:"method",name:"start",params:[{name:"successCallback",description:"<p>Name of a function to call on\n                                  success.</p>\n",type:"Function",optional:!0},{name:"errorCallback",description:"<p>Name of a function to call if\n                                  there was an error. For example,\n                                  some browsers do not support\n                                  getUserMedia.</p>\n",type:"Function",optional:!0}],class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7571,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:7587,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:7608,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:7622,description:"<p>Read the Amplitude (volume level) of an AudioIn. The AudioIn\nclass contains its own instance of the Amplitude class to help\nmake it easy to get a microphone&#39;s volume level. Accepts an\noptional smoothing value (0.0 &lt; 1.0). <em>NOTE: AudioIn must\n.start() before using .getLevel().</em><br/></p>\n",itemtype:"method",name:"getLevel",params:[{name:"smoothing",description:"<p>Smoothing is 0.0 by default.\n                             Smooths values based on previous values.</p>\n",type:"Number",optional:!0}],return:{description:"Volume level (between 0.0 and 1.0)",type:"Number"},class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7640,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:7659,description:'<p>Returns a list of available input sources. This is a wrapper\nfor &lt;a title=&quot;MediaDevices.enumerateDevices() - Web APIs | MDN&quot; target=&quot;_blank&quot; href=\n &quot;<a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices&quot;">https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices&quot;</a></p>\n<blockquote>\n<p>and it returns a Promise.</p>\n</blockquote>\n',itemtype:"method",name:"getSources",params:[{name:"successCallback",description:"<p>This callback function handles the sources when they\n                                     have been enumerated. The callback function\n                                     receives the deviceList array as its only argument</p>\n",type:"Function",optional:!0},{name:"errorCallback",description:"<p>This optional callback receives the error\n                                   message as its argument.</p>\n",type:"Function",optional:!0}],return:{description:"Returns a Promise that can be used in place of the callbacks, similar\n                           to the enumerateDevices() method",type:"Promise"},example:["\n <div><code>\n var audiograb;\n\n function setup(){\n   //new audioIn\n   audioGrab = new p5.AudioIn();\n\n   audioGrab.getSources(function(deviceList) {\n     //print out the array of available sources\n     console.log(deviceList);\n     //set the source to the first item in the deviceList array\n     audioGrab.setSource(0);\n   });\n }\n </code></div>"],class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7710,description:'<p>Set the input source. Accepts a number representing a\nposition in the array returned by getSources().\nThis is only available in browsers that support\n&lt;a title=&quot;MediaDevices.enumerateDevices() - Web APIs | MDN&quot; target=&quot;_blank&quot; href=\n&quot;<a href="https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices&quot;">https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/enumerateDevices&quot;</a></p>\n<blockquote>\n<p>navigator.mediaDevices.enumerateDevices()</a>.<br/></p>\n</blockquote>\n',itemtype:"method",name:"setSource",params:[{name:"num",description:"<p>position of input source in the array</p>\n",type:"Number"}],class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7750,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7766,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7790,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7816,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7838,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7860,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7906,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7937,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:7955,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8292,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8314,class:"p5.AudioIn",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8390,description:"<p>In classes that extend\np5.Effect, connect effect nodes\nto the wet parameter</p>\n",class:"p5.Effect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8403,description:"<p>Set the output volume of the filter.</p>\n",itemtype:"method",name:"amp",params:[{name:"vol",description:"<p>amplitude between 0 and 1.0</p>\n",type:"Number",optional:!0},{name:"rampTime",description:"<p>create a fade that lasts until rampTime</p>\n",type:"Number",optional:!0},{name:"tFromNow",description:"<p>schedule this event to happen in tFromNow seconds</p>\n",type:"Number",optional:!0}],class:"p5.Effect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8420,description:"<p>Link effects together in a chain<br>Example usage: filter.chain(reverb, delay, panner);\nMay be used with an open-ended number of arguments</p>\n",itemtype:"method",name:"chain",params:[{name:"arguments",description:"<p>Chain together multiple sound objects</p>\n",type:"Object",optional:!0}],class:"p5.Effect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8437,description:"<p>Adjust the dry/wet value.</p>\n",itemtype:"method",name:"drywet",params:[{name:"fade",description:"<p>The desired drywet value (0 - 1.0)</p>\n",type:"Number",optional:!0}],class:"p5.Effect",module:"p5.sound",submodule:"p5.sound"}
21,{file:"lib/addons/p5.sound.js",line:8449,description:"<p>Send output to a p5.js-sound, Web Audio Node, or use signal to\ncontrol an AudioParam</p>\n",itemtype:"method",name:"connect",params:[{name:"unit",description:"",type:"Object"}],class:"p5.Effect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8460,description:"<p>Disconnect all output.</p>\n",itemtype:"method",name:"disconnect",class:"p5.Effect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8578,description:'<p>The p5.Filter is built with a\n<a href="http://www.w3.org/TR/webaudio/#BiquadFilterNode">\nWeb Audio BiquadFilter Node</a>.</p>\n',itemtype:"property",name:"biquadFilter",type:"DelayNode",class:"p5.Filter",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8596,description:"<p>Filter an audio signal according to a set\nof filter parameters.</p>\n",itemtype:"method",name:"process",params:[{name:"Signal",description:"<p>An object that outputs audio</p>\n",type:"Object"},{name:"freq",description:"<p>Frequency in Hz, from 10 to 22050</p>\n",type:"Number",optional:!0},{name:"res",description:"<p>Resonance/Width of the filter frequency\n                      from 0.001 to 1000</p>\n",type:"Number",optional:!0}],class:"p5.Filter",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8610,description:"<p>Set the frequency and the resonance of the filter.</p>\n",itemtype:"method",name:"set",params:[{name:"freq",description:"<p>Frequency in Hz, from 10 to 22050</p>\n",type:"Number",optional:!0},{name:"res",description:"<p>Resonance (Q) from 0.001 to 1000</p>\n",type:"Number",optional:!0},{name:"timeFromNow",description:"<p>schedule this event to happen\n                              seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.Filter",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8627,description:"<p>Set the filter frequency, in Hz, from 10 to 22050 (the range of\nhuman hearing, although in reality most people hear in a narrower\nrange).</p>\n",itemtype:"method",name:"freq",params:[{name:"freq",description:"<p>Filter Frequency</p>\n",type:"Number"},{name:"timeFromNow",description:"<p>schedule this event to happen\n                              seconds from now</p>\n",type:"Number",optional:!0}],return:{description:"value  Returns the current frequency value",type:"Number"},class:"p5.Filter",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8651,description:"<p>Controls either width of a bandpass frequency,\nor the resonance of a low/highpass cutoff frequency.</p>\n",itemtype:"method",name:"res",params:[{name:"res",description:"<p>Resonance/Width of filter freq\n                     from 0.001 to 1000</p>\n",type:"Number"},{name:"timeFromNow",description:"<p>schedule this event to happen\n                              seconds from now</p>\n",type:"Number",optional:!0}],return:{description:"value Returns the current res value",type:"Number"},class:"p5.Filter",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8673,description:"<p>Controls the gain attribute of a Biquad Filter.\nThis is distinctly different from .amp() which is inherited from p5.Effect\n.amp() controls the volume via the output gain node\np5.Filter.gain() controls the gain parameter of a Biquad Filter node.</p>\n",itemtype:"method",name:"gain",params:[{name:"gain",description:"",type:"Number"}],return:{description:"Returns the current or updated gain value",type:"Number"},class:"p5.Filter",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8694,description:"<p>Toggle function. Switches between the specified type and allpass</p>\n",itemtype:"method",name:"toggle",return:{description:"[Toggle value]",type:"Boolean"},class:"p5.Filter",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8709,description:"<p>Set the type of a p5.Filter. Possible types include:\n&quot;lowpass&quot; (default), &quot;highpass&quot;, &quot;bandpass&quot;,\n&quot;lowshelf&quot;, &quot;highshelf&quot;, &quot;peaking&quot;, &quot;notch&quot;,\n&quot;allpass&quot;.</p>\n",itemtype:"method",name:"setType",params:[{name:"t",description:"",type:"String"}],class:"p5.Filter",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8916,description:'<p>The p5.EQ is built with abstracted p5.Filter objects.\nTo modify any bands, use methods of the <a \nhref="/reference/#/p5.Filter" title="p5.Filter reference">\np5.Filter</a> API, especially <code>gain</code> and <code>freq</code>.\nBands are stored in an array, with indices 0 - 3, or 0 - 7</p>\n',itemtype:"property",name:"bands",type:"Array",class:"p5.EQ",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:8951,description:"<p>Process an input by connecting it to the EQ</p>\n",itemtype:"method",name:"process",params:[{name:"src",description:"<p>Audio source</p>\n",type:"Object"}],class:"p5.EQ",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9039,description:'<p><a title="Web Audio Panner docs"  href=\n"https://developer.mozilla.org/en-US/docs/Web/API/PannerNode">\nWeb Audio Spatial Panner Node</a></p>\n<p>Properties include</p>\n<ul>\n<li>&lt;a title=&quot;w3 spec for Panning Model&quot;\nhref=&quot;<a href="https://www.w3.org/TR/webaudio/#idl-def-PanningModelType&quot;">https://www.w3.org/TR/webaudio/#idl-def-PanningModelType&quot;</a><blockquote>\n<p>panningModel</a>: &quot;equal power&quot; or &quot;HRTF&quot;</p>\n</blockquote>\n</li>\n<li>&lt;a title=&quot;w3 spec for Distance Model&quot;\nhref=&quot;<a href="https://www.w3.org/TR/webaudio/#idl-def-DistanceModelType&quot;">https://www.w3.org/TR/webaudio/#idl-def-DistanceModelType&quot;</a><blockquote>\n<p>distanceModel</a>: &quot;linear&quot;, &quot;inverse&quot;, or &quot;exponential&quot;</p>\n</blockquote>\n</li>\n</ul>\n',itemtype:"property",name:"panner",type:"AudioNode",class:"p5.Panner3D",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9062,description:"<p>Connect an audio sorce</p>\n",itemtype:"method",name:"process",params:[{name:"src",description:"<p>Input source</p>\n",type:"Object"}],class:"p5.Panner3D",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9071,description:"<p>Set the X,Y,Z position of the Panner</p>\n",itemtype:"method",name:"set",params:[{name:"xVal",description:"",type:"Number"},{name:"yVal",description:"",type:"Number"},{name:"zVal",description:"",type:"Number"},{name:"time",description:"",type:"Number"}],return:{description:"Updated x, y, z values as an array",type:"Array"},class:"p5.Panner3D",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9090,description:"<p>Getter and setter methods for position coordinates</p>\n",itemtype:"method",name:"positionX",return:{description:"updated coordinate value",type:"Number"},class:"p5.Panner3D",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9095,description:"<p>Getter and setter methods for position coordinates</p>\n",itemtype:"method",name:"positionY",return:{description:"updated coordinate value",type:"Number"},class:"p5.Panner3D",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9100,description:"<p>Getter and setter methods for position coordinates</p>\n",itemtype:"method",name:"positionZ",return:{description:"updated coordinate value",type:"Number"},class:"p5.Panner3D",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9138,description:"<p>Set the X,Y,Z position of the Panner</p>\n",itemtype:"method",name:"orient",params:[{name:"xVal",description:"",type:"Number"},{name:"yVal",description:"",type:"Number"},{name:"zVal",description:"",type:"Number"},{name:"time",description:"",type:"Number"}],return:{description:"Updated x, y, z values as an array",type:"Array"},class:"p5.Panner3D",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9157,description:"<p>Getter and setter methods for orient coordinates</p>\n",itemtype:"method",name:"orientX",return:{description:"updated coordinate value",type:"Number"},class:"p5.Panner3D",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9162,description:"<p>Getter and setter methods for orient coordinates</p>\n",itemtype:"method",name:"orientY",return:{description:"updated coordinate value",type:"Number"},class:"p5.Panner3D",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9167,description:"<p>Getter and setter methods for orient coordinates</p>\n",itemtype:"method",name:"orientZ",return:{description:"updated coordinate value",type:"Number"},class:"p5.Panner3D",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9205,description:"<p>Set the rolloff factor and max distance</p>\n",itemtype:"method",name:"setFalloff",params:[{name:"maxDistance",description:"",type:"Number",optional:!0},{name:"rolloffFactor",description:"",type:"Number",optional:!0}],class:"p5.Panner3D",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9215,description:"<p>Maxium distance between the source and the listener</p>\n",itemtype:"method",name:"maxDist",params:[{name:"maxDistance",description:"",type:"Number"}],return:{description:"updated value",type:"Number"},class:"p5.Panner3D",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9227,description:"<p>How quickly the volume is reduced as the source moves away from the listener</p>\n",itemtype:"method",name:"rollof",params:[{name:"rolloffFactor",description:"",type:"Number"}],return:{description:"updated value",type:"Number"},class:"p5.Panner3D",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9532,description:'<p>The p5.Delay is built with two\n<a href="http://www.w3.org/TR/webaudio/#DelayNode">\nWeb Audio Delay Nodes</a>, one for each stereo channel.</p>\n',itemtype:"property",name:"leftDelay",type:"DelayNode",class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9540,description:'<p>The p5.Delay is built with two\n<a href="http://www.w3.org/TR/webaudio/#DelayNode">\nWeb Audio Delay Nodes</a>, one for each stereo channel.</p>\n',itemtype:"property",name:"rightDelay",type:"DelayNode",class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9572,description:"<p>Add delay to an audio signal according to a set\nof delay parameters.</p>\n",itemtype:"method",name:"process",params:[{name:"Signal",description:"<p>An object that outputs audio</p>\n",type:"Object"},{name:"delayTime",description:"<p>Time (in seconds) of the delay/echo.\n                             Some browsers limit delayTime to\n                             1 second.</p>\n",type:"Number",optional:!0},{name:"feedback",description:"<p>sends the delay back through itself\n                             in a loop that decreases in volume\n                             each time.</p>\n",type:"Number",optional:!0},{name:"lowPass",description:"<p>Cutoff frequency. Only frequencies\n                             below the lowPass will be part of the\n                             delay.</p>\n",type:"Number",optional:!0}],class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9607,description:"<p>Set the delay (echo) time, in seconds. Usually this value will be\na floating point number between 0.0 and 1.0.</p>\n",itemtype:"method",name:"delayTime",params:[{name:"delayTime",description:"<p>Time (in seconds) of the delay</p>\n",type:"Number"}],class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9626,description:"<p>Feedback occurs when Delay sends its signal back through its input\nin a loop. The feedback amount determines how much signal to send each\ntime through the loop. A feedback greater than 1.0 is not desirable because\nit will increase the overall output each time through the loop,\ncreating an infinite feedback loop. The default value is 0.5</p>\n",itemtype:"method",name:"feedback",params:[{name:"feedback",description:"<p>0.0 to 1.0, or an object such as an\n                                Oscillator that can be used to\n                                modulate this param</p>\n",type:"Number|Object"}],return:{description:"Feedback value",type:"Number"},class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9654,description:"<p>Set a lowpass filter frequency for the delay. A lowpass filter\nwill cut off any frequencies higher than the filter frequency.</p>\n",itemtype:"method",name:"filter",params:[{name:"cutoffFreq",description:"<p>A lowpass filter will cut off any\n                            frequencies higher than the filter frequency.</p>\n",type:"Number|Object"},{name:"res",description:"<p>Resonance of the filter frequency\n                            cutoff, or an object (i.e. a p5.Oscillator)\n                            that can be used to modulate this parameter.\n                            High numbers (i.e. 15) will produce a resonance,\n                            low numbers (i.e. .2) will produce a slope.</p>\n",type:"Number|Object"}],class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9671,description:"<p>Choose a preset type of delay. &#39;pingPong&#39; bounces the signal\nfrom the left to the right channel to produce a stereo effect.\nAny other parameter will revert to the default delay 
21setting.</p>\n",itemtype:"method",name:"setType",params:[{name:"type",description:"<p>&#39;pingPong&#39; (1) or &#39;default&#39; (0)</p>\n",type:"String|Number"}],class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9704,description:"<p>Set the output level of the delay effect.</p>\n",itemtype:"method",name:"amp",params:[{name:"volume",description:"<p>amplitude between 0 and 1.0</p>\n",type:"Number"},{name:"rampTime",description:"<p>create a fade that lasts rampTime</p>\n",type:"Number",optional:!0},{name:"timeFromNow",description:"<p>schedule this event to happen\n                              seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9713,description:"<p>Send output to a p5.sound or web audio object</p>\n",itemtype:"method",name:"connect",params:[{name:"unit",description:"",type:"Object"}],class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9719,description:"<p>Disconnect all output.</p>\n",itemtype:"method",name:"disconnect",class:"p5.Delay",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9812,description:"<p>Connect a source to the reverb, and assign reverb parameters.</p>\n",itemtype:"method",name:"process",params:[{name:"src",description:"<p>p5.sound / Web Audio object with a sound\n                         output.</p>\n",type:"Object"},{name:"seconds",description:"<p>Duration of the reverb, in seconds.\n                         Min: 0, Max: 10. Defaults to 3.</p>\n",type:"Number",optional:!0},{name:"decayRate",description:"<p>Percentage of decay with each echo.\n                          Min: 0, Max: 100. Defaults to 2.</p>\n",type:"Number",optional:!0},{name:"reverse",description:"<p>Play the reverb backwards or forwards.</p>\n",type:"Boolean",optional:!0}],class:"p5.Reverb",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9841,description:"<p>Set the reverb settings. Similar to .process(), but without\nassigning a new input.</p>\n",itemtype:"method",name:"set",params:[{name:"seconds",description:"<p>Duration of the reverb, in seconds.\n                         Min: 0, Max: 10. Defaults to 3.</p>\n",type:"Number",optional:!0},{name:"decayRate",description:"<p>Percentage of decay with each echo.\n                          Min: 0, Max: 100. Defaults to 2.</p>\n",type:"Number",optional:!0},{name:"reverse",description:"<p>Play the reverb backwards or forwards.</p>\n",type:"Boolean",optional:!0}],class:"p5.Reverb",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9869,description:"<p>Set the output level of the reverb effect.</p>\n",itemtype:"method",name:"amp",params:[{name:"volume",description:"<p>amplitude between 0 and 1.0</p>\n",type:"Number"},{name:"rampTime",description:"<p>create a fade that lasts rampTime</p>\n",type:"Number",optional:!0},{name:"timeFromNow",description:"<p>schedule this event to happen\n                              seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.Reverb",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9878,description:"<p>Send output to a p5.sound or web audio object</p>\n",itemtype:"method",name:"connect",params:[{name:"unit",description:"",type:"Object"}],class:"p5.Reverb",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9884,description:"<p>Disconnect all output.</p>\n",itemtype:"method",name:"disconnect",class:"p5.Reverb",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9975,description:'<p>Internally, the p5.Convolver uses the a\n<a href="http://www.w3.org/TR/webaudio/#ConvolverNode">\nWeb Audio Convolver Node</a>.</p>\n',itemtype:"property",name:"convolverNode",type:"ConvolverNode",class:"p5.Convolver",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:9998,description:"<p>Create a p5.Convolver. Accepts a path to a soundfile\nthat will be used to generate an impulse response.</p>\n",itemtype:"method",name:"createConvolver",params:[{name:"path",description:"<p>
21path to a sound file</p>\n",type:"String"},{name:"callback",description:"<p>function to call if loading is successful.\n                              The object will be passed in as the argument\n                              to the callback function.</p>\n",type:"Function",optional:!0},{name:"errorCallback",description:"<p>function to call if loading is not successful.\n                              A custom error will be passed in as the argument\n                              to the callback function.</p>\n",type:"Function",optional:!0}],return:{description:"",type:"p5.Convolver"},example:["\n<div><code>\nvar cVerb, sound;\nfunction preload() {\n  // We have both MP3 and OGG versions of all sound assets\n  soundFormats('ogg', 'mp3');\n\n  // Try replacing 'bx-spring' with other soundfiles like\n  // 'concrete-tunnel' 'small-plate' 'drum' 'beatbox'\n  cVerb = createConvolver('assets/bx-spring.mp3');\n\n  // Try replacing 'Damscray_DancingTiger' with\n  // 'beat', 'doorbell', lucky_dragons_-_power_melody'\n  sound = loadSound('assets/Damscray_DancingTiger.mp3');\n}\n\nfunction setup() {\n  // disconnect from master output...\n  sound.disconnect();\n\n  // ...and process with cVerb\n  // so that we only hear the convolution\n  cVerb.process(sound);\n\n  sound.play();\n}\n</code></div>"],class:"p5.Convolver",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10122,description:"<p>Connect a source to the reverb, and assign reverb parameters.</p>\n",itemtype:"method",name:"process",params:[{name:"src",description:"<p>p5.sound / Web Audio object with a sound\n                         output.</p>\n",type:"Object"}],example:["\n<div><code>\nvar cVerb, sound;\nfunction preload() {\n  soundFormats('ogg', 'mp3');\n\n  cVerb = createConvolver('assets/concrete-tunnel.mp3');\n\n  sound = loadSound('assets/beat.mp3');\n}\n\nfunction setup() {\n  // disconnect from master output...\n  sound.disconnect();\n\n  // ...and process with (i.e. connect to) cVerb\n  // so that we only hear the convolution\n  cVerb.process(sound);\n\n  sound.play();\n}\n</code></div>"],class:"p5.Convolver",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10154,description:"<p>If you load multiple impulse files using the .addImpulse method,\nthey will be stored as Objects in this Array. Toggle between them\nwith the <code>toggleImpulse(id)</code> method.</p>\n",itemtype:"property",name:"impulses",type:"Array",class:"p5.Convolver",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10162,description:"<p>Load and assign a new Impulse Response to the p5.Convolver.\nThe impulse is added to the <code>.impulses</code> array. Previous\nimpulses can be accessed with the <code>.toggleImpulse(id)</code>\nmethod.</p>\n",itemtype:"method",name:"addImpulse",params:[{name:"path",description:"<p>path to a sound file</p>\n",type:"String"},{name:"callback",description:"<p>function (optional)</p>\n",type:"Function"},{name:"errorCallback",description:"<p>function (optional)</p>\n",type:"Function"}],class:"p5.Convolver",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10180,description:"<p>Similar to .addImpulse, except that the <code>.impulses</code>\nArray is reset to save memory. A new <code>.impulses</code>\narray is created with this impulse as the only item.</p>\n",itemtype:"method",name:"resetImpulse",params:[{name:"path",description:"<p>path to a sound file</p>\n",type:"String"},{name:"callback",description:"<p>function (optional)</p>\n",type:"Function"},{name:"errorCallback",description:"<p>function (optional)</p>\n",type:"Function"}],class:"p5.Convolver",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10198,description:'<p>If you have used <code>.addImpulse()</code> to add multiple impulses\nto a p5.Convolver, then you can use this method to toggle between\nthe items in the <code>.impulses</code> Array. Accepts a parameter\nto identify which impulse you wish to use, identified either by its\noriginal filename (String) or by its position in the <code>.impulses\n</code> Array (Number).<br/>\nYou can access the objects in the .impulses Array directly. Each\nObject has two attributes: an <code>.audioBuffer</code> (type:\nWeb Audio <a href="\nhttp://webaudio.github.io/web-audio-api/#the-audiobuffer-interface">\nAudioBuffer)</a> and a <code>.name</code>, a String that corresponds\nwith the original filename.</p>\n',itemtype:"method",name:"toggleImpulse",params:[{name:"id",description:"<p>Identify the impulse by its original filename\n                          (String), or by its position in the\n                          <code>.impulses</code> Array (Number).</p>\n",type:"String|Number"}],class:"p5.Convolver",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10240,class:"p5.Convolver",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10265,class:"p5.Convolver",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10460,description:"<p>Set the global tempo, in beats per minute, for all\np5.Parts. This method will impact all active p5.Parts.</p>\n",itemtype:"method",name:"setBPM",params:[{name:"BPM",description:"<p>Beats Per Minute</p>\n",type:"Number"},{name:"rampTime",description:"<p>Seconds from now</p>\n",type:"Number"}],class:"p5.Convolver",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10550,description:"<p>Array of values to pass into the callback\nat each step of the phrase. Depending on the callback\nfunction&#39;s requirements, these values may be numbers,\nstrings, or an object with multiple parameters.\nZero (0) indicates a rest.</p>\n",itemtype:"property",name:"sequence",type:"Array",class:"p5.Phrase",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10638,description:"<p>Set the tempo of this part, in Beats Per Minute.</p>\n",itemtype:"method",name:"setBPM",params:[{name:"BPM",description:"<p>Beats Per Minute</p>\n",type:"Number"},{name:"rampTime",description:"<p>Seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10648,description:"<p>Returns the tempo, in Beats Per Minute, of this part.</p>\n",itemtype:"method",name:"getBPM",return:{description:"",type:"Number"},class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10657,description:"<p>Start playback of this part. It will play\nthrough all of its phrases at a speed\ndetermined by setBPM.</p>\n",itemtype:"method",name:"start",params:[{name:"time",description:"<p>seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10673,description:"<p>Loop playback of this part. It will begin\nlooping through all of its phrases at a speed\ndetermined by setBPM.</p>\n",itemtype:"method",name:"loop",params:[{name:"time",description:"<p>seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10690,description:"<p>Tell the part to stop looping.</p>\n",itemtype:"method",name:"noLoop",class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10702,description:"<p>Stop the part and cue it to step 0. Playback will resume from the begining of the Part when it is played again.</p>\n",itemtype:"method",name:"stop",params:[{name:"time",description:"<p>seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10712,description:"<p>Pause the part. Playback will resume\nfrom the current step.</p>\n",itemtype:"method",name:"pause",params:[{name:"time",description:"<p>seconds from now</p>\n",type:"Number"}],class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10724,description:"<p>Add a p5.Phrase to this Part.</p>\n",itemtype:"method",name:"addPhrase",params:[{name:"phrase",description:"<p>reference to a p5.Phrase</p>\n",type:"p5.Phrase"}],class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10745,description:"<p>Remove a phrase from this part, based on the name it was\ngiven when it was created.</p>\n",itemtype:"method",name:"removePhrase",params:[{name:"phraseName",description:"",type:"String"}],class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10759,description:"<p>Get a phrase from this part, based on the name it was\ngiven when it was created. Now you can modify its array.</p>\n",itemtype:"method",name:"getPhrase",params:[{name:"phraseName",description:"",type:"String"}],class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10773,description:"<p>Find all sequences with the specified name, and replace their patterns with the specified array.</p>\n",itemtype:"method",name:"replaceSequence",params:[{name:"phraseName",description:"",type:"String"},{name:"sequence",description:"<p>Array of values to pass into the callback\n                          at each step of the phrase.</p>\n",type:"Array"}],class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10800,description:"<p>Set the function that will be called at every step. This will clear the previous function.</p>\n",itemtype:"method",name:"onStep",params:[{name:"callback",description:"<p>The name of the callback\n                            you want to fire\n                            on every beat/tatum.</p>\n",type:"Function"}],class:"p5.Part",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10853,description:"<p>Start playback of the score.</p>\n",itemtype:"method",name:"start",class:"p5.Score",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10862,description:"<p>Stop playback of the score.</p>\n",itemtype:"method",name:"stop",class:"p5.Score",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10872,description:"<p>Pause playback of the score.</p>\n",itemtype:"method",name:"pause",class:"p5.Score",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10880,description:"<p>Loop playback of the score.</p>\n",itemtype:"method",name:"loop",class:"p5.Score",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10889,description:"<p>Stop looping playback of the score. If it\nis currently playing, this will go into effect\nafter the current roun
21d of playback completes.</p>\n",itemtype:"method",name:"noLoop",class:"p5.Score",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10914,description:"<p>Set the tempo for all parts in the score</p>\n",itemtype:"method",name:"setBPM",params:[{name:"BPM",description:"<p>Beats Per Minute</p>\n",type:"Number"},{name:"rampTime",description:"<p>Seconds from now</p>\n",type:"Number"}],class:"p5.Score",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10982,description:'<p>musicalTimeMode uses <a href = "https://github.com/Tonejs/Tone.js/wiki/Time">Tone.Time</a> convention\ntrue if string, false if number</p>\n',itemtype:"property",name:"musicalTimeMode",type:"Boolean",class:"p5.SoundLoop",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10989,description:"<p>musicalTimeMode variables\nmodify these only when the interval is specified in musicalTime format as a string</p>\n",class:"p5.SoundLoop",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:10996,description:"<p>Set a limit to the number of loops to play. defaults to Infinity</p>\n",itemtype:"property",name:"maxIterations",type:"Number",class:"p5.SoundLoop",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11005,description:"<p>Do not initiate the callback if timeFromNow is &lt; 0\nThis ususually occurs for a few milliseconds when the page\nis not fully loaded</p>\n<p>The callback should only be called until maxIterations is reached</p>\n",class:"p5.SoundLoop",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11019,description:"<p>Start the loop</p>\n",itemtype:"method",name:"start",params:[{name:"timeFromNow",description:"<p>schedule a starting time</p>\n",type:"Number",optional:!0}],class:"p5.SoundLoop",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11032,description:"<p>Stop the loop</p>\n",itemtype:"method",name:"stop",params:[{name:"timeFromNow",description:"<p>schedule a stopping time</p>\n",type:"Number",optional:!0}],class:"p5.SoundLoop",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11045,description:"<p>Pause the loop</p>\n",itemtype:"method",name:"pause",params:[{name:"timeFromNow",description:"<p>schedule a pausing time</p>\n",type:"Number",optional:!0}],class:"p5.SoundLoop",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11058,description:"<p>Synchronize loops. Use this method to start two more more loops in synchronization\nor to start a loop in synchronization with a loop that is already playing\nThis method will schedule the implicit loop in sync with the explicit master loop\ni.e. loopToStart.syncedStart(loopToSyncWith)</p>\n",itemtype:"method",name:"syncedStart",params:[{name:"otherLoop",description:"<p>a p5.SoundLoop to sync with</p>\n",type:"Object"},{name:"timeFromNow",description:"<p>Start the loops in sync after timeFromNow seconds</p>\n",type:"Number",optional:!0}],class:"p5.SoundLoop",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11139,description:"<p>Getters and Setters, setting any paramter will result in a change in the clock&#39;s\nfrequency, that will be reflected after the next callback\nbeats per minute (defaults to 60)</p>\n",itemtype:"property",name:"bpm",type:"Number",class:"p5.SoundLoop",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11157,description:"<p>number of quarter notes in a measure (defaults to 4)</p>\n",itemtype:"property",name:"timeSignature",type:"Number",class:"p5.SoundLoop",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11173,description:"<p>length of the loops interval</p>\n",itemtype:"property",name:"interval",type:"Number|String",class:"p5.SoundLoop",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11187,description:"<p>how many times the callback has been called so far</p>\n",itemtype:"property",name:"iterations",type:"Number",readonly:"",class:"p5.SoundLoop",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11228,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">
21Web Audio Dynamics Compressor Node\n  </a></p>\n',itemtype:"property",name:"compressor",type:"AudioNode",class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11239,description:"<p>Performs the same function as .connect, but also accepts\noptional parameters to set compressor&#39;s audioParams</p>\n",itemtype:"method",name:"process",params:[{name:"src",description:"<p>Sound source to be connected</p>\n",type:"Object"},{name:"attack",description:"<p>The amount of time (in seconds) to reduce the gain by 10dB,\n                           default = .003, range 0 - 1</p>\n",type:"Number",optional:!0},{name:"knee",description:"<p>A decibel value representing the range above the \n                           threshold where the curve smoothly transitions to the &quot;ratio&quot; portion.\n                           default = 30, range 0 - 40</p>\n",type:"Number",optional:!0},{name:"ratio",description:"<p>The amount of dB change in input for a 1 dB change in output\n                           default = 12, range 1 - 20</p>\n",type:"Number",optional:!0},{name:"threshold",description:"<p>The decibel value above which the compression will start taking effect\n                           default = -24, range -100 - 0</p>\n",type:"Number",optional:!0},{name:"release",description:"<p>The amount of time (in seconds) to increase the gain by 10dB\n                           default = .25, range 0 - 1</p>\n",type:"Number",optional:!0}],class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11262,description:"<p>Set the paramters of a compressor.</p>\n",itemtype:"method",name:"set",params:[{name:"attack",description:"<p>The amount of time (in seconds) to reduce the gain by 10dB,\n                           default = .003, range 0 - 1</p>\n",type:"Number"},{name:"knee",description:"<p>A decibel value representing the range above the \n                           threshold where the curve smoothly transitions to the &quot;ratio&quot; portion.\n                           default = 30, range 0 - 40</p>\n",type:"Number"},{name:"ratio",description:"<p>The amount of dB change in input for a 1 dB change in output\n                           default = 12, range 1 - 20</p>\n",type:"Number"},{name:"threshold",description:"<p>The decibel value above which the compression will start taking effect\n                           default = -24, range -100 - 0</p>\n",type:"Number"},{name:"release",description:"<p>The amount of time (in seconds) to increase the gain by 10dB\n                           default = .25, range 0 - 1</p>\n",type:"Number"}],class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11294,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:11314,description:"<p>Get current knee or set value w/ time ramp</p>\n",itemtype:"method",name:"knee",params:[{name:"knee",description:"<p>A decibel value representing the range above the \n                       threshold where the curve smoothly transitions to the &quot;ratio&quot; portion.\n                       default = 30, range 0 - 40</p>\n",type:"Number",optional:!0},{name:"time",description:"<p>Assign time value to schedule the change in value</p>\n",type:"Number",optional:!0}],class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11334,description:"<p>Get current ratio or set value w/ time ramp</p>\n",itemtype:"method",name:"ratio",params:[{name:"ratio",description:"<p>The amount of dB change in input for a 1 dB change in output\n                           default = 12, range 1 - 20</p>\n",type:"Number",optional:!0},{name:"time",description:"<p>Assign time value to schedule the change in value</p>\n",type:"Number",optional:!0}],class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11353,description:"<p>Get current threshold or set value w/ time ramp</p>\n",itemtype:"method",name:"threshold",params:[{name:"threshold",description:"<p>The decibel value above which the compression will start taking effect\n                           default = -24, range -100 - 0</p>\n",type:"Number"},{name:"time",description:"<p>Assign time value to schedule the change in value</p>\n",type:"Number",optional:!0}],class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11372,description:"<p>Get current release or set value w/ time ramp</p>\n",itemtype:"method",name:"release",params:[{name:"release",description:"<p>The amount of time (in seconds) to increase the gain by 10dB\n                           default = .25, range 0 - 1</p>\n",type:"Number"},{name:"time",description:"<p>Assign time value to schedule the change in value</p>\n",type:"Number",optional:!0}],class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11392,description:"<p>Return the current reduction value</p>\n",itemtype:"method",name:"reduction",return:{description:"Value of the amount of gain reduction that is applied to the signal",type:"Number"},class:"p5.Compressor",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11508,description:"<p>Connect a specific device to the p5.SoundRecorder.\nIf no parameter is given, p5.SoundRecorer will record\nall audible p5.sound from your sketch.</p>\n",itemtype:"method",name:"setInput",params:[{name:"unit",description:"<p>p5.sound object or a web audio unit\n                       that outputs sound</p>\n",type:"Object",optional:!0}],class:"p5.SoundRecorder",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11529,description:"<p>Start recording. To access the recording, provide\na p5.SoundFile as the first parameter. The p5.SoundRecorder\nwill send its recording to that p5.SoundFile for playback once\nrecording is complete. Optional parameters include duration\n(in seconds) of the recording, and a callback function that\nwill be called once the complete recording has been\ntransfered to the p5.SoundFile.</p>\n",itemtype:"method",name:"record",params:[{name:"soundFile",description:"<p>p5.SoundFile</p>\n",type:"p5.SoundFile"},{name:"duration",description:"<p>Time (in seconds)</p>\n",type:"Number",optional:!0},{name:"callback",description:"<p>The name of a function that will be\n                              called once the recording completes</p>\n",type:"Function",optional:!0}],class:"p5.SoundRecorder",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11562,description:"<p>Stop the recording. Once the recording is stopped,\nthe results will be sent to the p5.SoundFile that\nwas given on .record(), and if a callback function\nwas provided on record, that function will be called.</p>\n",itemtype:"method",name:"stop",class:"p5.SoundRecorder",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11635,description:'<p>Save a p5.SoundFile as a .wav file. The browser will prompt the user\nto download the file to their device.\nFor uploading audio to a server, use\n<a href="/docs/reference/#/p5.SoundFile/saveBlob"><code>p5.SoundFile.saveBlob</code></a>.</p>\n',itemtype:"method",name:"saveSound",params:[{name:"soundFile",description:"<p>
21p5.SoundFile that you wish to save</p>\n",type:"p5.SoundFile"},{name:"fileName",description:"<p>name of the resulting .wav file.</p>\n",type:"String"}],class:"p5",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11761,description:"<p>isDetected is set to true when a peak is detected.</p>\n",itemtype:"attribute",name:"isDetected",type:"Boolean",default:"false",class:"p5.PeakDetect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11774,description:"<p>The update method is run in the draw loop.</p>\n<p>Accepts an FFT object. You must call .analyze()\non the FFT object prior to updating the peakDetect\nbecause it relies on a completed FFT analysis.</p>\n",itemtype:"method",name:"update",params:[{name:"fftObject",description:"<p>A p5.FFT object</p>\n",type:"p5.FFT"}],class:"p5.PeakDetect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11805,description:"<p>onPeak accepts two arguments: a function to call when\na peak is detected. The value of the peak,\nbetween 0.0 and 1.0, is passed to the callback.</p>\n",itemtype:"method",name:"onPeak",params:[{name:"callback",description:"<p>Name of a function that will\n                            be called when a peak is\n                            detected.</p>\n",type:"Function"},{name:"val",description:"<p>Optional value to pass\n                            into the function when\n                            a peak is detected.</p>\n",type:"Object",optional:!0}],example:["\n<div><code>\nvar cnv, soundFile, fft, peakDetect;\nvar ellipseWidth = 0;\n\nfunction preload() {\n  soundFile = loadSound('assets/beat.mp3');\n}\n\nfunction setup() {\n  cnv = createCanvas(100,100);\n  textAlign(CENTER);\n\n  fft = new p5.FFT();\n  peakDetect = new p5.PeakDetect();\n\n  setupSound();\n\n  // when a beat is detected, call triggerBeat()\n  peakDetect.onPeak(triggerBeat);\n}\n\nfunction draw() {\n  background(0);\n  fill(255);\n  text('click to play', width/2, height/2);\n\n  fft.analyze();\n  peakDetect.update(fft);\n\n  ellipseWidth *= 0.95;\n  ellipse(width/2, height/2, ellipseWidth, ellipseWidth);\n}\n\n// this function is called by peakDetect.onPeak\nfunction triggerBeat() {\n  ellipseWidth = 50;\n}\n\n// mouseclick starts/stops sound\nfunction setupSound() {\n  cnv.mouseClicked( function() {\n    if (soundFile.isPlaying() ) {\n      soundFile.stop();\n    } else {\n      soundFile.play();\n    }\n  });\n}\n</code></div>"],class:"p5.PeakDetect",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11954,description:"<p>Connect a source to the gain node.</p>\n",itemtype:"method",name:"setInput",params:[{name:"src",description:"<p>p5.sound / Web Audio object with a sound\n                         output.</p>\n",type:"Object"}],class:"p5.Gain",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11964,description:"<p>Send output to a p5.sound or web audio object</p>\n",itemtype:"method",name:"connect",params:[{name:"unit",description:"",type:"Object"}],class:"p5.Gain",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11974,description:"<p>Disconnect all output.</p>\n",itemtype:"method",name:"disconnect",class:"p5.Gain",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:11984,description:"<p>Set the output level of the gain node.</p>\n",itemtype:"method",name:"amp",params:[{name:"volume",description:"<p>amplitude between 0 and 1.0</p>\n",type:"Number"},{name:"rampTime",description:"<p>create a fade that lasts rampTime</p>\n",type:"Number",optional:!0},{name:"timeFromNow",description:"<p>schedule this event to happen\n                              seconds from now</p>\n",type:"Number",optional:!0}],class:"p5.Gain",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12042,description:"<p>Connect to p5 objects or Web Audio Nodes</p>\n",itemtype:"method",name:"connect",params:[{name:"unit",description:"",type:"Object"}],class:"p5.AudioVoice",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12051,description:"<p>Disconnect from soundOut</p>\n",itemtype:"method",name:"disconnect",class:"p5.AudioVoice",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12131,description:"<p>Play tells the MonoSynth to start playing a note. This method schedules\nthe calling of .triggerAttack and .triggerRelease.</p>\n",itemtype:"method",name:"play",params:[{name:"note",description:'<p>the note you want to play, specified as a\n                               frequency in Hertz (Number) or as a midi\n                               value in Note/Octave format (&quot;C4&quot;, &quot;Eb3&quot;...etc&quot;)\n                               See <a href = "https://github.com/Tonejs/Tone.js/wiki/Instruments">\n                               Tone</a>. Defaults to 440 hz.</p>\n',type:"String | Number"},{name:"velocity",description:"<p>velocity of the note to play (ranging from 0 to 1)</p>\n",type:"Number",optional:!0},{name:"secondsFromNow",description:"<p>time from now (in seconds) at which to play</p>\n",type:"Number",optional:!0},{name:"sustainTime",description:"<p>time to sustain before releasing the envelope</p>\n",type:"Number",optional:!0}],example:["\n<div><code>\nvar monoSynth;\n\nfunction setup() {\n  var cnv = createCanvas(100, 100);\n  cnv.mousePressed(playSynth);\n\n  monoSynth = new p5.MonoSynth();\n\n  textAlign(CENTER);\n  text('click to play', width/2, height/2);\n}\n\nfunction playSynth() {\n  // time from now (in seconds)\n  var time = 0;\n  // note duration (in seconds)\n  var dur = 1/6;\n  // note velocity (volume, from 0 to 1)\n  var v = random();\n\n  monoSynth.play(\"Fb3\", v, 0, dur);\n  monoSynth.play(\"Gb3\", v, time += dur, dur);\n\n  background(random(255), random(255), 255);\n  text('click to play', width/2, height/2);\n}\n</code></div>\n"],class:"p5.MonoSynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12179,description:"<p>Trigger the Attack, and Decay portion of the Envelope.\nSimilar to holding down a key on a piano, but it will\nhold the sustain level until you let go.</p>\n",params:[{name:"note",description:'<p>the note you want to play, specified as a\n                               frequency in Hertz (Number) or as a midi\n                               value in Note/Octave format (&quot;C4&quot;, &quot;Eb3&quot;...etc&quot;)\n                               See <a href = "https://github.com/Tonejs/Tone.js/wiki/Instruments">\n                               Tone</a>. Defaults to 440 hz</p>\n',type:"String | Number"},{name:"velocity",description:"<p>velocity of the note to play (ranging from 0 to 1)</p>\n",type:"Number",optional:!0},{name:"secondsFromNow",description:"<p>time from now (in seconds) at which to play</p>\n",type:"Number",optional:!0}],itemtype:"method",name:"triggerAttack",example:['\n<div><code>\nvar monoSynth = new p5.MonoSynth();\n\nfunction mousePressed() {\n  monoSynth.triggerAttack("E3");\n}\n\nfunction mouseReleased() {\n  monoSynth.triggerRelease();\n}\n</code></div>'],class:"p5.MonoSynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12212,description:"<p>Trigger the release of the Envelope. This is similar to releasing\nthe key on a piano and letting the sound fade according to the\nrelease level and release time.</p>\n",params:[{name:"secondsFromNow",description:"<p>time to trigger the release</p>\n",type:"Number"}],itemtype:"method",name:"triggerRelease",example:['\n<div><code>\nvar monoSynth = new p5.MonoSynth();\n\nfunction mousePressed() {\n  monoSynth.triggerAttack("E3");\n}\n\nfunction mouseReleased() {\n  monoSynth.triggerRelease();\n}\n</code></div>'],class:"p5.MonoSynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12236,description:'<p>Set values like a traditional\n<a href="https://en.wikipedia.org/wiki/Synthesizer#/media/File:ADSR_parameter.svg">\nADSR envelope\n</a>.</p>\n',itemtype:"method",name:"setADSR",params:[{name:"attackTime",description:"<p>Time (in seconds before envelope\n                              reaches Attack Level</p>\n",type:"Number"},{name:"decayTime",description:"<p>Time (in seconds) before envelope\n                              reaches Decay/Sustain Level</p>\n",type:"Number",optional:!0},{name:"susRatio",description:"<p>Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n                              where 1.0 = attackLevel, 0.0 = releaseLevel.\n                              The susRatio determines the decayLevel and the level at which the\n                              sustain portion of the envelope will sustain.\n                              For example, if attackLevel is 0.4, releaseLevel is 0,\n                              and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n                              increased to 1.0 (using <code>setRange</code>),\n                              then decayLevel would increase proportionally, to become 0.5.</p>\n",type:"Number",optional:!0},{name:"releaseTime",description:"<p>Time in seconds from now (defaults to 0)</p>\n",type:"Number",optional:!0}],class:"p5.MonoSynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12260,description:"<p>Getters and Setters</p>\n",itemtype:"property",name:"attack",type:"Number",class:"p5.MonoSynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12264,itemtype:"property",name:"decay",type:"Number",class:"p5.MonoSynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12267,itemtype:"property",name:"sustain",type:"Number",class:"p5.MonoSynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12270,itemtype:"property",name:"release",type:"Number",class:"p5.MonoSynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12307,description:"<p>MonoSynth amp</p>\n",itemtype:"method",name:"amp",params:[{name:"vol",description:"<p>desired volume</p>\n",type:"Number"},{name:"rampTime",description:"<p>Time to reach new volume</p>\n",type:"Number",optional:!0}],return:{description:"new volume value",type:"Number"},class:"p5.MonoSynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12321,description:"<p>Connect to a p5.sound / Web Audio object.</p>\n",itemtype:"method",name:"connect",params:[{name:"unit",description:"<p>A p5.sound or Web Audio object</p>\n",type:"Object"}],class:"p5.MonoSynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12331,description:"<p>Disconnect all outputs</p>\n",itemtype:"method",name:"disconnect",class:"p5.MonoSynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12341,description:"<p>Get rid of the MonoSynth and free up its resources / memory.</p>\n",itemtype:"method",name:"dispose",class:"p5.MonoSynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12411,description:"<p>An object that holds information about which notes have been played and\nwhich notes are currently being played. New notes are added as keys\non the fly. While a note has been attacked, but not released, the value of the\nkey is the audiovoice which is generating that note. When notes are released,\nthe value of the key becomes undefined.</p>\n",itemtype:"property",name:"notes",class:"p5.PolySynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12423,description:"<p>A PolySynth must have at least 1 voice, defaults to 8</p>\n",itemtype:"property",name:"polyvalue",class:"p5.PolySynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12428,description:"<p>Monosynth that generates the sound for each note that is triggered. The\np5.PolySynth defaults to using the p5.MonoSynth as its voice.</p>\n",itemtype:"property",name:"AudioVoice",class:"p5.PolySynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12459,description:"<p>Play a note by triggering noteAttack and noteRelease with sustain time</p>\n",itemtype:"method",name:"play",params:[{name:"note",description:"<p>midi note to play (ranging from 0 to 127 - 60 being a middle C)</p>\n",type:"Number",optional:!0},{name:"velocity",description:"<p>velocity of the note to play (ranging from 0 to 1)</p>\n",type:"Number",optional:!0},{name:"secondsFromNow",description:"<p>time from now (in seconds) at which to play</p>\n",type:"Number",optional:!0},{name:"sustainTime",description:"<p>time to sustain before releasing the envelope</p>\n",type:"Number",optional:!0}],example:['\n<div><code>\nvar polySynth;\n\nfunction setup() {\n  var cnv = createCanvas(100, 100);\n  cnv.mousePressed(playSynth);\n\n  polySynth = new p5.PolySynth();\n\n  textAlign(CENTER);\n  text(\'click to play\', width/2, height/2);\n}\n\nfunction playSynth() {\n  // note duration (in seconds)\n  var dur = 0.1;\n\n  // time from now (in seconds)\n  var time = 0;\n\n  // velocity (volume, from 0 to 1)\n  var vel = 0.1;\n\n  polySynth.play("G2", vel, 0, dur);
21\n  polySynth.play("C3", vel, 0, dur);\n  polySynth.play("G3", vel, 0, dur);\n\n  background(random(255), random(255), 255);\n  text(\'click to play\', width/2, height/2);\n}\n</code></div>'],class:"p5.PolySynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12505,description:"<p>noteADSR sets the envelope for a specific note that has just been triggered.\nUsing this method modifies the envelope of whichever audiovoice is being used\nto play the desired note. The envelope should be reset before noteRelease is called\nin order to prevent the modified envelope from being used on other notes.</p>\n",itemtype:"method",name:"noteADSR",params:[{name:"note",description:"<p>Midi note on which ADSR should be set.</p>\n",type:"Number",optional:!0},{name:"attackTime",description:"<p>Time (in seconds before envelope\n                              reaches Attack Level</p>\n",type:"Number",optional:!0},{name:"decayTime",description:"<p>Time (in seconds) before envelope\n                              reaches Decay/Sustain Level</p>\n",type:"Number",optional:!0},{name:"susRatio",description:"<p>Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n                              where 1.0 = attackLevel, 0.0 = releaseLevel.\n                              The susRatio determines the decayLevel and the level at which the\n                              sustain portion of the envelope will sustain.\n                              For example, if attackLevel is 0.4, releaseLevel is 0,\n                              and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n                              increased to 1.0 (using <code>setRange</code>),\n                              then decayLevel would increase proportionally, to become 0.5.</p>\n",type:"Number",optional:!0},{name:"releaseTime",description:"<p>Time in seconds from now (defaults to 0)</p>\n",type:"Number",optional:!0}],class:"p5.PolySynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12533,description:"<p>Set the PolySynths global envelope. This method modifies the envelopes of each\nmonosynth so that all notes are played with this envelope.</p>\n",itemtype:"method",name:"setADSR",params:[{name:"attackTime",description:"<p>Time (in seconds before envelope\n                               reaches Attack Level</p>\n",type:"Number",optional:!0},{name:"decayTime",description:"<p>Time (in seconds) before envelope\n                               reaches Decay/Sustain Level</p>\n",type:"Number",optional:!0},{name:"susRatio",description:"<p>Ratio between attackLevel and releaseLevel, on a scale from 0 to 1,\n                               where 1.0 = attackLevel, 0.0 = releaseLevel.\n                               The susRatio determines the decayLevel and the level at which the\n                               sustain portion of the envelope will sustain.\n                               For example, if attackLevel is 0.4, releaseLevel is 0,\n                               and susAmt is 0.5, the decayLevel would be 0.2. If attackLevel is\n                               increased to 1.0 (using <code>setRange</code>),\n                               then decayLevel would increase proportionally, to become 0.5.</p>\n",type:"Number",optional:!0},{name:"releaseTime",description:"<p>Time in seconds from now (defaults to 0)</p>\n",type:"Number",optional:!0}],class:"p5.PolySynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12557,description:"<p>Trigger the Attack, and Decay portion of a MonoSynth.\nSimilar to holding down a key on a piano, but it will\nhold the sustain level until you let go.</p>\n",itemtype:"method",name:"noteAttack",params:[{name:"note",description:"<p>midi note on which attack should be triggered.</p>\n",type:"Number",optional:!0},{name:"velocity",description:"<p>velocity of the note to play (ranging from 0 to 1)/</p>\n",type:"Number",optional:!0},{name:"secondsFromNow",description:"<p>time from now (in seconds)</p>\n",type:"Number",optional:!0}],example:['\n<div><code>\nvar polySynth = new p5.PolySynth();\nvar pitches = ["G", "D", "G", "C"];\nvar octaves = [2, 3, 4];\n\nfunction mousePressed() {\n  // play a chord: multiple notes at the same time\n  for (var i = 0; i < 4;
21 i++) {\n    var note = random(pitches) + random(octaves);\n    polySynth.noteAttack(note, 0.1);\n  }\n}\n\nfunction mouseReleased() {\n  // release all voices\n  polySynth.noteRelease();\n}\n</code></div>'],class:"p5.PolySynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12647,description:"<p>Trigger the Release of an AudioVoice note. This is similar to releasing\nthe key on a piano and letting the sound fade according to the\nrelease level and release time.</p>\n",itemtype:"method",name:"noteRelease",params:[{name:"note",description:"<p>midi note on which attack should be triggered.\n                                  If no value is provided, all notes will be released.</p>\n",type:"Number",optional:!0},{name:"secondsFromNow",description:"<p>time to trigger the release</p>\n",type:"Number",optional:!0}],example:['\n<div><code>\nvar pitches = ["G", "D", "G", "C"];\nvar octaves = [2, 3, 4];\nvar polySynth = new p5.PolySynth();\n\nfunction mousePressed() {\n  // play a chord: multiple notes at the same time\n  for (var i = 0; i < 4; i++) {\n    var note = random(pitches) + random(octaves);\n    polySynth.noteAttack(note, 0.1);\n  }\n}\n\nfunction mouseReleased() {\n  // release all voices\n  polySynth.noteRelease();\n}\n</code></div>\n'],class:"p5.PolySynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12712,description:"<p>Connect to a p5.sound / Web Audio object.</p>\n",itemtype:"method",name:"connect",params:[{name:"unit",description:"<p>A p5.sound or Web Audio object</p>\n",type:"Object"}],class:"p5.PolySynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12722,description:"<p>Disconnect all outputs</p>\n",itemtype:"method",name:"disconnect",class:"p5.PolySynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12732,description:"<p>Get rid of the MonoSynth and free up its resources / memory.</p>\n",itemtype:"method",name:"dispose",class:"p5.PolySynth",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12800,description:'<p>The p5.Distortion is built with a\n<a href="http://www.w3.org/TR/webaudio/#WaveShaperNode">\nWeb Audio WaveShaper Node</a>.</p>\n',itemtype:"property",name:"WaveShaperNode",type:"AudioNode",class:"p5.Distortion",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12815,description:"<p>Process a sound source, optionally specify amount and oversample values.</p>\n",itemtype:"method",name:"process",params:[{name:"amount",description:"<p>Unbounded distortion amount.\n                               Normal values range from 0-1.</p>\n",type:"Number",optional:!0,optdefault:"0.25"},{name:"oversample",description:"<p>&#39;none&#39;, &#39;2x&#39;, or &#39;4x&#39;.</p>\n",type:"String",optional:!0,optdefault:"'none'"}],class:"p5.Distortion",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12827,description:"<p>Set the amount and oversample of the waveshaper distortion.</p>\n",itemtype:"method",name:"set",params:[{name:"amount",description:"<p>Unbounded distortion amount.\n                               Normal values range from 0-1.</p>\n",type:"Number",optional:!0,optdefault:"0.25"},{name:"oversample",description:"<p>&#39;none&#39;, &#39;2x&#39;, or &#39;4x&#39;.</p>\n",type:"String",optional:!0,optdefault:"'none'"}],class:"p5.Distortion",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12845,description:"<p>Return the distortion amount, typically between 0-1.</p>\n",itemtype:"method",name:"getAmount",return:{description:"Unbounded distortion amount.\n                 Normal values range from 0-1.",type:"Number"},class:"p5.Distortion",module:"p5.sound",submodule:"p5.sound"},{file:"lib/addons/p5.sound.js",line:12855,description:"<p>Return the oversampling.</p>\n",itemtype:"method",name:"getOversample",return:{description:"Oversample can either be 'none', '2x', or '4x'.",type:"String"},class:"p5.Distortion",module:"p5.sound",submodule:"p5.sound"}],warnings:[{message:"unknown tag: alt",line:" src/color/creating_reading.js:16"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:61"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:91"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:134"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:332"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:363"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:400"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:497"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:527"},{message:"unknown tag: alt",line:" src/color/creating_reading.js:567"},{message:"unknown tag: alt",line:" src/color/p5.Color.js:52"},{message:"unknown tag: alt",line:" src/color/p5.Color.js:253"},{message:"unknown tag: alt",line:" src/color/p5.Color.js:280"},{message:"unknown tag: alt",line:" src/color/p5.Color.js:307"},{message:"unknown tag: alt",line:" src/color/p5.Color.js:334"},{message:"unknown tag: alt",line:" src/color/p5.Color.js:768"},{message:"unknown tag: alt",line:" src/color/setting.js:15"},{message:"unknown tag: alt",line:" src/color/setting.js:181"},{message:"unknown tag: alt",line:" src/color/setting.js:220"},{message:"unknown tag: alt",line:" src/color/setting.js:341"},{message:"unknown tag: alt",line:" src/color/setting.js:498"},{message:"unknown tag: alt",line:" src/color/setting.js:539"},{message:"unknown tag: alt",line:" src/color/setting.js:579"},{message:"unknown tag: alt",line:" src/core/shape/2d_primitives.js:102"},{message:"unknown tag: alt",line:" src/core/shape/2d_primitives.js:210"},{message:"unknown tag: alt",line:" src/core/shape/2d_primitives.js:270"},{message:"unknown tag: alt",line:" src/core/shape/2d_primitives.js:300"},{message:"unknown tag: alt",line:" src/core/shape/2d_primitives.js:356"},{message:"unknown tag: alt",line:" src/core/shape/2d_primitives.js:391"},{message:"unknown tag: alt",line:" src/core/shape/2d_primitives.js:458"},{message:"unknown tag: alt",line:" src/core/shape/2d_primitives.js:541"},{message:"unknown tag: alt",line:" src/core/shape/2d_primitives.js:595"},{message:"unknown tag: alt",line:" src/core/shape/attributes.js:14"},{message:"unknown tag: alt",line:" src/core/shape/attributes.js:83"},{message:"unknown tag: alt",line:" src/core/shape/attributes.js:116"},{message:"unknown tag: alt",line:" src/core/shape/attributes.js:185"},{message:"unknown tag: alt",line:" src/core/shape/attributes.js:219"},{message:"unknown tag: alt",line:" src/core/shape/attributes.js:256"},{message:"unknown tag: alt",line:" src/core/shape/attributes.js:323"},{message:"unknown tag: alt",line:" src/core/shape/curves.js:13"},{message:"unknown tag: alt",line:" src/core/shape/curves.js:96"},{message:"unknown tag: alt",line:" src/core/shape/curves.js:139"},{message:"unknown tag: alt",line:" src/core/shape/curves.js:194"},{message:"unknown tag: alt",line:" src/core/shape/curves.js:273"},{message:"unknown tag: alt",line:" src/core/shape/curves.js:364"},{message:"unknown tag: alt",line:" src/core/shape/curves.js:406"},{message:"unknown tag: alt",line:" src/core/shape/curves.js:502"},{message:"unknown tag: alt",line:" src/core/shape/vertex.js:22"},{message:"unknown tag: alt",line:" src/core/shape/vertex.js:70"},{message:"unknown tag: alt",line:" src/core/shape/vertex.js:270"},{message:"unknown tag: alt",line:" src/core/shape/vertex.js:270"},{message:"unknown tag: alt",line:" src/core/shape/vertex.js:270"},{message:"unknown tag: alt",line:" src/core/shape/vertex.js:398"},{message:"unknown tag: alt",line:" src/core/shape/vertex.js:443"},{message:"unknown tag: alt",line:" src/core/shape/vertex.js:508"},{message:"unknown tag: alt",line:" src/core/shape/vertex.js:568"},{message:"unknown tag: alt",line:" src/core/shape/vertex.js:654"},{message:"unknown tag: alt",line:" src/core/shape/vertex.js:720"},{message:"unknown tag: alt",line:" src/core/shape/vertex.js:813"},{message:"unknown tag: alt",line:" src/core/constants.js:61"},{message:"unknown tag: alt",line:" src/core/constants.js:80"},{message:"unknown tag: alt",line:" src/core/constants.js:99"},{message:"unknown tag: alt",line:" src/core/constants.js:118"},{message:"unknown tag: alt",line:" src/core/constants.js:137"},{message:"unknown tag: alt",line:" src/core/environment.js:22"},{message:"unknown tag: alt",line:" src/core/environment.js:53"},{message:"unknown tag: alt",line:" src/core/environment.js:80"},{message:"unknown tag: alt",line:" src/core/environment.js:131"},{message:"unknown tag: alt",line:" src/core/environment.js:163"},{message:"unknown tag: alt",line:" src/core/environment.js:232"},{message:"unknown tag: alt",line:" src/core/environment.js:332"},{message:"unknown tag: alt",line:" src/core/environment.js:357"},{message:"unknown tag: alt",line:" src/core/environment.js:376"},{message:"unknown tag: alt",line:" src/core/environment.js:395"},{message:"unknown tag: alt",line:" src/core/environment.js:411"},{message:"unknown tag: alt",line:" src/core/environment.js:427"},{message:"unknown tag: alt",line:" src/core/environment.js:505"},{message:"unknown tag: alt",line:" src/core/environment.js:556"},{message:"replacing incorrect tag: returns with return",line:" src/core/environment.js:591"},{message:"replacing incorrect tag: returns with return",line:" src/core/environment.js:611"},{message:"unknown tag: alt",line:" src/core/environment.js:611"},{message:"unknown tag: alt",line:" src/core/environment.js:668"},{message:"unknown tag: alt",line:" src/core/environment.js:699"},{message:"unknown tag: alt",line:" src/core/environment.js:722"},{message:"unknown tag: alt",line:" src/core/main.js:42"},{message:"unknown tag: alt",line:" src/core/main.js:83"},{message:"unknown tag: alt",line:" src/core/main.js:114"},{message:"unknown tag: alt",line:" src/core/main.js:396"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:52"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:122"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:162"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:197"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:258"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:307"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:373"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:427"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:483"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:541"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:584"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:626"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:674"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:714"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:763"},{message:"unknown tag: alt",line:" src/core/p5.Element.js:801"},{message:"unknown tag: alt",line:" src/core/p5.Graphics.js:65"},{message:"unknown tag: alt",line:" src/core/p5.Graphics.js:117"},{message:"unknown tag: alt",line:" src/core/rendering.js:17"},{message:"unknown tag: alt",line:" src/core/rendering.js:119"},{message:"unknown tag: alt",line:" src/core/rendering.js:174"},{message:"unknown tag: alt",line:" src/core/rendering.js:197"},{message:"unknown tag: alt",line:" src/core/rendering.js:236"},{message:"unknown tag: alt",line:" src/core/structure.js:12"},{message:"unknown tag: alt",line:" src/core/structure.js:74"},{message:"unknown tag: alt",line:" src/core/structure.js:122"},{message:"unknown tag: alt",line:" src/core/structure.js:191"},{message:"unknown tag: alt",line:" src/core/structure.js:261"},{message:"unknown tag: alt",line:" src/core/transform.js:13"},{message:"unknown tag: alt",line:" src/core/transform.js:150"},{message:"unknown tag: alt",line:" src/core/transform.js:176"},{message:"unknown tag: alt",line:" src/core/transform.js:216"},{message:"unknown tag: alt",line:" src/core/transform.js:246"},{message:"unknown tag: alt",line:" src/core/transform.js:276"},{message:"unknown tag: alt",line:" src/core/transform.js:306"},{message:"unknown tag: alt",line:" src/core/transform.js:381"},{message:"unknown tag: alt",line:" src/core/transform.js:421"},{message:"unknown tag: alt",line:" src/core/transform.js:461"},{message:"unknown tag: alt",line:" src/data/local_storage.js:11"},{message:"unknown tag: alt",line:" src/data/local_storage.js:88"},{message:"unknown tag: alt",line:" src/events/acceleration.js:23"},{message:"unknown tag: alt",line:" src/events/acceleration.js:46"},{message:"unknown tag: alt",line:" src/events/acceleration.js:69"},{message:"unknown tag: alt",line:" src/events/acceleration.js:135"},{message:"unknown tag: alt",line:" src/events/acceleration.js:166"},{message:"unknown tag: alt",line:" src/events/acceleration.js:197"},{message:"unknown tag: alt",line:" src/events/acceleration.js:233"},{message:"unknown tag: alt",line:" src/events/acceleration.js:278"},{message:"unknown tag: alt",line:" src/events/acceleration.js:322"},{message:"unknown tag: alt",line:" src/events/acceleration.js:380"},{message:"unknown tag: alt",line:" src/events/acceleration.js:419"},{message:"unknown tag: alt",line:" src/events/acceleration.js:462"},{message:"unknown tag: alt",line:" src/events/acceleration.js:506"},{message:"unknown tag: alt",line:" src/events/acceleration.js:538"},{message:"unknown tag: alt",line:" src/events/acceleration.js:597"},{message:"unknown tag: alt",line:" src/events/keyboard.js:12"},{message:"unknown tag: alt",line:" src/events/keyboard.js:39"},{message:"unknown tag: alt",line:" src/events/keyboard.js:68"},{message:"unknown tag: alt",line:" src/events/keyboard.js:109"},{message:"unknown tag: alt",line:" src/events/keyboard.js:196"},{message:"unknown tag: alt",line:" src/events/keyboard.js:248"},{message:"unknown tag: alt",line:" src/events/keyboard.js:312"},{message:"unknown tag: alt",line:" src/events/mouse.js:22"},{message:"unknown tag: alt",line:" src/events/mouse.js:49"},{message:"unknown tag: alt",line:" src/events/mouse.js:76"},{message:"unknown tag: alt",line:" src/events/mouse.js:109"},{message:"unknown tag: alt",line:" src/events/mouse.js:141"},{message:"unknown tag: alt",line:" src/events/mouse.js:180"},{message:"unknown tag: alt",line:" src/events/mouse.js:219"},{message:"unknown tag: alt",line:" src/events/mouse.js:260"},{message:"unknown tag: alt",line:" src/events/mouse.js:302"},{message:"unknown tag: alt",line:" src/events/mouse.js:341"},{message:"unknown tag: alt",line:" src/events/mouse.js:432"},{message:"unknown tag: alt",line:" src/events/mouse.js:487"},{message:"unknown tag: alt",line:" src/events/mouse.js:568"},{message:"unknown tag: alt",line:" src/events/mouse.js:650"},{message:"unknown tag: alt",line:" src/events/mouse.js:728"},{message:"unknown tag: alt",line:" src/events/mouse.js:798"},{message:"unknown tag: alt",line:" src/events/mouse.js:883"},{message:"unknown tag: alt",line:" src/events/touch.js:12"},{message:"unknown tag: alt",line:" src/events/touch.js:74"},{message:"unknown tag: alt",line:" src/events/touch.js:154"},{message:"unknown tag: alt",line:" src/events/touch.js:227"},{message:"unknown tag: alt",line:" src/image/image.js:22"},{message:"unknown tag: alt",line:" src/image/image.js:102"},{message:"unknown tag: alt",line:" src/image/image.js:195"},{message:"unknown tag: alt",line:" src/image/loading_displaying.js:17"},{message:"replacing incorrect tag: returns with return",line:" src/image/loading_displaying.js:110"},{message:"unknown tag: alt",line:" src/image/loading_displaying.js:127"},{message:"unknown tag: alt",line:" src/image/loading_displaying.js:298"},{message:"unknown tag: alt",line:" src/image/loading_displaying.js:398"},{message:"unknown tag: alt",line:" src/image/loading_displaying.js:464"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:90"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:117"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:153"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:232"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:268"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:316"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:371"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:409"},{message:"unknown tag: alt"
21,line:" src/image/p5.Image.js:494"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:575"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:638"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:674"},{message:"unknown tag: alt",line:" src/image/p5.Image.js:796"},{message:"unknown tag: alt",line:" src/image/pixels.js:14"},{message:"unknown tag: alt",line:" src/image/pixels.js:83"},{message:"unknown tag: alt",line:" src/image/pixels.js:177"},{message:"unknown tag: alt",line:" src/image/pixels.js:236"},{message:"unknown tag: alt",line:" src/image/pixels.js:415"},{message:"unknown tag: alt",line:" src/image/pixels.js:503"},{message:"unknown tag: alt",line:" src/image/pixels.js:540"},{message:"unknown tag: alt",line:" src/image/pixels.js:614"},{message:"unknown tag: alt",line:" src/io/files.js:19"},{message:"unknown tag: alt",line:" src/io/files.js:184"},{message:"unknown tag: alt",line:" src/io/files.js:297"},{message:"unknown tag: alt",line:" src/io/files.js:607"},{message:"replacing incorrect tag: returns with return",line:" src/io/files.js:718"},{message:"unknown tag: alt",line:" src/io/files.js:718"},{message:"unknown tag: alt",line:" src/io/files.js:1526"},{message:"unknown tag: alt",line:" src/io/files.js:1584"},{message:"unknown tag: alt",line:" src/io/files.js:1652"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:56"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:120"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:168"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:214"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:263"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:328"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:523"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:576"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:618"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:879"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:944"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:994"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:1040"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:1085"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:1132"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:1177"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:1230"},{message:"unknown tag: alt",line:" src/io/p5.Table.js:1296"},{message:"unknown tag: alt",line:" src/io/p5.TableRow.js:42"},{message:"unknown tag: alt",line:" src/io/p5.TableRow.js:106"},{message:"unknown tag: alt",line:" src/io/p5.TableRow.js:150"},{message:"unknown tag: alt",line:" src/io/p5.TableRow.js:195"},{message:"unknown tag: alt",line:" src/io/p5.TableRow.js:243"},{message:"unknown tag: alt",line:" src/io/p5.TableRow.js:299"},{message:"unknown tag: alt",line:" src/io/p5.XML.js:11"},{message:"unknown tag: alt",line:" src/math/calculation.js:12"},{message:"unknown tag: alt",line:" src/math/calculation.js:36"},{message:"unknown tag: alt",line:" src/math/calculation.js:76"},{message:"unknown tag: alt",line:" src/math/calculation.js:121"},{message:"unknown tag: alt",line:" src/math/calculation.js:190"},{message:"unknown tag: alt",line:" src/math/calculation.js:240"},{message:"unknown tag: alt",line:" src/math/calculation.js:279"},{message:"unknown tag: alt",line:" src/math/calculation.js:327"},{message:"unknown tag: alt",line:" src/math/calculation.js:383"},{message:"unknown tag: alt",line:" src/math/calculation.js:422"},{message:"unknown tag: alt",line:" src/math/calculation.js:478"},{message:"unknown tag: alt",line:" src/math/calculation.js:528"},{message:"unknown tag: alt",line:" src/math/calculation.js:578"},{message:"unknown tag: alt",line:" src/math/calculation.js:631"},{message:"unknown tag: alt",line:" src/math/calculation.js:665"},{message:"unknown tag: alt",line:" src/math/calculation.js:704"},{message:"unknown tag: alt",line:" src/math/calculation.js:751"},{message:"unknown tag: alt",line:" src/math/math.js:12"},{message:"unknown tag: alt",line:" src/math/noise.js:40"},{message:"unknown tag: alt",line:" src/math/noise.js:187"},{message:"unknown tag: alt",line:" src/math/noise.js:253"},{message:"unknown tag: alt",line:" src/math/p5.Vector.js:12"},{message:"unknown tag: alt",line:" src/math/random.js:48"},{message:"unknown tag: alt",line:" src/math/random.js:79"},{message:"unknown tag: alt",line:" src/math/random.js:166"},{message:"unknown tag: alt",line:" src/math/trigonometry.js:124"},{message:"unknown tag: alt",line:" src/math/trigonometry.js:160"},{message:"unknown tag: alt",line:" src/math/trigonometry.js:188"},{message:"unknown tag: alt",line:" src/math/trigonometry.js:216"}
21,{message:"unknown tag: alt",line:" src/math/trigonometry.js:296"},{message:"replacing incorrect tag: returns with return",line:" src/math/trigonometry.js:332"},{message:"replacing incorrect tag: returns with return",line:" src/math/trigonometry.js:347"},{message:"replacing incorrect tag: returns with return",line:" src/math/trigonometry.js:362"},{message:"unknown tag: alt",line:" src/typography/attributes.js:13"},{message:"unknown tag: alt",line:" src/typography/attributes.js:84"},{message:"unknown tag: alt",line:" src/typography/attributes.js:122"},{message:"unknown tag: alt",line:" src/typography/attributes.js:154"},{message:"unknown tag: alt",line:" src/typography/attributes.js:191"},{message:"unknown tag: alt",line:" src/typography/loading_displaying.js:16"},{message:"unknown tag: alt",line:" src/typography/loading_displaying.js:143"},{message:"unknown tag: alt",line:" src/typography/loading_displaying.js:230"},{message:"unknown tag: alt",line:" src/typography/p5.Font.js:32"},{message:"unknown tag: alt",line:" src/utilities/conversion.js:12"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:15"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:44"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:132"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:243"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:319"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:381"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:459"},{message:"unknown tag: alt",line:" src/utilities/string_functions.js:548"},{message:"unknown tag: alt",line:" src/utilities/time_date.js:12"},{message:"unknown tag: alt",line:" src/utilities/time_date.js:34"},{message:"unknown tag: alt",line:" src/utilities/time_date.js:56"},{message:"unknown tag: alt",line:" src/utilities/time_date.js:78"},{message:"unknown tag: alt",line:" src/utilities/time_date.js:101"},{message:"unknown tag: alt",line:" src/utilities/time_date.js:123"},{message:"unknown tag: alt",line:" src/utilities/time_date.js:145"},{message:"unknown tag: alt",line:" src/webgl/3d_primitives.js:14"},{message:"unknown tag: alt",line:" src/webgl/interaction.js:13"},{message:"unknown tag: alt",line:" src/webgl/interaction.js:146"},{message:"unknown tag: alt",line:" src/webgl/interaction.js:146"},{message:"unknown tag: alt",line:" src/webgl/interaction.js:146"},{message:"unknown tag: alt",line:" src/webgl/interaction.js:146"},{message:"unknown tag: alt",line:" src/webgl/interaction.js:146"},{message:"unknown tag: alt",line:" src/webgl/interaction.js:380"},{message:"unknown tag: alt",line:" src/webgl/light.js:12"},{message:"unknown tag: alt",line:" src/webgl/light.js:87"},{message:"unknown tag: alt",line:" src/webgl/light.js:185"},{message:"unknown tag: alt",line:" src/webgl/light.js:287"},{message:"unknown tag: alt",line:" src/webgl/light.js:318"},{message:"unknown tag: alt",line:" src/webgl/loading.js:14"},{message:"unknown tag: alt",line:" src/webgl/loading.js:14"},{message:"unknown tag: alt",line:" src/webgl/loading.js:580"},{message:"unknown tag: alt",line:" src/webgl/material.js:14"},{message:"replacing incorrect tag: returns with return",line:" src/webgl/material.js:113"},{message:"unknown tag: alt",line:" src/webgl/material.js:113"},{message:"unknown tag: alt",line:" src/webgl/material.js:181"},{message:"unknown tag: alt",line:" src/webgl/material.js:285"},{message:"unknown tag: alt",line:" src/webgl/material.js:322"},{message:"unknown tag: alt",line:" src/webgl/material.js:419"},{message:"unknown tag: alt",line:" src/webgl/material.js:419"},{message:"unknown tag: alt",line:" src/webgl/material.js:498"},{message:"unknown tag: alt",line:" src/webgl/material.js:573"},{message:"unknown tag: alt",line:" src/webgl/material.js:623"},{message:"unknown tag: alt",line:" src/webgl/material.js:674"},{message:"unknown tag: alt",line:" src/webgl/p5.Camera.js:15"},{message:"unknown tag: alt",line:" src/webgl/p5.Camera.js:61"},{message:"unknown tag: alt",line:" src/webgl/p5.Camera.js:126"},{message:"unknown tag: alt",line:" src/webgl/p5.Camera.js:209"},{message:"unknown tag: alt",line:" src/webgl/p5.Camera.js:486"},{message:"unknown tag: alt",line:" src/webgl/p5.Camera.js:545"},{message:"unknown tag: alt",line:" src/webgl/p5.Camera.js:603"},{message:"unknown tag: alt",line:" src/webgl/p5.Camera.js:751"},{message:"unknown tag: alt",line:" src/webgl/p5.Camera.js:823"},{message:"unknown tag: alt",line:" src/webgl/p5.Camera.js:1088"},{message:"replacing incorrect tag: returns with return",line:" src/webgl/p5.RendererGL.Retained.js:40"},{message:"unknown tag: alt",line:" src/webgl/p5.RendererGL.js:263"},{message:"unknown tag: alt",line:" src/webgl/p5.RendererGL.js:519"},{message:"unknown tag: alt",line:" src/webgl/p5.RendererGL.js:561"},{message:"unknown tag: alt",line:" src/webgl/p5.RendererGL.js:631"},{message:"unknown tag: alt",line:" src/webgl/p5.Shader.js:269"},{message:"replacing incorrect tag: function with method",line:" src/webgl/text.js:117"},{message:"replacing incorrect tag: returns with return",line:" src/webgl/text.js:160"},{message:"replacing incorrect tag: function with method",line:" src/webgl/text.js:193"},{message:"replacing incorrect tag: function with method",line:" src/webgl/text.js:205"},{message:"replacing incorrect tag: function with method",line:" src/webgl/text.js:235"},{message:"replacing incorrect tag: function with method",line:" src/webgl/text.js:249"},{message:"replacing incorrect tag: function with method",line:" src/webgl/text.js:387"},{message:"replacing incorrect tag: returns with return",line:" src/webgl/text.js:387"},{message:"replacing incorrect tag: function with method",line:" src/webgl/text.js:457"},{message:"replacing incorrect tag: function with method",line:" src/webgl/text.js:472"},{message:"replacing incorrect tag: function with method",line:" src/webgl/text.js:547"},{message:"unknown tag: alt",line:" lib/addons/p5.dom.js:245"},{message:"unknown tag: alt",line:" lib/addons/p5.dom.js:313"},{message:"replacing incorrect tag: returns with return",line:" lib/addons/p5.dom.js:1463"},{message:"replacing incorrect tag: returns with return",line:" lib/addons/p5.dom.js:1525"},{message:"replacing incorrect tag: returns with return",line:" lib/addons/p5.dom.js:1629"},{message:"replacing incorrect tag: returns with return",line:" lib/addons/p5.dom.js:1668"},{message:"replacing incorrect tag: returns with return",line:" lib/addons/p5.dom.js:1762"},{message:"unknown tag: alt",line:" lib/addons/p5.dom.js:2119"},{message:"replacing incorrect tag: params with param",line:" lib/addons/p5.sound.js:2480"},{message:"replacing incorrect tag: returns with return",line:" lib/addons/p5.sound.js:2480"},{message:"replacing incorrect tag: returns with return",line:" lib/addons/p5.sound.js:3094"},{message:"replacing incorrect tag: returns with return",line:" lib/addons/p5.sound.js:7659"},{message:"replacing incorrect tag: returns with return",line:" lib/addons/p5.sound.js:9626"},{message:"Missing item type\nConversions adapted from <http://www.easyrgb.com/en/math.php>.\n\nIn these functions, hue is always in the range [0, 1], just like all other\ncomponents are in the range [0, 1]. 'Brightness' and 'value' are used\ninterchangeably.",line:" src/color/color_conversion.js:10"},{message:"Missing item type\nConvert an HSBA array to HSLA.",line:" src/color/color_conversion.js:21"},{message:"Missing item type\nConvert an HSBA array to RGBA.",line:" src/color/color_conversion.js:47"},{message:"Missing item type\nConvert an HSLA array to HSBA.",line:" src/color/color_conversion.js:102"},{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:125"},{message:"Missing item type\nConvert an RGBA array to HSBA.",line:" src/color/color_conversion.js:189"},{message:"Missing item type\nConvert an RGBA array to HSLA.",line:" src/color/color_conversion.js:228"},{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:415"},{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:446"},{message:"Missing item type\nCSS named colors.",line:" src/color/p5.Color.js:465"},{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:618"},{message:"Missing item type\nFull color string patterns. The capture groups are necessary.",line:" src/color/p5.Color.js:631"},{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:768"},{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:994"},{message:"Missing item type\nThis function does 3 things:\n\n  1. Bounds the desired start/stop angles for an arc (in radians) so that:\n\n         0 <= start < TWO_PI ;    start <= stop < start + TWO_PI\n\n     This means that the arc rendering functions don't have to be concerned\n     with what happens if stop is smaller than start, or if the arc 'goes\n     round more than once', etc.: they can just start at start and increase\n     until stop and the correct arc will be drawn.\n\n  2. Optionally adjusts the angles within each quadrant to counter the naive\n     scaling of the underlying ellipse up from the unit circle.  Without\n     this, the angles become arbitrary when width != height: 45 degrees\n     might be drawn at 5 degrees on a 'wide' ellipse, or at 85 degrees on\n     a 'tall' ellipse.\n\n  3. Flags up when start and stop correspond to the same place on the\n     underlying ellipse.  This is useful if you want to do something special\n     there (like rendering a whole ellipse instead).",line:" src/core/shape/2d_primitives.js:16"},{message:"Missing item type\nReturns the current framerate.",line:" src/core/environment.js:306"},{message:'Missing item type\nSpecifies the number of frames to be displayed every second. For example,\nthe function call frameRate(30) will attempt to refresh 30 times a second.\nIf the processor is not fast enough to maintain the specified rate, the\nframe rate will not be achieved. Setting the frame rate within <a href="#/p5/setup">setup()</a> is\nrecommended. The default rate is 60 frames per second.\n\nCalling <a href="#/p5/frameRate">frameRate()</a> with no arguments returns the current framerate.',line:" src/core/environment.js:316"},{message:"Missing item type",line:" src/core/error_helpers.js:1"},{message:'Missing item type\nValidates parameters\nparam  {String}               func    the name of the function\nparam  {Array}                args    user input arguments\n\nexample:\n var a;\n ellipse(10,10,a,5);\nconsole ouput:\n "It looks like ellipse received an empty variable in spot #2."\n\nexample:\n ellipse(10,"foo",5,5);\nconsole output:\n "ellipse was expecting a number for parameter #1,\n          received "foo" instead."',line:" src/core/error_helpers.js:584"},{message:"Missing item type\nPrints out all the colors in the color pallete with white text.\nFor color blindness testing.",line:" src/core/error_helpers.js:645"},{message:"Missing item type",line:" src/core/helpers.js:1"},{message:'Missing item type\n_globalInit\n\nTODO: ???\nif sketch is on window\nassume "global" mode\nand instantiate p5 automatically\notherwise do nothing',line:" src/core/init.js:5"},{message:"Missing item type",line:" src/core/legacy.js:1"},{message:"Missing item type\nHelper fxn for sharing pixel methods",line:" src/core/p5.Element.js:865"},{message:"Missing item type\nResize our canvas element.",line:" src/core/p5.Renderer.js:97"},{message:"Missing item type\nHelper fxn to check font type (system or otf)",line:" src/core/p5.Renderer.js:335"},{message:"Missing item type\nHelper fxn to measure ascent and desce
21nt.\nAdapted from http://stackoverflow.com/a/25355178",line:" src/core/p5.Renderer.js:388"},{message:"Missing item type\np5.Renderer2D\nThe 2D graphics canvas renderer class.\nextends p5.Renderer",line:" src/core/p5.Renderer2D.js:9"},{message:"Missing item type\nGenerate a cubic Bezier representing an arc on the unit circle of total\nangle `size` radians, beginning `start` radians above the x-axis. Up to\nfour of these curves are combined to make a full arc.\n\nSee www.joecridge.me/bezier.pdf for an explanation of the method.",line:" src/core/p5.Renderer2D.js:407"},{message:"Missing item type\nshim for Uint8ClampedArray.slice\n(allows arrayCopy to work with pixels[])\nwith thanks to http://halfpapstudios.com/blog/tag/html5-canvas/\nEnumerable set to false to protect for...in from\nUint8ClampedArray.prototype pollution.",line:" src/core/shim.js:23"},{message:"Missing item type\nthis is implementation of Object.assign() which is unavailable in\nIE11 and (non-Chrome) Android browsers.\nThe assign() method is used to copy the values of all enumerable\nown properties from one or more source objects to a target object.\nIt will return the target object.\nModified from https://github.com/ljharb/object.assign",line:" src/core/shim.js:45"},{message:"Missing item type\nprivate helper function to handle the user passing in objects\nduring construction or calls to create()",line:" src/data/p5.TypedDict.js:203"},{message:"Missing item type\nprivate helper function to ensure that the user passed in valid\nvalues for the Dictionary type",line:" src/data/p5.TypedDict.js:394"},{message:"Missing item type\nprivate helper function to ensure that the user passed in valid\nvalues for the Dictionary type",line:" src/data/p5.TypedDict.js:437"},{message:"Missing item type\nprivate helper function for finding lowest or highest value\nthe argument 'flip' is used to flip the comparison arrow\nfrom 'less than' to 'greater than'",line:" src/data/p5.TypedDict.js:554"},{message:"Missing item type\nprivate helper function for finding lowest or highest key\nthe argument 'flip' is used to flip the comparison arrow\nfrom 'less than' to 'greater than'",line:" src/data/p5.TypedDict.js:621"},{message:"Missing item type\n_updatePAccelerations updates the pAcceleration values",line:" src/events/acceleration.js:124"},{message:"Missing item type\nThe onblur function is called when the user is no longer focused\non the p5 element. Because the keyup events will not fire if the user is\nnot focused on the element we must assume all keys currently down have\nbeen released.",line:" src/events/keyboard.js:302"},{message:"Missing item type\nThe _areDownKeys function returns a boolean true if any keys pressed\nand a false if no keys are currently pressed.\n\nHelps avoid instances where multiple keys are pressed simultaneously and\nreleasing a single key will then switch the\nkeyIsPressed property to true.",line:" src/events/keyboard.js:389"},{message:"Missing item type\nThis module defines the filters for use with image buffers.\n\nThis module is basically a collection of functions stored in an object\nas opposed to modules. The functions are destructive, modifying\nthe passed in canvas rather than creating a copy.\n\nGenerally speaking users of this module will use the Filters.apply method\non a canvas to create an effect.\n\nA number of functions are borrowed/adapted from\nhttp://www.html5rocks.com/en/tutorials/canvas/imagefilters/\nor the java processing implementation.",line:" src/image/filters.js:3"},{message:"Missing item type\nReturns the pixel buffer for a canvas",line:" src/image/filters.js:26"},{message:"Missing item type\nReturns a 32 bit number containing ARGB data at ith pixel in the\n1D array containing pixels data.",line:" src/image/filters.js:46"},{message:"Missing item type\nModifies pixels RGBA values to values contained in the data object.",line:" src/image/filters.js:67"},{message:"Missing item type\nReturns the ImageData object for a canvas\nhttps://developer.mozilla.org/en-US/docs/Web/API/ImageData",line:" src/image/filters.js:87"},{message:"Missing item type\nReturns a blank ImageData object.",line:" src/image/filters.js:107"},{message:"Missing item type\nApplys a filter function to a canvas.\n\nThe difference between this and the actual filter functions defined below\nis that the filter functions generally modify the pixel buffer but do\nnot actually put that data back to the canvas (where it would actually\nupdate what is visible). By contrast this method does make the changes\nactually visible in the canvas.\n\nThe apply method is the method that callers of this module would generally\nuse. It has been separated from the actual filters to 
21support an advanced\nuse case of creating a filter chain that executes without actually updating\nthe canvas in between everystep.",line:" src/image/filters.js:122"},{message:"Missing item type\nConverts the image to black and white pixels depending if they are above or\nbelow the threshold defined by the level parameter. The parameter must be\nbetween 0.0 (black) and 1.0 (white). If no level is specified, 0.5 is used.\n\nBorrowed from http://www.html5rocks.com/en/tutorials/canvas/imagefilters/",line:" src/image/filters.js:175"},{message:"Missing item type\nConverts any colors in the image to grayscale equivalents.\nNo parameter is used.\n\nBorrowed from http://www.html5rocks.com/en/tutorials/canvas/imagefilters/",line:" src/image/filters.js:209"},{message:"Missing item type\nSets the alpha channel to entirely opaque. No parameter is used.",line:" src/image/filters.js:232"},{message:"Missing item type\nSets each pixel to its inverse value. No parameter is used.",line:" src/image/filters.js:248"},{message:"Missing item type\nLimits each channel of the image to the number of colors specified as\nthe parameter. The parameter can be set to values between 2 and 255, but\nresults are most noticeable in the lower ranges.\n\nAdapted from java based processing implementation",line:" src/image/filters.js:263"},{message:"Missing item type\nreduces the bright areas in an image",line:" src/image/filters.js:295"},{message:"Missing item type\nincreases the bright areas in an image",line:" src/image/filters.js:383"},{message:'Missing item type\nThis module defines the p5 methods for the <a href="#/p5.Image">p5.Image</a> class\nfor drawing images to the main display canvas.',line:" src/image/image.js:8"},{message:"Missing item type\nValidates clipping params. Per drawImage spec sWidth and sHight cannot be\nnegative or greater than image intrinsic width and height",line:" src/image/loading_displaying.js:110"},{message:"Missing item type\nApply the current tint color to the input image, return the resulting\ncanvas.",line:" src/image/loading_displaying.js:427"},{message:'Missing item type\nThis module defines the <a href="#/p5.Image">p5.Image</a> class and P5 methods for\ndrawing images to the main display canvas.',line:" src/image/p5.Image.js:9"},{message:"Missing item type\nHelper fxn for sharing pixel methods",line:" src/image/p5.Image.js:223"},{message:'Missing item type\nGenerate a blob of file data as a url to prepare for download.\nAccepts an array of data, a filename, and an extension (optional).\nThis is a private function because it does not do any formatting,\nbut it is used by <a href="#/p5/saveStrings">
21saveStrings</a>, <a href="#/p5/saveJSON">saveJSON</a>, <a href="#/p5/saveTable">saveTable</a> etc.',line:" src/io/files.js:1778"},{message:"Missing item type\nReturns a file extension, or another string\nif the provided parameter has no extension.",line:" src/io/files.js:1847"},{message:"Missing item type\nReturns true if the browser is Safari, false if not.\nSafari makes trouble for downloading files.",line:" src/io/files.js:1880"},{message:"Missing item type\nHelper function, a callback for download that deletes\nan invisible anchor element from the DOM once the file\nhas been automatically downloaded.",line:" src/io/files.js:1892"},{message:'Missing item type\nTable Options\n<p>Generic class for handling tabular data, typically from a\nCSV, TSV, or other sort of spreadsheet file.</p>\n<p>CSV files are\n<a href="http://en.wikipedia.org/wiki/Comma-separated_values">\ncomma separated values</a>, often with the data in quotes. TSV\nfiles use tabs as separators, and usually don\'t bother with the\nquotes.</p>\n<p>File names should end with .csv if they\'re comma separated.</p>\n<p>A rough "spec" for CSV can be found\n<a href="http://tools.ietf.org/html/rfc4180">here</a>.</p>\n<p>To load files, use the <a href="#/p5/loadTable">loadTable</a> method.</p>\n<p>To save tables to your computer, use the <a href="#/p5/save">save</a> method\n or the <a href="#/p5/saveTable">saveTable</a> method.</p>\n\nPossible options include:\n<ul>\n<li>csv - parse the table as comma-separated values\n<li>tsv - parse the table as tab-separated values\n<li>header - this table has a header (title) row\n</ul>',line:" src/io/p5.Table.js:11"},{message:"Missing item type\nMultiplies a vector by a scalar and returns a new vector.",line:" src/math/p5.Vector.js:1610"},{message:"Missing item type\nDivides a vector by a scalar and returns a new vector.",line:" src/math/p5.Vector.js:1637"},{message:"Missing item type\nCalculates the dot product of two vectors.",line:" src/math/p5.Vector.js:1664"},{message:"Missing item type\nCalculates the cross product of two vectors.",line:" src/math/p5.Vector.js:1678"},{message:"Missing item type\nCalculates the Euclidean distance between two points (considering a\npoint as a vector object).",line:" src/math/p5.Vector.js:1692"},{message:"Missing item type\nLinear interpolate a vector to another vector and return the result as a\nnew vector.",line:" src/math/p5.Vector.js:1707"},{message:"Missing item type\nHelper function to measure ascent and descent.",line:" src/typography/attributes.js:284"},{message:"Missing item type\nReturns the set of opentype glyphs for the supplied string.\n\nNote that there is not a strict one-to-one mapping between characters\nand glyphs, so the list of returned glyphs can be larger or smaller\n than the length of the given string.",line:" src/typography/p5.Font.js:255"},{message:"Missing item type\nReturns an opentype path for the supplied string and position.",line:" src/typography/p5.Font.js:270"},{message:"Missing item type",line:" src/webgl/3d_primitives.js:260"},{message:"Missing item type\nDraws a point, a coordinate in space at the dimension of one pixel,\ngiven x, y and z coordinates. The color of the point is determined\nby the current stroke, while the point size is determined by current\nstroke weight.",line:" src/webgl/3d_primitives.js:732"},{message:"Missing item type\nDraw a line given two points",line:" src/webgl/3d_primitives.js:1155"},{message:"Missing item type\nParse OBJ lines into model. For reference, this is what a simple model of a\nsquare might look like:\n\nv -0.5 -0.5 0.5\nv -0.5 -0.5 -0.5\nv -0.5 0.5 -0.5\nv -0.5 0.5 0.5\n\nf 4 3 2 1",line:" src/webgl/loading.js:169"},{message:"Missing item type\nSTL files can be of two types, ASCII and Binary,\n\nWe need to convert the arrayBuffer to an array of strings,\nto parse it as an ASCII file.",line:" src/webgl/loading.js:278"},{message:"Missing item type\nThis function checks if the file is in ASCII format or in Binary format\n\nIt is done by searching keyword `solid` at the start of the file.\n\nAn ASCII STL data must begin with `solid` as the first six bytes.\
21nHowever, ASCII STLs lacking the SPACE after the `d` are known to be\nplentiful. So, check the first 5 bytes for `solid`.\n\nSeveral encodings, such as UTF-8, precede the text with up to 5 bytes:\nhttps://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding\nSearch for `solid` to start anywhere after those prefixes.",line:" src/webgl/loading.js:305"},{message:"Missing item type\nThis function matches the `query` at the provided `offset`",line:" src/webgl/loading.js:332"},{message:"Missing item type\nThis function parses the Binary STL files.\nhttps://en.wikipedia.org/wiki/STL_%28file_format%29#Binary_STL\n\nCurrently there is no support for the colors provided in STL files.",line:" src/webgl/loading.js:344"},{message:"Missing item type\nASCII STL file starts with `solid 'nameOfFile'`\nThen contain the normal of the face, starting with `facet normal`\nNext contain a keyword indicating the start of face vertex, `outer loop`\nNext comes the three vertex, starting with `vertex x y z`\nVertices ends with `endloop`\nFace ends with `endfacet`\nNext face starts with `facet normal`\nThe end of the file is indicated by `endsolid`",line:" src/webgl/loading.js:433"},{message:"Missing item type",line:" src/webgl/material.js:719"},{message:"Missing item type",line:" src/webgl/material.js:741"},{message:"Missing item type\nCreate a 2D array for establishing stroke connections",line:" src/webgl/p5.Geometry.js:206"},{message:"Missing item type\nCreate 4 vertices for each stroke line, two at the beginning position\nand two at the end position. These vertices are displaced relative to\nthat line's normal on the GPU",line:" src/webgl/p5.Geometry.js:227"},{message:"Missing item type",line:" src/webgl/p5.Matrix.js:1"},{message:"Missing item type\nPRIVATE",line:" src/webgl/p5.Matrix.js:730"},{message:'Missing item type\nWelcome to RendererGL Immediate Mode.\nImmediate mode is used for drawing custom shapes\nfrom a set of vertices.  Immediate Mode is activated\nwhen you call <a href="#/p5/beginShape">beginShape()</a> & de-activated when you call <a href="#/p5/endShape">endShape()</a>.\nImmediate mode is a style of programming borrowed\nfrom OpenGL\'s (now-deprecated) immediate mode.\nIt differs from p5.js\' default, Retained Mode, which caches\ngeometries and buffers on the CPU to reduce the number of webgl\ndraw calls. Retained mode is more efficient & performative,\nhowever, Immediate Mode is useful for sketching quick\ngeometric ideas.',line:" src/webgl/p5.RendererGL.Immediate.js:1"},{message:"Missing item type\nEnd shape drawing and render vertices to screen.",line:" src/webgl/p5.RendererGL.Immediate.js:140"},{message:"Missing item type\ninitializes buffer defaults. runs each time a new geometry is\nregistered",line:" src/webgl/p5.RendererGL.Retained.js:40"},{message:"Missing item type\ncreates a buffers object that holds the WebGL render buffers\nfor a geometry.",line:" src/webgl/p5.RendererGL.Retained.js:144"},{message:"Missing item type\nDraws buffers given a geometry key ID",line:" src/webgl/p5.RendererGL.Retained.js:182"},{message:"Missing item type\nmodel view, projection, & normal\nmatrices",line:" src/webgl/p5.RendererGL.js:96"},{message:"Missing item type\n[background description]",line:" src/webgl/p5.RendererGL.js:501"},{message:"Missing item type\n[resize description]",line:" src/webgl/p5.RendererGL.js:752"},{message:"Missing item type\nclears color and depth buffers\nwith r,g,b,a",line:" src/webgl/p5.RendererGL.js:783"},{message:"Missing item type\n[translate description]",line:" src/webgl/p5.RendererGL.js:816"},{message:"Missing item type\nScales the Model View Matrix by a vector",line:" src/webgl/p5.RendererGL.js:835"},{message:"Missing item type\nturn a two dimensional array into one dimensional array",line:" src/webgl/p5.RendererGL.js:1200"},{message:"Missing item type\nturn a p5.Vector Array into a one dimensional number array",line:" src/webgl/p5.RendererGL.js:1237"},{message:"Missing item type\nensures that p5 is using a 3d renderer. throws an error if not.",line:" src/webgl/p5.RendererGL.js:1254"},{message:"Missing item type\nHelper function for select and selectAll",line:" lib/addons/p5.dom.js:168"},{message:"Missing item type\nHelper function for getElement and getElements.",line:" lib/addons/p5.dom.js:184"},{message:"Missing item type\nHelpers for create methods.",line:" lib/addons/p5.dom.js:348"},{message:"Missing item type",line:" lib/addons/p5.dom.js:488"},{message:"Missing item type",line:" lib/addons/p5.dom.js:1070"},{message:"Missing item type",line:" lib/addons/p5.dom.js:1159"},{message:"Missing item type",line:" lib/addons/p5.dom.js:1199"},{message:"Missing item type",line:" lib/addons/p5.dom.js:3021"},{message:"Missing item type",line:" lib/addons/p5.dom.js:3087"},{message:"Missing item type",line:" lib/addons/p5.dom.js:3149"},{message:"Missing item type\np5.sound \nhttps://p5js.org/reference/#/libraries/p5.sound\n\nFrom the Processing Foundation and contributors\nhttps://github.com/processing/p5.js-sound/graphs/contributors\n\nMIT License (MIT)\nhttps://github.com/processing/p5.js-sound/blob/master/LICENSE\n\nSome of the many audio libraries & resources that inspire p5.sound:\n - TONE.js (c) Yotam Mann. Licensed under The MIT License (MIT). https://github.com/TONEnoTONE/Tone.js\n - buzz.js (c) Jay Salvat. Licensed under The MIT License (MIT). http://buzz.jaysalvat.com/\n - Boris Smus Web Audio API book, 2013. Licensed under the Apache License http://www.apache.org/licenses/LICENSE-2.0\n - wavesurfer.js https://github.com/katspaugh/wavesurfer.js\n - Web Audio Components by Jordan Santell https://github.com/web-audio-components\n - Wilm Thoben's Sound library for Processing https://github.com/processing/processing/tree/master/java/libraries/sound\n\n Web Audio API: http://w3.org/TR/webaudio/",line:" lib/addons/p5.sound.js:46"},{message:"Missing item type\nDetermine which filetypes are supported (inspired by buzz.js)\nThe audio element (el) will only be used to test browser support for various audio formats",line:" lib/addons/p5.sound.js:214"},{message:"Missing item type",line:" lib/addons/p5.sound.js:363"},{message:"Missing item type",line:" lib/addons/p5.sound.js:740"},{message:"Missing item type",line:" lib/addons/p5.sound.js:810"},{message:"Missing item type\nMaster contains AudioContext and the master sound output.",line:" lib/addons/p5.sound.js:1099"}
21,{message:"Missing item type\na silent connection to the DesinationNode\nwhich will ensure that anything connected to it\nwill not be garbage collected",line:" lib/addons/p5.sound.js:1194"},{message:"Missing item type",line:" lib/addons/p5.sound.js:1210"},{message:"Missing item type\nUsed by Osc and Envelope to chain signal math",line:" lib/addons/p5.sound.js:1415"},{message:"Missing item type\nThis is a helper function that the p5.SoundFile calls to load\nitself. Accepts a callback (the name of another function)\nas an optional parameter.",line:" lib/addons/p5.sound.js:1813"},{message:"Missing item type\nStop playback on all of this soundfile's sources.",line:" lib/addons/p5.sound.js:2218"},{message:"Missing item type",line:" lib/addons/p5.sound.js:2656"},{message:"Missing item type",line:" lib/addons/p5.sound.js:2934"},{message:"Missing item type",line:" lib/addons/p5.sound.js:4055"},{message:"Missing item type",line:" lib/addons/p5.sound.js:4076"},{message:"Missing item type",line:" lib/addons/p5.sound.js:4135"},{message:"Missing item type",line:" lib/addons/p5.sound.js:4453"},{message:"Missing item type",line:" lib/addons/p5.sound.js:4625"},{message:"Missing item type",line:" lib/addons/p5.sound.js:4783"},{message:"Missing item type",line:" lib/addons/p5.sound.js:4824"},{message:"Missing item type",line:" lib/addons/p5.sound.js:4881"},{message:"Missing item type",line:" lib/addons/p5.sound.js:5049"},{message:"Missing item type",line:" lib/addons/p5.sound.js:5097"},{message:"Missing item type",line:" lib/addons/p5.sound.js:5128"},{message:"Missing item type",line:" lib/addons/p5.sound.js:5149"},{message:"Missing item type",line:" lib/addons/p5.sound.js:5169"},{message:"Missing item type",line:" lib/addons/p5.sound.js:5879"},{message:"Missing item type",line:" lib/addons/p5.sound.js:6082"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7750"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7766"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7790"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7816"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7838"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7860"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7906"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7937"},{message:"Missing item type",line:" lib/addons/p5.sound.js:7955"},{message:"Missing item type",line:" lib/addons/p5.sound.js:8292"},{message:"Missing item type",line:" lib/addons/p5.sound.js:8314"},{message:"Missing item type\nThe p5.Effect class is built\n \tusing Tone.js CrossFade",line:" lib/addons/p5.sound.js:8384"},{message:"Missing item type\nIn classes that extend\np5.Effect, connect effect nodes\nto the wet parameter",line:" lib/addons/p5.sound.js:8390"},{message:"Missing item type\nEQFilter extends p5.Filter with constraints\nnecessary for the p5.EQ",line:" lib/addons/p5.sound.js:8779"},{message:"Missing item type\nInspired by Simple Reverb by Jordan Santell\nhttps://github.com/web-audio-components/simple-reverb/blob/master/index.js\n\nUtility function for building an impulse response\nbased on the module parameters.",line:" lib/addons/p5.sound.js:9889"},{message:"Missing item type\nPrivate method to load a buffer as an Impulse Response,\nassign it to the convolverNode, and add to the Array of .impulses.",line:" lib/addons/p5.sound.js:10056"},{message:"Missing item type",line:" lib/addons/p5.sound.js:10240"},{message:"Missing item type",line:" lib/addons/p5.sound.js:10265"},{message:"Missing item type\nmusicalTimeMode variables\nmodify these only when the interval is specified in musicalTime format as a string",line:" lib/addons/p5.sound.js:10989"},{message:"Missing item type\nDo not initiate the callback if timeFromNow is < 0\nThis ususually occurs for a few milliseconds when the page\nis not fully loaded\n\nThe callback should only be called until maxIterations is reached",line:" lib/addons/p5.sound.js:11005"},{message:"Missing item type\ncallback invoked when the recording is over",line:" lib/addons/p5.sound.js:11495"},{message:"Missing item type\ninternal method called on audio process",line:" lib/addons/p5.sound.js:11581"},{message:"Missing item type\nPrivate method to ensure accurate values of this._voicesInUse\nAny time a new value is scheduled, it is necessary to increment all subsequent\nscheduledValues after attack, and decrement all subsequent\nscheduledValues after release",line:" lib/addons/p5.sound.js:12627"},{message:"Missing item type\np5.sound \nhttps://p5js.org/reference/#/libraries/p5.sound\n\nFrom the Processing Foundation and contributors\nhttps://github.com/processing/p5.js-sound/graphs/contributors\n\nMIT License (MIT)\nhttps://github.com/processing/p5.js-sound/blob/master/LICENSE\n\nSome of the many audio libraries & resources that inspire p5.sound:\n - TONE.js (c) Yotam Mann. Licensed under The MIT License (MIT). https://github.com/TONEnoTONE/Tone.js\n - buzz.js (c) Jay Salvat. Licensed under The MIT License (MIT). http://buzz.jaysalvat.com/\n - Boris Smus Web Audio API book, 2013. Licensed under the Apache License http://www.apache.org/licenses/LICENSE-2.0\n - wavesurfer.js https://github.com/katspaugh/wavesurfer.js\n - Web Audio Components by Jordan Santell https://github.com/web-audio-components\n - Wilm Thoben's Sound library for Processing https://github.com/processing/processing/tree/master/java/libraries/sound\n\n Web Audio API: http://w3.org/TR/webaudio/",line:" lib/addons/p5.sound.min.js:3"}],consts:{RGB:["p5.colorMode"],HSB:["p5.colorMode"],HSL:["p5.colorMode"],CHORD:["p5.arc"],PIE:["p5.arc"],OPEN:["p5.arc"],CENTER:["p5.ellipseMode","p5.rectMode","p5.imageMode","p5.textAlign"],RADIUS:["p5.ellipseMode","p5.rectMode"],CORNER:["p5.ellipseMode","p5.rectMode","p5.imageMode"],CORNERS:["p5.ellipseMode","p5.rectMode","p5.imageMode"],SQUARE:["p5.strokeCap"],PROJECT:["p5.strokeCap"],ROUND:["p5.strokeCap","p5.strokeJoin"],MITER:["p5.strokeJoin"],BEVEL:["p5.strokeJoin"],POINTS:["p5.beginShape"],LINES:["p5.beginShape"],TRIANGLES:["p5.beginShape"],TRIANGLE_FAN:["p5.beginShape"],TRIANGLE_STRIP:["p5.beginShape"],QUADS:["p5.beginShape"],QUAD_STRIP:["p5.beginShape"],CLOSE:["p5.endShape"],ARROW:["p5.cursor"],CROSS:["p5.cursor"],HAND:["p
215.cursor"],MOVE:["p5.cursor"],TEXT:["p5.cursor"],P2D:["p5.createCanvas","p5.createGraphics"],WEBGL:["p5.createCanvas","p5.createGraphics"],BLEND:["p5.blendMode","p5.Image.blend","p5.blend"],DARKEST:["p5.blendMode","p5.Image.blend","p5.blend"],LIGHTEST:["p5.blendMode","p5.Image.blend","p5.blend"],DIFFERENCE:["p5.blendMode","p5.Image.blend","p5.blend"],MULTIPLY:["p5.blendMode","p5.Image.blend","p5.blend"],EXCLUSION:["p5.blendMode","p5.Image.blend","p5.blend"],SCREEN:["p5.blendMode","p5.Image.blend","p5.blend"],REPLACE:["p5.blendMode","p5.Image.blend","p5.blend"],OVERLAY:["p5.blendMode","p5.Image.blend","p5.blend"],HARD_LIGHT:["p5.blendMode","p5.Image.blend","p5.blend"],SOFT_LIGHT:["p5.blendMode","p5.Image.blend","p5.blend"],DODGE:["p5.blendMode","p5.Image.blend","p5.blend"],BURN:["p5.blendMode","p5.Image.blend","p5.blend"],ADD:["p5.blendMode","p5.Image.blend","p5.blend"],SUBTRACT:["p5.blendMode"],THRESHOLD:["p5.Image.filter","p5.filter"],GRAY:["p5.Image.filter","p5.filter"],OPAQUE:["p5.Image.filter","p5.filter"],INVERT:["p5.Image.filter","p5.filter"],POSTERIZE:["p5.Image.filter","p5.filter"],BLUR:["p5.Image.filter","p5.filter"],ERODE:["p5.Image.filter","p5.filter"],DILATE:["p5.Image.filter","p5.filter"],NORMAL:["p5.Image.blend","p5.blend","p5.textStyle","p5.textureMode"],RADIANS:["p5.angleMode"],DEGREES:["p5.angleMode"],LEFT:["p5.textAlign"],RIGHT:["p5.textAlign"],TOP:["p5.textAlign"],BOTTOM:["p5.textAlign"],BASELINE:["p5.textAlign"],ITALIC:["p5.textStyle"],BOLD:["p5.textStyle"],BOLDITALIC:["p5.textStyle"],IMAGE:["p5.textureMode"],CLAMP:["p5.textureWrap"],REPEAT:["p5.textureWrap"],MIRROR:["p5.textureWrap"],VIDEO:["p5.createCapture"],AUDIO:["p5.createCapture"]}}},{}],2:[function(e,t,n){"use strict";n.byteLength=function(e){var t=p(e),n=t[0],a=t[1];return 3*(n+a)/4-a},n.toByteArray=function(e){for(var t,n=p(e),a=n[0],r=n[1],s=new i(function(e,t,n){return 3*(t+n)/4-n}(0,a,r)),l=0,d=r>0?a-4:a,c=0;c<d;c+=4)t=o[e.charCodeAt(c)]<<18|o[e.charCodeAt(c+1)]<<12|o[e.charCodeAt(c+2)]<<6|o[e.charCodeAt(c+3)],s[l++]=t>>16&255,s[l++]=t>>8&255,s[l++]=255&t;2===r&&(t=o[e.charCodeAt(c)]<<2|o[e.charCodeAt(c+1)]>>4,s[l++]=255&t);1===r&&(t=o[e.charCodeAt(c)]<<10|o[e.charCodeAt(c+1)]<<4|o[e.charCodeAt(c+2)]>>2,s[l++]=t>>8&255,s[l++]=255&t);return s},n.fromByteArray=function(e){for(var t,n=e.length,o=n%3,i=[],r=0,s=n-o;r<s;r+=16383)i.push(d(e,r,r+16383>s?s:r+16383));1===o?(t=e[n-1],i.push(a[t>>2]+a[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],i.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return i.join("")};for(var a=[],o=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,l=r.length;s<l;++s)a[s]=r[s],o[r.charCodeAt(s)]=s;function p(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function d(e,t,n){for(var o,i,r=[],s=t;s<n;s+=3)o=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),r.push(a[(i=o)>>18&63]+a[i>>12&63]+a[i>>6&63]+a[63&i]);return r.join("")}o["-".charCodeAt(0)]=62,o["_".charCodeAt(0)]=63},{}],3:[function(e,t,n){},{}],4:[function(e,t,n){"use strict";var a=e("base64-js"),o=e("ieee754");n.Buffer=s,n.SlowBuffer=function(e){+e!=e&&(e=0);return s.alloc(+e)},n.INSPECT_MAX_BYTES=50;var i=2147483647;function r(e){if(e>i)throw new RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return t.__proto__=s.prototype,t}function s(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return d(e)}return l(e,t,n)}function l(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!s.isEncoding(t))throw new TypeError("Unknown encoding: "+t);var n=0|m(e,t),a=r(n),o=a.write(e,t);o!==n&&(a=a.slice(0,o));return a}(e,t);if(ArrayBuffer.isView(e))return c(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(G(e,ArrayBuffer)||e&&G(e.buffer,ArrayBuffer))return function(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');var a;a=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n);return a.__proto__=s.prototype,a}(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');var a=e.valueOf&&e.valueOf();if(null!=a&&a!==e)return s.from(a,t,n);var o=function(e){if(s.isBuffer(e)){var t=0|u(e.length),n=r(t);return 0===n.length?n:(e.copy(n,0,0,t),n)}if(void 0!==e.length)return"number"!=typeof e.length||U(e.length)?r(0):c(e);if("Buffer"===e.type&&Array.isArray(e.data))return c(e.data)}(e);if(o)return o;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return s.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function p(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');
vendor: 7,180 bytes, line 21
21if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function d(e){return p(e),r(e<0?0:0|u(e))}function c(e){for(var t=e.length<0?0:0|u(e.length),n=r(t),a=0;a<t;a+=1)n[a]=255&e[a];return n}function u(e){if(e>=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return 0|e}function m(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||G(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var n=e.length,a=arguments.length>2&&!0===arguments[2];if(!a&&0===n)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return O(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(o)return a?-1:O(e).length;t=(""+t).toLowerCase(),o=!0}}function h(e,t,n){var a=e[t];e[t]=e[n],e[n]=a}function f(e,t,n,a,o){if(0===e.length)return-1;if("string"==typeof n?(a=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),U(n=+n)&&(n=o?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(o)return-1;n=e.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof t&&(t=s.from(t,a)),s.isBuffer(t))return 0===t.length?-1:g(e,t,n,a,o);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):g(e,[t],n,a,o);throw new TypeError("val must be string, number or Buffer")}function g(e,t,n,a,o){var i,r=1,s=e.length,l=t.length;if(void 0!==a&&("ucs2"===(a=String(a).toLowerCase())||"ucs-2"===a||"utf16le"===a||"utf-16le"===a)){if(e.length<2||t.length<2)return-1;r=2,s/=2,l/=2,n/=2}function p(e,t){return 1===r?e[t]:e.readUInt16BE(t*r)}if(o){var d=-1;for(i=n;i<s;i++)if(p(e,i)===p(t,-1===d?0:i-d)){if(-1===d&&(d=i),i-d+1===l)return d*r}else-1!==d&&(i-=i-d),d=-1}else for(n+l>s&&(n=s-l),i=n;i>=0;i--){for(var c=!0,u=0;u<l;u++)if(p(e,i+u)!==p(t,u)){c=!1;break}if(c)return i}return-1}function y(e,t,n,a){n=Number(n)||0;var o=e.length-n;a?(a=Number(a))>o&&(a=o):a=o;var i=t.length;a>i/2&&(a=i/2);for(var r=0;r<a;++r){var s=parseInt(t.substr(2*r,2),16);if(U(s))return r;e[n+r]=s}return r}function v(e,t,n,a){return B(O(t,e.length-n),e,n,a)}function b(e,t,n,a){return B(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,a)}function w(e,t,n,a){return b(e,t,n,a)}function x(e,t,n,a){return B(F(t),e,n,a)}function S(e,t,n,a){return B(function(e,t){for(var n,a,o,i=[],r=0;r<e.length&&!((t-=2)<0);++r)n=e.charCodeAt(r),a=n>>8,o=n%256,i.push(o),i.push(a);return i}(t,e.length-n),e,n,a)}function k(e,t,n){return 0===t&&n===e.length?a.fromByteArray(e):a.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);for(var a=[],o=t;o<n;){var i,r,s,l,p=e[o],d=null,c=p>239?4:p>223?3:p>191?2:1;if(o+c<=n)switch(c){case 1:p<128&&(d=p);break;case 2:128==(192&(i=e[o+1]))&&(l=(31&p)<<6|63&i)>127&&(d=l);break;case 3:i=e[o+1],r=e[o+2],128==(192&i)&&128==(192&r)&&(l=(15&p)<<12|(63&i)<<6|63&r)>2047&&(l<55296||l>57343)&&(d=l);break;case 4:i=e[o+1],r=e[o+2],s=e[o+3],128==(192&i)&&128==(192&r)&&128==(192&s)&&(l=(15&p)<<18|(63&i)<<12|(63&r)<<6|63&s)>65535&&l<1114112&&(d=l)}null===d?(d=65533,c=1):d>65535&&(d-=65536,a.push(d>>>10&1023|55296),d=56320|1023&d),a.push(d),o+=c}return function(e){var t=e.length;if(t<=C)return String.fromCharCode.apply(String,e);var n="",a=0;for(;a<t;)n+=String.fromCharCode.apply(String,e.slice(a,a+=C));return n}(a)}n.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()}catch(t){return!1}}(),s.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(s.prototype,"parent",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,"offset",{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}}),"undefined"!=typeof Symbol&&null!=Symbol.species&&s[Symbol.species]===s&&Object.defineProperty(s,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}),s.poolSize=8192,s.from=function(e,t,n){return l(e,t,n)},s.prototype.__proto__=Uint8Array.prototype,s.__proto__=Uint8Array,s.alloc=function(e,t,n){return function(e,t,n){return p(e),e<=0?r(e):void 0!==t?"string"==typeof n?r(e).fill(t,n):r(e).fill(t):r(e)}(e,t,n)},s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)},s.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==s.prototype},s.compare=function(e,t){if(G(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),G(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var n=e.length,a=t.length,o=0,i=Math.min(n,a);o<i;++o)if(e[o]!==t[o]){n=e[o],a=t[o];break}return n<a?-1:a<n?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return s.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var a=s.allocUnsafe(t),o=0;for(n=0;n<e.length;++n){var i=e[n];if(G(i,Uint8Array)&&(i=s.from(i)),!s.isBuffer(i))throw new TypeError('"list" argument must be an Array of Buffers');i.copy(a,o),o+=i.length}return a},s.byteLength=m,s.prototype._isBuffer=!0,s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)h(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return 0===e?"":0===arguments.length?T(this,0,e):function(e,t,n){var a=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return _(this,t,n);case"latin1":case"binary":return E(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return j(this,t,n);default:if(a)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}.apply(this,arguments)}
vendor: 9,567 bytes, line 21
21,s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===s.compare(this,e)},s.prototype.inspect=function(){var e="",t=n.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},s.prototype.compare=function(e,t,n,a,o){if(G(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===a&&(a=0),void 0===o&&(o=this.length),t<0||n>e.length||a<0||o>this.length)throw new RangeError("out of range index");if(a>=o&&t>=n)return 0;if(a>=o)return-1;if(t>=n)return 1;if(this===e)return 0;for(var i=(o>>>=0)-(a>>>=0),r=(n>>>=0)-(t>>>=0),l=Math.min(i,r),p=this.slice(a,o),d=e.slice(t,n),c=0;c<l;++c)if(p[c]!==d[c]){i=p[c],r=d[c];break}return i<r?-1:r<i?1:0},s.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},s.prototype.indexOf=function(e,t,n){return f(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return f(this,e,t,n,!1)},s.prototype.write=function(e,t,n,a){if(void 0===t)a="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)a=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===a&&(a="utf8")):(a=n,n=void 0)}var o=this.length-t;if((void 0===n||n>o)&&(n=o),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");a||(a="utf8");for(var i=!1;;)switch(a){case"hex":return y(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":return b(this,e,t,n);case"latin1":case"binary":return w(this,e,t,n);case"base64":return x(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return S(this,e,t,n);default:if(i)throw new TypeError("Unknown encoding: "+a);a=(""+a).toLowerCase(),i=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function _(e,t,n){var a="";n=Math.min(e.length,n);for(var o=t;o<n;++o)a+=String.fromCharCode(127&e[o]);return a}function E(e,t,n){var a="";n=Math.min(e.length,n);for(var o=t;o<n;++o)a+=String.fromCharCode(e[o]);return a}function M(e,t,n){var a=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>a)&&(n=a);for(var o="",i=t;i<n;++i)o+=P(e[i]);return o}function j(e,t,n){for(var a=e.slice(t,n),o="",i=0;i<a.length;i+=2)o+=String.fromCharCode(a[i]+256*a[i+1]);return o}function I(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,a,o,i){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<i)throw new RangeError('"value" argument is out of bounds');if(n+a>e.length)throw new RangeError("Index out of range")}function N(e,t,n,a,o,i){if(n+a>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function A(e,t,n,a,i){return t=+t,n>>>=0,i||N(e,0,n,4),o.write(e,t,n,a,23,4),n+4}function D(e,t,n,a,i){return t=+t,n>>>=0,i||N(e,0,n,8),o.write(e,t,n,a,52,8),n+8}s.prototype.slice=function(e,t){var n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);var a=this.subarray(e,t);return a.__proto__=s.prototype,a},s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);for(var a=this[e],o=1,i=0;++i<t&&(o*=256);)a+=this[e+i]*o;return a},s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);for(var a=this[e+--t],o=1;t>0&&(o*=256);)a+=this[e+--t]*o;return a},s.prototype.readUInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||I(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);for(var a=this[e],o=1,i=0;++i<t&&(o*=256);)a+=this[e+i]*o;return a>=(o*=128)&&(a-=Math.pow(2,8*t)),a},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||I(e,t,this.length);for(var a=t,o=1,i=this[e+--a];a>0&&(o*=256);)i+=this[e+--a]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},s.prototype.readInt8=function(e,t){return e>>>=0,t||I(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||I(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||I(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||I(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||I(e,4,this.length),o.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||I(e,4,this.length),o.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||I(e,8,this.length),o.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||I(e,8,this.length),o.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,n,a){(e=+e,t>>>=0,n>>>=0,a)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var o=1,i=0;for(this[t]=255&e;++i<n&&(o*=256);)this[t+i]=e/o&255;return t+n},s.prototype.writeUIntBE=function(e,t,n,a){(e=+e,t>>>=0,n>>>=0,a)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var o=n-1,i=1;for(this[t+o]=255&e;--o>=0&&(i*=256);)this[t+o]=e/i&255;return t+n},s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,255,0),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeIntLE=function(e,t,n,a){if(e=+e,t>>>=0,!a){var o=Math.pow(2,8*n-1);R(this,e,t,n,o-1,-o)}var i=0,r=1,s=0;for(this[t]=255&e;++i<n&&(r*=256);)e<0&&0===s&&0!==this[t+i-1]&&(s=1),this[t+i]=(e/r>>0)-s&255;return t+n},s.prototype.writeIntBE=function(e,t,n,a){if(e=+e,t>>>=0,!a){var o=Math.pow(2,8*n-1);R(this,e,t,n,o-1,-o)}var i=n-1,r=1,s=0;for(this[t+i]=255&e;--i>=0&&(r*=256);)e<0&&0===s&&0!==this[t+i+1]&&(s=1),this[t+i]=(e/r>>0)-s&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},s.prototype.writeFloatLE=function(e,t,n){return A(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return A(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return D(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return D(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,a){if(!s.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),a||0===a||(a=this.length),t>=e.length&&(t=e.length),t||(t=0),a>0&&a<n&&(a=n),a===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(a<0)throw new RangeError("sourceEnd out of bounds");a>this.length&&(a=this.length),e.length-t<a-n&&(a=e.length-t+n);var o=a-n;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,n,a);else if(this===e&&n<t&&t<a)for(var i=o-1;i>=0;--i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,a),t);return o},s.prototype.fill=function(e,t,n,a){if("string"==typeof e){if("string"==typeof t?(a=t,t=0,n=this.length):"string"==typeof n&&(a=n,n=this.length),void 0!==a&&"string"!=typeof a)throw new TypeError("encoding must be a string");if("string"==typeof a&&!s.isEncoding(a))throw new TypeError("Unknown encoding: "+a);if(1===e.length){var o=e.charCodeAt(0);("utf8"===a&&o<128||"latin1"===a)&&(e=o)}}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{var r=s.isBuffer(e)?e:s.from(e,a),l=r.length;
21if(0===l)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=r[i%l]}return this};var L=/[^+\/0-9A-Za-z-_]/g;function P(e){return e<16?"0"+e.toString(16):e.toString(16)}function O(e,t){var n;t=t||1/0;for(var a=e.length,o=null,i=[],r=0;r<a;++r){if((n=e.charCodeAt(r))>55295&&n<57344){if(!o){if(n>56319){(t-=3)>-1&&i.push(239,191,189);continue}if(r+1===a){(t-=3)>-1&&i.push(239,191,189);continue}o=n;continue}if(n<56320){(t-=3)>-1&&i.push(239,191,189),o=n;continue}n=65536+(o-55296<<10|n-56320)}else o&&(t-=3)>-1&&i.push(239,191,189);if(o=null,n<128){if((t-=1)<0)break;i.push(n)}else if(n<2048){if((t-=2)<0)break;i.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;i.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;i.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return i}function F(e){return a.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(L,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function B(e,t,n,a){for(var o=0;o<a&&!(o+n>=t.length||o>=e.length);++o)t[o+n]=e[o];return o}function G(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function U(e){return e!=e}},{"base64-js":2,ieee754:8}],5:[function(e,n,a){(function(t,o){!function(e,t){"object"==typeof a&&void 0!==n?n.exports=t():e.ES6Promise=t()}(this,function(){"use strict";function n(e){return"function"==typeof e}var a=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=0,r=void 0,s=void 0,l=function(e,t){f[i]=e,f[i+1]=t,2===(i+=2)&&(s?s(g):x())};var p="undefined"!=typeof window?window:void 0,d=p||{},c=d.MutationObserver||d.WebKitMutationObserver,u="undefined"==typeof self&&void 0!==t&&"[object process]"==={}.toString.call(t),m="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;function h(){var e=setTimeout;return function(){return e(g,1)}}var f=new Array(1e3);function g(){for(var e=0;e<i;e+=2){(0,f[e])(f[e+1]),f[e]=void 0,f[e+1]=void 0}i=0}var y,v,b,w,x=void 0;function S(e,t){var n=this,a=new this.constructor(C);void 0===a[T]&&G(a);var o=n._state;if(o){var i=arguments[o-1];l(function(){return F(o,a,i,n._result)})}else P(n,a,e,t);return a}function k(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(C);return N(t,e),t}u?x=function(){return t.nextTick(g)}:c?(v=0,b=new c(g),w=document.createTextNode(""),b.observe(w,{characterData:!0}),x=function(){w.data=v=++v%2}):m?((y=new MessageChannel).port1.onmessage=g,x=function(){return y.port2.postMessage(0)}):x=void 0===p&&"function"==typeof e?function(){try{var e=Function("return this")().require("vertx");return void 0!==(r=e.runOnLoop||e.runOnContext)?function(){r(g)}:h()}catch(t){return h()}}():h();var T=Math.random().toString(36).substring(2);function C(){}var _=void 0,E=1,M=2,j={error:null};function I(e){try{return e.then}catch(t){return j.error=t,j}}function R(e,t,a){t.constructor===e.constructor&&a===S&&t.constructor.resolve===k?function(e,t){t._state===E?D(e,t._result):t._state===M?L(e,t._result):P(t,void 0,function(t){return N(e,t)},function(t){return L(e,t)})}(e,t):a===j?(L(e,j.error),j.error=null):void 0===a?D(e,t):n(a)?function(e,t,n){l(function(e){var a=!1,o=function(e,t,n,a){try{e.call(t,n,a)}catch(o){return o}}(n,t,function(n){a||(a=!0,t!==n?N(e,n):D(e,n))},function(t){a||(a=!0,L(e,t))},e._label);!a&&o&&(a=!0,L(e,o))},e)}(e,t,a):D(e,t)}function N(e,t){var n,a;e===t?L(e,new TypeError("You cannot resolve a promise with itself")):(a=typeof(n=t),null===n||"object"!==a&&"function"!==a?D(e,t):R(e,t,I(t)))}function A(e){e._onerror&&e._onerror(e._result),O(e)}function D(e,t){e._state===_&&(e._result=t,e._state=E,0!==e._subscribers.length&&l(O,e))}function L(e,t){e._state===_&&(e._state=M,e._result=t,l(A,e))}function P(e,t,n,a){var o=e._subscribers,i=o.length;e._onerror=null,o[i]=t,o[i+E]=n,o[i+M]=a,0===i&&e._state&&l(O,e)}function O(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var a=void 0,o=void 0,i=e._result,r=0;r<t.length;r+=3)a=t[r],o=t[r+n],a?F(n,a,o,i):o(i);e._subscribers.length=0}}function F(e,t,a,o){var i=n(a),r=void 0,s=void 0,l=void 0,p=void 0;if(i){if((r=function(e,t){try{return e(t)}catch(n){return j.error=n,j}}(a,o))===j?(p=!0,s=r.error,r.error=null):l=!0,t===r)return void L(t,new TypeError("A promises callback cannot return that same promise."))}else r=o,l=!0;t._state!==_||(i&&l?N(t,r):p?L(t,s):e===E?D(t,r):e===M&&L(t,r))}var B=0;function G(e){e[T]=B++,e._state=void 0,e._result=void 0,e._subscribers=[]}var U=function(){function e(e,t){this._instanceConstructor=e,this.promise=new e(C),this.promise[T]||G(this.promise),a(t)?(this.length=t.length,this._remaining=t.length,this._result=new Array(this.length),0===this.length?D(this.promise,this._result):(this.length=this.length||0,this._enumerate(t),0===this._remaining&&D(this.promise,this._result))):L(this.promise,new Error("Array Methods must be provided an Array"))}return e.prototype._enumerate=function(e){for(var t=0;this._state===_&&t<e.length;t++)this._eachEntry(e[t],t)},e.prototype._eachEntry=function(e,t){var n=this._instanceConstructor,a=n.resolve;if(a===k){var o=I(e);if(o===S&&e._state!==_)this._settledAt(e._state,t,e._result);else if("function"!=typeof o)this._remaining--,this._result[t]=e;else if(n===z){var i=new n(C);R(i,e,o),this._willSettleAt(i,t)}
21else this._willSettleAt(new n(function(t){return t(e)}),t)}else this._willSettleAt(a(e),t)},e.prototype._settledAt=function(e,t,n){var a=this.promise;a._state===_&&(this._remaining--,e===M?L(a,n):this._result[t]=n),0===this._remaining&&D(a,this._result)},e.prototype._willSettleAt=function(e,t){var n=this;P(e,void 0,function(e){return n._settledAt(E,t,e)},function(e){return n._settledAt(M,t,e)})},e}();var z=function(){function e(t){this[T]=B++,this._result=this._state=void 0,this._subscribers=[],C!==t&&("function"!=typeof t&&function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof e?function(e,t){try{t(function(t){N(e,t)},function(t){L(e,t)})}catch(n){L(e,n)}}(this,t):function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}())}return e.prototype.catch=function(e){return this.then(null,e)},e.prototype.finally=function(e){var t=this.constructor;return n(e)?this.then(function(n){return t.resolve(e()).then(function(){return n})},function(n){return t.resolve(e()).then(function(){throw n})}):this.then(e,e)},e}();return z.prototype.then=S,z.all=function(e){return new U(this,e).promise},z.race=function(e){var t=this;return a(e)?new t(function(n,a){for(var o=e.length,i=0;i<o;i++)t.resolve(e[i]).then(n,a)}):new t(function(e,t){return t(new TypeError("You must pass an array to race."))})},z.resolve=k,z.reject=function(e){var t=new this(C);return L(t,e),t},z._setScheduler=function(e){s=e},z._setAsap=function(e){l=e},z._asap=l,z.polyfill=function(){var e=void 0;if(void 0!==o)e=o;else if("undefined"!=typeof self)e=self;else try{e=Function("return this")()}catch(a){throw new Error("polyfill failed because global object is unavailable in this environment")}var t=e.Promise;if(t){var n=null;try{n=Object.prototype.toString.call(t.resolve())}catch(a){}if("[object Promise]"===n&&!t.cast)return}e.Promise=z},z.Promise=z,z})}).call(this,e("_process"),void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{_process:11}],6:[function(e,t,n){!function(e,a){if(void 0!==n&&void 0!==t)a(n,t);else{var o={exports:{}};a(o.exports,o),e.fetchJsonp=o.exports}}(this,function(e,t){"use strict";var n={timeout:5e3,jsonpCallback:"callback",jsonpCallbackFunction:null};function a(e){try{delete window[e]}catch(t){window[e]=void 0}}function o(e){var t=document.getElementById(e);t&&document.getElementsByTagName("head")[0].removeChild(t)}t.exports=function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=e,r=t.timeout||n.timeout,s=t.jsonpCallback||n.jsonpCallback,l=void 0;return new Promise(function(n,p){var d=t.jsonpCallbackFunction||"jsonp_"+Date.now()+"_"+Math.ceil(1e5*Math.random()),c=s+"_"+d;window[d]=function(e){n({ok:!0,json:function(){return Promise.resolve(e)}}),l&&clearTimeout(l),o(c),a(d)},i+=-1===i.indexOf("?")?"?":"&";var u=document.createElement("script");u.setAttribute("src",""+i+s+"="+d),t.charset&&u.setAttribute("charset",t.charset),u.id=c,document.getElementsByTagName("head")[0].appendChild(u),l=setTimeout(function(){p(new Error("JSONP request to "+e+" timed out")),a(d),o(c),window[d]=function(){a(d)}},r),u.onerror=function(){p(new Error("JSONP request to "+e+" failed")),a(d),o(c),l&&clearTimeout(l)}})}})},{}],7:[function(e,t,n){var a=a||function(e){"use strict";if(!(void 0===e||"undefined"!=typeof navigator&&/MSIE [1-9]\./.test(navigator.userAgent))){var t=e.document,n=function(){return e.URL||e.webkitURL||e},a=t.createElementNS("http://www.w3.org/1999/xhtml","a"),o="download"in a,i=/constructor/i.test(e.HTMLElement)||e.safari,r=/CriOS\/[\d]+/.test(navigator.userAgent),s=function(t){(e.setImmediate||e.setTimeout)(function(){throw t},0)},l=function(e){setTimeout(function(){"string"==typeof e?n().revokeObjectURL(e):e.remove()},4e4)},p=function(e){return/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob([String.fromCharCode(65279),e],{type:e.type}):e},d=function(t,d,c){c||(t=p(t));
21var u,m=this,h="application/octet-stream"===t.type,f=function(){!function(e,t,n){for(var a=(t=[].concat(t)).length;a--;){var o=e["on"+t[a]];if("function"==typeof o)try{o.call(e,n||e)}catch(i){s(i)}}}(m,"writestart progress write writeend".split(" "))};if(m.readyState=m.INIT,o)return u=n().createObjectURL(t),void setTimeout(function(){var e,t;a.href=u,a.download=d,e=a,t=new MouseEvent("click"),e.dispatchEvent(t),f(),l(u),m.readyState=m.DONE});!function(){if((r||h&&i)&&e.FileReader){var a=new FileReader;return a.onloadend=function(){var t=r?a.result:a.result.replace(/^data:[^;]*;/,"data:attachment/file;");e.open(t,"_blank")||(e.location.href=t),t=void 0,m.readyState=m.DONE,f()},a.readAsDataURL(t),void(m.readyState=m.INIT)}u||(u=n().createObjectURL(t)),h?e.location.href=u:e.open(u,"_blank")||(e.location.href=u);m.readyState=m.DONE,f(),l(u)}()},c=d.prototype;return"undefined"!=typeof navigator&&navigator.msSaveOrOpenBlob?function(e,t,n){return t=t||e.name||"download",n||(e=p(e)),navigator.msSaveOrOpenBlob(e,t)}:(c.abort=function(){},c.readyState=c.INIT=0,c.WRITING=1,c.DONE=2,c.error=c.onwritestart=c.onprogress=c.onwrite=c.onabort=c.onerror=c.onwriteend=null,function(e,t,n){return new d(e,t||e.name||"download",n)})}}("undefined"!=typeof self&&self||"undefined"!=typeof window&&window||this.content);void 0!==t&&t.exports&&(t.exports.saveAs=a)},{}],8:[function(e,t,n){n.read=function(e,t,n,a,o){var i,r,s=8*o-a-1,l=(1<<s)-1,p=l>>1,d=-7,c=n?o-1:0,u=n?-1:1,m=e[t+c];for(c+=u,i=m&(1<<-d)-1,m>>=-d,d+=s;d>0;i=256*i+e[t+c],c+=u,d-=8);for(r=i&(1<<-d)-1,i>>=-d,d+=a;d>0;r=256*r+e[t+c],c+=u,d-=8);if(0===i)i=1-p;else{if(i===l)return r?NaN:1/0*(m?-1:1);r+=Math.pow(2,a),i-=p}return(m?-1:1)*r*Math.pow(2,i-a)},n.write=function(e,t,n,a,o,i){var r,s,l,p=8*i-o-1,d=(1<<p)-1,c=d>>1,u=23===o?Math.pow(2,-24)-Math.pow(2,-77):0,m=a?0:i-1,h=a?1:-1,f=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,r=d):(r=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-r))<1&&(r--,l*=2),(t+=r+c>=1?u/l:u*Math.pow(2,1-c))*l>=2&&(r++,l/=2),r+c>=d?(s=0,r=d):r+c>=1?(s=(t*l-1)*Math.pow(2,o),r+=c):(s=t*Math.pow(2,c-1)*Math.pow(2,o),r=0));o>=8;e[n+m]=255&s,m+=h,s/=256,o-=8);for(r=r<<o|s,p+=o;p>0;e[n+m]=255&r,m+=h,r/=256,p-=8);e[n+m-h]|=128*f}},{}],9:[function(e,t,n){"use strict";var a;function o(e,t){return e.b===t.b&&e.a===t.a}function i(e,t){return e.b<t.b||e.b===t.b&&e.a<=t.a}function r(e,t,n){var a=t.b-e.b,o=n.b-t.b;return 0<a+o?a<o?t.a-e.a+a/(a+o)*(e.a-n.a):t.a-n.a+o/(a+o)*(n.a-e.a):0}function s(e,t,n){var a=t.b-e.b,o=n.b-t.b;return 0<a+o?(t.a-n.a)*a+(t.a-e.a)*o:0}function l(e,t){return e.a<t.a||e.a===t.a&&e.b<=t.b}function p(e,t,n){var a=t.a-e.a,o=n.a-t.a;return 0<a+o?a<o?t.b-e.b+a/(a+o)*(e.b-n.b):t.b-n.b+o/(a+o)*(n.b-e.b):0}function d(e,t,n){var a=t.a-e.a,o=n.a-t.a;return 0<a+o?(t.b-n.b)*a+(t.b-e.b)*o:0}function c(e){return i(e.b.a,e.a)}function u(e){return i(e.a,e.b.a)}function m(e,t,n,a){return(e=0>e?0:e)<=(n=0>n?0:n)?0===n?(t+a)/2:t+e/(e+n)*(a-t):a+n/(e+n)*(t-a)}function h(e){var t=b(e.b);return x(t,e.c),x(t.b,e.c),S(t,e.a),t}function f(e,t){var n=!1,a=!1;e!==t&&(t.a!==e.a&&(a=!0,T(t.a,e.a)),t.d!==e.d&&(n=!0,C(t.d,e.d)),w(t,e),a||(x(t,e.a),e.a.c=e),n||(S(t,e.d),e.d.a=e))}function g(e){var t=e.b,n=!1;e.d!==e.b.d&&(n=!0,C(e.d,e.b.d)),e.c===e?T(e.a,null):(e.b.d.a=te(e),e.a.c=e.c,w(e,te(e)),n||S(e,e.d)),t.c===t?(T(t.a,null),C(t.d,null)):(e.d.a=te(t),t.a.c=t.c,w(t,te(t))),k(e)}function y(e){var t=b(e),n=t.b;return w(t,e.e),t.a=e.b.a,x(n,t.a),t.d=n.d=e.d,t=t.b,w(e.b,te(e.b)),w(e.b,t),e.b.a=t.a,t.b.a.
vendor: 11,278 bytes, line 21
21c=t.b,t.b.d=e.b.d,t.f=e.f,t.b.f=e.b.f,t}function v(e,t){var n=!1,a=b(e),o=a.b;return t.d!==e.d&&(n=!0,C(t.d,e.d)),w(a,e.e),w(o,t),a.a=e.b.a,o.a=t.a,a.d=o.d=e.d,e.d.a=o,n||S(a,e.d),a}function b(e){var t=new ee,n=new ee,a=e.b.h;return n.h=a,a.b.h=t,t.h=e,e.b.h=n,t.b=n,t.c=t,t.e=n,n.b=t,n.c=n,n.e=t}function w(e,t){var n=e.c,a=t.c;n.b.e=t,a.b.e=e,e.c=a,t.c=n}function x(e,t){var n=t.f,a=new ae(t,n);n.e=a,t.f=a,n=a.c=e;do{n.a=a,n=n.c}while(n!==e)}function S(e,t){var n=t.d,a=new $(t,n);n.b=a,t.d=a,a.a=e,a.c=t.c,n=e;do{n.d=a,n=n.e}while(n!==e)}function k(e){var t=e.h;e=e.b.h,t.b.h=e,e.b.h=t}function T(e,t){var n=e.c,a=n;do{a.a=t,a=a.c}while(a!==n);n=e.f,(a=e.e).f=n,n.e=a}function C(e,t){var n=e.a,a=n;do{a.d=t,a=a.e}while(a!==n);n=e.d,(a=e.b).d=n,n.b=a}function _(e){var t=0;return Math.abs(e[1])>Math.abs(e[0])&&(t=1),Math.abs(e[2])>Math.abs(e[t])&&(t=2),t}var E=4e150;function M(e,t){e.f+=t.f,e.b.f+=t.b.f}function j(e,t,n){return e=e.a,t=t.a,n=n.a,t.b.a===e?n.b.a===e?i(t.a,n.a)?0>=s(n.b.a,t.a,n.a):0<=s(t.b.a,n.a,t.a):0>=s(n.b.a,e,n.a):n.b.a===e?0<=s(t.b.a,e,t.a):(t=r(t.b.a,e,t.a))>=(e=r(n.b.a,e,n.a))}function I(e){e.a.i=null;var t=e.e;t.a.c=t.c,t.c.a=t.a,e.e=null}function R(e,t){g(e.a),e.c=!1,e.a=t,t.i=e}function N(e){var t=e.a.a;do{e=fe(e)}while(e.a.a===t);return e.c&&(R(e,t=v(he(e).a.b,e.a.e)),e=fe(e)),e}function A(e,t,n){var a=new me;return a.a=n,a.e=H(e.f,t.e,a),n.i=a}function D(e,t){switch(e.s){case 100130:return 0!=(1&t);case 100131:return 0!==t;case 100132:return 0<t;case 100133:return 0>t;case 100134:return 2<=t||-2>=t}return!1}function L(e){var t=e.a,n=t.d;n.c=e.d,n.a=t,I(e)}function P(e,t,n){for(e=t,t=t.a;e!==n;){e.c=!1;var a=he(e),o=a.a;if(o.a!==t.a){if(!a.c){L(e);break}R(a,o=v(t.c.b,o.b))}t.c!==o&&(f(te(o),o),f(t,o)),L(e),t=a.a,e=a}return t}function O(e,t,n,a,o,i){var r=!0;do{A(e,t,n.b),n=n.c}while(n!==a);for(null===o&&(o=he(t).a.b.c);(n=(a=he(t)).a.b).a===o.a;)n.c!==o&&(f(te(n),n),f(te(o),n)),a.f=t.f-n.f,a.d=D(e,a.f),t.b=!0,!r&&U(e,t)&&(M(n,o),I(t),g(o)),r=!1,t=a,o=n;t.b=!0,i&&q(e,t)}function F(e,t,n,a,o){var i=[t.g[0],t.g[1],t.g[2]];t.d=null,t.d=e.o&&e.o(i,n,a,e.c)||null,null===t.d&&(o?e.n||(K(e,100156),e.n=!0):t.d=n[0])}function B(e,t,n){var a=[null,null,null,null];a[0]=t.a.d,a[1]=n.a.d,F(e,t.a,a,[.5,.5,0,0],!1),f(t,n)}function G(e,t,n,a,o){var i=Math.abs(t.b-e.b)+Math.abs(t.a-e.a),r=Math.abs(n.b-e.b)+Math.abs(n.a-e.a),s=o+1;a[o]=.5*r/(i+r),a[s]=.5*i/(i+r),e.g[0]+=a[o]*t.g[0]+a[s]*n.g[0],e.g[1]+=a[o]*t.g[1]+a[s]*n.g[1],e.g[2]+=a[o]*t.g[2]+a[s]*n.g[2]}function U(e,t){var n=he(t),a=t.a,r=n.a;if(i(a.a,r.a)){if(0<s(r.b.a,a.a,r.a))return!1;if(o(a.a,r.a)){if(a.a!==r.a){n=e.e;var l=a.a.h;if(0<=l){var p=(n=n.b).d,d=n.e,c=n.c,u=c[l];p[u]=p[n.a],c[p[u]]=u,u<=--n.a&&(1>=u?ce(n,u):i(d[p[u>>1]],d[p[u]])?ce(n,u):ue(n,u)),d[l]=null,c[l]=n.b,n.b=l}else for(n.c[-(l+1)]=null;0<n.a&&null===n.c[n.d[n.a-1]];)--n.a;B(e,te(r),a)}}else y(r.b),f(a,te(r)),t.b=n.b=!0}else{if(0>s(a.b.a,r.a,a.a))return!1;fe(t).b=t.b=!0,y(a.b),f(te(r),a)}return!0}function z(e,t){var n=he(t),a=t.a,c=n.a,u=a.a,h=c.a,g=a.b.a,v=c.b.a,b=new ae;if(s(g,e.a,u),s(v,e.a,h),u===h||Math.min(u.a,g.a)>Math.max(h.a,v.a))return!1;if(i(u,h)){if(0<s(v,u,h))return!1}else if(0>s(g,h,u))return!1;var w,x,S=g,k=u,T=v,C=h;if(i(S,k)||(w=S,S=k,k=w),i(T,C)||(w=T,T=C,C=w),i(S,T)||(w=S,S=T,T=w,w=k,k=C,C=w),i(T,k)?i(k,C)?(0>(w=r(S,T,k))+(x=r(T,k,C))&&(w=-w,x=-x),b.b=m(w,T.b,x,k.b)):(0>(w=s(S,T,k))+(x=-s(S,C,k))&&(w=-w,x=-x),b.b=m(w,T.b,x,C.b)):b.b=(T.b+k.b)/2,l(S,k)||(w=S,S=k,k=w),l(T,C)||(w=T,T=C,C=w),l(S,T)||(w=S,S=T,T=w,w=k,k=C,C=w),l(T,k)?l(k,C)?(0>(w=p(S,T,k))+(x=p(T,k,C))&&(w=-w,x=-x),b.a=m(w,T.a,x,k.a)):(0>(w=d(S,T,k))+(x=-d(S,C,k))&&(w=-w,x=-x),b.a=m(w,T.a,x,C.a)):b.a=(T.a+k.a)/2,i(b,e.a)&&(b.b=e.a.b,b.a=e.a.a),S=i(u,h)?u:h,i(S,b)&&(b.b=S.b,b.a=S.a),o(b,u)||o(b,h))return U(e,t),!1;if(!o(g,e.a)&&0<=s(g,e.a,b)||!o(v,e.a)&&0>=s(v,e.a,b)){if(v===e.a)return y(a.b),f(c.b,a),a=he(t=N(t)).a,P(e,he(t),n),O(e,t,te(a),a,a,!0),!0;if(g===e.a){y(c.b),f(a.e,te(c)),h=(u=n=t).a.b.a;do{u=fe(u)}while(u.a.b.a===h);return u=he(t=u).a.b.c,n.a=te(c),O(e,t,(c=P(e,n,null)).c,a.b.c,u,!0),!0}return 0<=s(g,e.a,b)&&(fe(t).b=t.b=!0,y(a.b),a.a.b=e.a.b,a.a.a=e.a.a),0>=s(v,e.a,b)&&(t.b=n.b=!0,y(c.b),c.a.b=e.a.b,c.a.a=e.a.a),!1}return y(a.b),y(c.b),f(te(c),a),a.a.b=b.b,a.a.a=b.a,a.a.h=ie(e.e,a.a),a=a.a,c=[0,0,0,0],b=[u.d,g.d,h.d,v.d],a.g[0]=a.g[1]=a.g[2]=0,G(a,u,g,c,0),G(a,h,v,c,2),F(e,a,b,c,!0),fe(t).b=t.b=n.b=!0,!1}function q(e,t){for(var n=he(t);;){for(;n.b;)t=n,n=he(n);if(!t.b&&(n=t,null===(t=fe(t))||!t.b))break;t.b=!1;var a,o=t.a,r=n.a;if(a=o.b.a!==r.b.a)e:{var l=he(a=t),p=a.a,d=l.a,c=void 0;if(i(p.b.a,d.b.a)){if(0>s(p.b.a,d.b.a,p.a)){a=!1;break e}fe(a).b=a.b=!0,c=y(p),f(d.b,c),c.d.c=a.d}else{if(0<s(d.b.a,p.b.a,d.a)){a=!1;break e}a.b=l.b=!0,c=y(d),f(p.e,d.b),c.b.d.c=a.d}a=!0}if(a&&(n.c?(I(n),g(r),r=(n=he(t)).a):t.c&&(I(t),g(o),o=(t=fe(n)).a)),o.a!==r.a)if(o.b.a===r.b.a||t.c||n.c||o.b.a!==e.a&&r.b.a!==e.a)U(e,t);else if(z(e,t))break;o.a===r.a&&o.b.a===r.b.a&&(M(r,o),I(t),g(o),t=fe(n))}}function V(e,t){e.a=t;for(var n=t.c;null===n.i;)if((n=n.c)===t.c){n=e;var a=t;(p=new me).a=a.c.b;var r=(c=n.f).a;do{r=r.a}while(null!==r.b&&!c.c(c.b,p,r.b));var l=he(c=r.b),p=c.a;r=l.a;if(0===s(p.b.a,a,p.a))o((p=c.a).a,a)||o(p.b.a,a)||(y(p.b),c.c&&(g(p.c),c.c=!1),f(a.c,p),V(n,a));else{var d=i(r.b.a,p.b.a)?c:l;l=void 0;c.d||d.c?(l=d===c?v(a.c.b,p.e):v(r.b.c.b,a.c).b,d.c?R(d,l):(p=n,(c=A(n,c,l)).f=fe(c).f+c.a.f,c.d=D(p,c.f)),V(n,a)):O(n,c,a.c,a.c,null,!0)}return}if(c=(p=he(n=N(n.i))).a,(p=P(e,p,null)).c===c){p=(c=p).c,r=he(n),l=n.a,d=r.a;var c,u=!1;l.b.a!==d.b.a&&z(e,n),o(l.a,e.a)&&(f(te(p),l),p=he(n=N(n)).a,P(e,he(n),r),u=!0),o(d.a,e.a)&&(f(c,te(d)),c=P(e,r,null),u=!0),u?O(e,n,c.c,p,p,!0):(a=i(d.a,l.a)?te(d):l,O(e,n,a=v(c.c.b,a),a.c,a.c,!1),a.b.i.c=!0,q(e,n))}else O(e,n,p.c,c,c,!0)}function W(e,t){var n=new me,a=h(e.b);a.a.b=E,a.a.a=t,a.b.a.b=-E,a.b.a.a=t,e.a=a.b.a,n.a=a,n.f=0,n.d=!1,n.c=!1,n.h=!0,n.b=!1,a=H(a=e.f,a.a,n),n.e=a}function X(e){this.a=new Y,this.b=e,this.c=j}function H(e,t,n){do{t=t.c}while(null!==t.b&&!e.c(e.b,t.b,n));return e=new Y(n,t.a,t),t.a.c=e,t.a=e}function Y(e,t,n){this.b=e||null,this.a=t||this,this.c=n||this}function Z(){this.d=J,this.p=this.b=this.q=null,this.j=[0,0,0],this.s=100130,this.n=!1,this.o=this.a=this.e=this.f=null,this.m=!1,this.c=this.r=this.i=this.k=this.l=this.h=null}var J=0;function Q(e,t){if(e.d!==t)for(;e.d!==t;)if(e.d<t)switch(e.d){case J:K(e,100151),e.u(null);break;case 1:K(e,100152),e.t()}else switch(e.d){case 2:K(e,100154),e.v();break;case 1:K(e,100153),e.w()}}function K(e,t){e.p&&e.p(t,e.c)}function $(e,t){this.b=e||this,this.d=t||this,this.a=null,this.c=!1}function ee(){this.h=this,this.i=this.d=this.a=this.e=this.c=this.b=null,this.f=0}function te(e){return e.b.e}function ne(){this.c=new ae,this.a=new $,this.b=new ee,this.d=new ee,this.b.b=this.d,this.d.b=this.b}function ae(e,t){this.e=e||this,this.f=t||this,this.d=this.c=null,this.g=[0,0,0],this.h=this.a=this.b=0}function oe(){this.c=[],this.d=null,this.a=0,this.e=!1,this.b=new se}function ie(e,t){if(e.e){var n,a=e.b,o=++a.a;return 2*o>a.f&&(a.f*=2,a.c=le(a.c,a.f+1)),0===a.b?n=o:(n=a.b,a.b=a.c[a.b]),a.e[n]=t,a.c[n]=o,a.d[o]=n,a.h&&ue(a,o),n}return a=e.a++,e.c[a]=t,-(a+1)}function re(e){if(0===e.a)return de(e.b);var t=e.c[e.d[e.a-1]];if(0!==e.b.a&&i(pe(e.b),t))return de(e.b);do{--e.a}while(0<e.a&&null===e.c[e.d[e.a-1]]);return t}function se(){this.d=le([0],33),this.e=[null,null],this.c=[0,0],this.a=0,this.f=32,this.b=0,this.h=!1,this.d[1]=1}function le(e,t){for(var n=Array(t),a=0;a<e.length;a++)n[a]=e[a];for(;a<t;a++)n[a]=0;return n}function pe(e){return e.e[e.d[1]]}function de(e){var t=e.d,n=e.e,a=e.c,o=t[1],i=n[o];return 0<e.a&&(t[1]=t[e.a],a[t[1]]=1,n[o]=null,a[o]=e.b,e.b=o,0<--e.a&&ce(e,1)),i}function ce(e,t){for(var n=e.d,a=e.e,o=e.c,r=t,s=n[r];;){var l=r<<1;l<e.a&&i(a[n[l+1]],a[n[l]])&&(l+=1);var p=n[l];if(l>e.a||i(a[s],a[p])){n[r]=s,o[s]=r;break}n[r]=p,o[p]=r,r=l}}function ue(e,t){for(var n=e.d,a=e.e,o=e.c,r=t,s=n[r];;){var l=r>>1,p=n[l];if(0===l||i(a[p],a[s])){n[r]=s,o[s]=r;break}n[r]=p,o[p]=r,r=l}}function me(){this.e=this.a=null,this.f=0,this.c=this.b=this.h=this.d=!1}function he(e){return e.e.c.b}function fe(e){return e.e.a.b}(a=Z.prototype).x=function(){Q(this,J)},a.B=function(e,t){switch(e){case 100142:return;case 100140:switch(t){case 100130:case 100131:case 100132:case 100133:case 100134:return void(this.s=t)}break;case 100141:return void(this.m=!!t);default:return void K(this,100900)}K(this,100901)},a.y=function(e){switch(e){case 100142:return 0;case 100140:return this.s;case 100141:return this.m;default:K(this,100900)}return!1},a.A=function(e,t,n){this.j[0]=e,this.j[1]=t,this.j[2]=n},a.z=function(e,t){var n=t||null;switch(e){case 100100:case 100106:this.h=n;break;case 100104:case 100110:this.l=n;break;case 100101:case 100107:this.k=n;break;case 100102:case 100108:this.i=n;break;case 100103:case 100109:this.p=n;break;case 100105:case 100111:this.o=n;break;case 100112:this.r=n;break;default:K(this,100900)}},a.C=function(e,t){var n=!1,a=[0,0,0];Q(this,2);for(var o=0;3>o;++o){var i=e[o];-1e150>i&&(i=-1e150,n=!0),1e150<i&&(i=1e150,n=!0),a[o]=i}n&&K(this,100155),null===(n=this.q)?f(n=h(this.b),n.b):(y(n),n=n.e),n.a.d=t,n.a.g[0]=a[0],n.a.g[1]=a[1],n.a.g[2]=a[2],n.f=1,n.b.f=-1,this.q=n},a.u=function(e){Q(this,J),this.d=1,this.b=new ne,this.c=e},a.t=function(){Q(this,1),this.d=2,this.q=null},a.v=function(){Q(this,2),this.d=1},a.w=function(){Q(this,1),this.d=J;var e=!1,t=[p=this.j[0],n=this.j[1],r=this.j[2]];if(0===p&&0===n&&0===r){for(var n=[-2e150,-2e150,-2e150],a=[2e150,2e150,2e150],r=[],l=[],p=(e=this.b.c).e;p!==e;p=p.e)for(var d=0;3>d;++d){var m=p.g[d];m<a[d]&&(a[d]=m,l[d]=p),m>n[d]&&(n[d]=m,r[d]=p)}if(p=0,n[1]-a[1]>n[0]-a[0]&&(p=1),n[2]-a[2]>n[p]-a[p]&&(p=2),a[p]>=n[p])t[0]=0,t[1]=0,t[2]=1;else{for(n=0,a=l[p],r=r[p],l=[0,0,0],a=[a.g[0]-r.g[0],a.g[1]-r.g[1],a.g[2]-r.g[2]],d=[0,0,0],p=e.e;p!==e;p=p.e)d[0]=p.g[0]-r.g[0],d[1]=p.g[1]-r.g[1],d[2]=p.g[2]-r.g[2],l[0]=a[1]*d[2]-a[2]*d[1],l[1]=a[2]*d[0]-a[0]*d[2],l[2]=a[0]*d[1]-a[1]*d[0],(m=l[0]*l[0]+l[1]*l[1]+l[2]*l[2])>n&&(n=m,t[0]=l[0],t[1]=l[1],t[2]=l[2]);0>=n&&(t[0]=t[1]=t[2]=0,t[_(a)]=1)}e=!0}for(l=_(t),p=this.b.c,n=(l+1)%3,r=(l+2)%3,l=0<t[l]?1:-1,t=p.e;t!==p;t=t.e)t.b=t.g[n],t.a=l*t.g[r];if(e){for(t=0,p=(e=this.b.a).b;p!==e;p=p.b)if(!(0>=(n=p.a).f))do{t+=(n.a.b-n.b.a.b)*(n.a.a+n.b.a.a),n=n.e}while(n!==p.a);if(0>t)for(e=(t=this.b.c).e;e!==t;e=e.e)e.a=-e.a}for(this.n=!1,p=(t=this.b.b).h;p!==t;p=e)e=p.h,n=p.e,o(p.a,p.b.a)&&p.e.e!==p&&(B(this,n,p),g(p),n=(p=n).e),n.e===p&&(n!==p&&(n!==e&&n!==e.b||(e=e.h),g(n)),p!==e&&p!==e.b||(e=e.h),g(p));for(this.e=t=new oe,p=(e=this.b.c).e;p!==e;p=p.e)p.h=ie(t,p);for(function(e){e.d=[];for(var t=0;t<e.a;t++)e.d[t]=t;e.d.sort(function(e){return function(t,n){return i(e[t],e[n])?1:-1}}(e.c)),e.e=!0,function(e){for(var t=e.a;1<=t;--t)ce(e,t);e.h=!0}(e.b)}(t),this.f=new X(this),W(this,-E),W(this,E);null!==(t=re(this.e));){for(;;){e:if(p=this.e,0===p.a)e=pe(p.b);else if(e=p.c[p.d[p.a-1]],0!==p.b.a&&(p=pe(p.b),i(p,e))){e=p;break e}if(null===e||!o(e,t))break;e=re(this.e),B(this,t.c,e.c)}V(this,t)}for(this.a=this.f.a.a.b.a.a,t=0;null!==(e=this.f.a.a.b);)e.h||++t,I(e);for(this.f=null,(t=this.e).b=null,t.d=null,this.e=t.c=null,p=(t=this.b).a.b;p!==t.a;p=e)e=p.b,(p=p.a).e.e===p&&(M(p.c,p),g(p));
21if(!this.n){if(t=this.b,this.m)for(p=t.b.h;p!==t.b;p=e)e=p.h,p.b.d.c!==p.d.c?p.f=p.d.c?1:-1:g(p);else for(p=t.a.b;p!==t.a;p=e)if(e=p.b,p.c){for(p=p.a;i(p.b.a,p.a);p=p.c.b);for(;i(p.a,p.b.a);p=p.e);for(n=p.c.b,r=void 0;p.e!==n;)if(i(p.b.a,n.a)){for(;n.e!==p&&(c(n.e)||0>=s(n.a,n.b.a,n.e.b.a));)n=(r=v(n.e,n)).b;n=n.c.b}else{for(;n.e!==p&&(u(p.c.b)||0<=s(p.b.a,p.a,p.c.b.a));)p=(r=v(p,p.c.b)).b;p=p.e}for(;n.e.e!==p;)n=(r=v(n.e,n)).b}if(this.h||this.i||this.k||this.l)if(this.m){for(e=(t=this.b).a.b;e!==t.a;e=e.b)if(e.c){this.h&&this.h(2,this.c),p=e.a;do{this.k&&this.k(p.a.d,this.c),p=p.e}while(p!==e.a);this.i&&this.i(this.c)}}else{for(t=this.b,e=!!this.l,p=!1,n=-1,r=t.a.d;r!==t.a;r=r.d)if(r.c){p||(this.h&&this.h(4,this.c),p=!0),l=r.a;do{e&&(n!==(a=l.b.d.c?0:1)&&(n=a,this.l&&this.l(!!n,this.c))),this.k&&this.k(l.a.d,this.c),l=l.e}while(l!==r.a)}p&&this.i&&this.i(this.c)}if(this.r){for(p=(t=this.b).a.b;p!==t.a;p=e)if(e=p.b,!p.c){r=(n=p.a).e,l=void 0;do{r=(l=r).e,l.d=null,null===l.b.d&&(l.c===l?T(l.a,null):(l.a.c=l.c,w(l,te(l))),(a=l.b).c===a?T(a.a,null):(a.a.c=a.c,w(a,te(a))),k(l))}while(l!==n);n=p.d,(p=p.b).d=n,n.b=p}return this.r(this.b),void(this.c=this.b=null)}}this.b=this.c=null},this.libtess={GluTesselator:Z,windingRule:{GLU_TESS_WINDING_ODD:100130,GLU_TESS_WINDING_NONZERO:100131,GLU_TESS_WINDING_POSITIVE:100132,GLU_TESS_WINDING_NEGATIVE:100133,GLU_TESS_WINDING_ABS_GEQ_TWO:100134},primitiveType:{GL_LINE_LOOP:2,GL_TRIANGLES:4,GL_TRIANGLE_STRIP:5,GL_TRIANGLE_FAN:6},errorType:{GLU_TESS_MISSING_BEGIN_POLYGON:100151,GLU_TESS_MISSING_END_POLYGON:100153,GLU_TESS_MISSING_BEGIN_CONTOUR:100152,GLU_TESS_MISSING_END_CONTOUR:100154,GLU_TESS_COORD_TOO_LARGE:100155,GLU_TESS_NEED_COMBINE_CALLBACK:100156},gluEnum:{GLU_TESS_MESH:100112,GLU_TESS_TOLERANCE:100142,GLU_TESS_WINDING_RULE:100140,GLU_TESS_BOUNDARY_ONLY:100141,GLU_INVALID_ENUM:100900,GLU_INVALID_VALUE:100901,GLU_TESS_BEGIN:100100,GLU_TESS_VERTEX:100101,GLU_TESS_END:100102,GLU_TESS_ERROR:100103,GLU_TESS_EDGE_FLAG:100104,GLU_TESS_COMBINE:100105,GLU_TESS_BEGIN_DATA:100106,GLU_TESS_VERTEX_DATA:100107,GLU_TESS_END_DATA:100108,GLU_TESS_ERROR_DATA:100109,GLU_TESS_EDGE_FLAG_DATA:100110,GLU_TESS_COMBINE_DATA:100111}},Z.prototype.gluDeleteTess=Z.prototype.x,Z.prototype.gluTessProperty=Z.prototype.B,Z.prototype.gluGetTessProperty=Z.prototype.y,Z.prototype.gluTessNormal=Z.prototype.A,Z.prototype.gluTessCallback=Z.prototype.z,Z.prototype.gluTessVertex=Z.prototype.C,Z.prototype.gluTessBeginPolygon=Z.prototype.u,Z.prototype.gluTessBeginContour=Z.prototype.t,Z.prototype.gluTessEndContour=Z.prototype.v,Z.prototype.gluTessEndPolygon=Z.prototype.w,void 0!==t&&(t.exports=this.libtess)},{}],10:[function(e,t,n){(function(a){var o;o=this,function(t){"use strict";var n,o;String.prototype.codePointAt||(n=function(){try{var e={},t=Object.defineProperty,n=t(e,e,e)&&t}catch(a){}return n}(),o=function(e){if(null==this)throw TypeError();var t=String(this),n=t.length,a=e?Number(e):0;if(a!=a&&(a=0),!(a<0||a>=n)){var o,i=t.charCodeAt(a);return i>=55296&&i<=56319&&n>a+1&&(o=t.charCodeAt(a+1))>=56320&&o<=57343?1024*(i-55296)+o-56320+65536:i}},n?n(String.prototype,"codePointAt",{value:o,configurable:!0,writable:!0}):String.prototype.codePointAt=o);var i=0,r=-3;function s(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function l(e,t){this.source=e,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new s,this.dtree=new s}var p=new s,d=new s,c=new Uint8Array(30),u=new Uint16Array(30),m=new Uint8Array(30),h=new Uint16Array(30),f=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),g=new s,y=new Uint8Array(320);function v(e,t,n,a){var o,i;for(o=0;o<n;++o)e[o]=0;for(o=0;o<30-n;++o)e[o+n]=o/n|0;for(i=a,o=0;o<30;++o)t[o]=i,i+=1<<e[o]}var b=new Uint16Array(16);function w(e,t,n,a){var o,i;for(o=0;o<16;++o)e.table[o]=0;for(o=0;o<a;++o)e.table[t[n+o]]++;for(e.table[0]=0,i=0,o=0;o<16;++o)b[o]=i,i+=e.table[o];for(o=0;o<a;++o)t[n+o]&&(e.trans[b[t[n+o]]++]=o)}function x(e){e.bitcount--||(e.tag=e.source[e.sourceIndex++],e.bitcount=7);var t=1&e.tag;return e.tag>>>=1,t}function S(e,t,n){if(!t)return n;for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var a=e.tag&65535>>>16-t;return e.tag>>>
vendor: 25,548 bytes, line 21
21=t,e.bitcount-=t,a+n}function k(e,t){for(;e.bitcount<24;)e.tag|=e.source[e.sourceIndex++]<<e.bitcount,e.bitcount+=8;var n=0,a=0,o=0,i=e.tag;do{a=2*a+(1&i),i>>>=1,++o,n+=t.table[o],a-=t.table[o]}while(a>=0);return e.tag=i,e.bitcount-=o,t.trans[n+a]}function T(e,t,n){var a,o,i,r,s,l;for(a=S(e,5,257),o=S(e,5,1),i=S(e,4,4),r=0;r<19;++r)y[r]=0;for(r=0;r<i;++r){var p=S(e,3,0);y[f[r]]=p}for(w(g,y,0,19),s=0;s<a+o;){var d=k(e,g);switch(d){case 16:var c=y[s-1];for(l=S(e,2,3);l;--l)y[s++]=c;break;case 17:for(l=S(e,3,3);l;--l)y[s++]=0;break;case 18:for(l=S(e,7,11);l;--l)y[s++]=0;break;default:y[s++]=d}}w(t,y,0,a),w(n,y,a,o)}function C(e,t,n){for(;;){var a,o,r,s,l=k(e,t);if(256===l)return i;if(l<256)e.dest[e.destLen++]=l;else for(a=S(e,c[l-=257],u[l]),o=k(e,n),s=r=e.destLen-S(e,m[o],h[o]);s<r+a;++s)e.dest[e.destLen++]=e.dest[s]}}function _(e){for(var t,n;e.bitcount>8;)e.sourceIndex--,e.bitcount-=8;if((t=256*(t=e.source[e.sourceIndex+1])+e.source[e.sourceIndex])!==(65535&~(256*e.source[e.sourceIndex+3]+e.source[e.sourceIndex+2])))return r;for(e.sourceIndex+=4,n=t;n;--n)e.dest[e.destLen++]=e.source[e.sourceIndex++];return e.bitcount=0,i}!function(e,t){var n;for(n=0;n<7;++n)e.table[n]=0;for(e.table[7]=24,e.table[8]=152,e.table[9]=112,n=0;n<24;++n)e.trans[n]=256+n;for(n=0;n<144;++n)e.trans[24+n]=n;for(n=0;n<8;++n)e.trans[168+n]=280+n;for(n=0;n<112;++n)e.trans[176+n]=144+n;for(n=0;n<5;++n)t.table[n]=0;for(t.table[5]=32,n=0;n<32;++n)t.trans[n]=n}(p,d),v(c,u,4,3),v(m,h,2,1),c[28]=0,u[28]=258;var E=function(e,t){var n,a,o=new l(e,t);do{switch(n=x(o),S(o,2,0)){case 0:a=_(o);break;case 1:a=C(o,p,d);break;case 2:T(o,o.ltree,o.dtree),a=C(o,o.ltree,o.dtree);break;default:a=r}if(a!==i)throw new Error("Data error")}while(!n);return o.destLen<o.dest.length?"function"==typeof o.dest.slice?o.dest.slice(0,o.destLen):o.dest.subarray(0,o.destLen):o.dest};function M(e,t,n,a,o){return Math.pow(1-o,3)*e+3*Math.pow(1-o,2)*o*t+3*(1-o)*Math.pow(o,2)*n+Math.pow(o,3)*a}function j(){this.x1=Number.NaN,this.y1=Number.NaN,this.x2=Number.NaN,this.y2=Number.NaN}function I(){this.commands=[],this.fill="black",this.stroke=null,this.strokeWidth=1}function R(e){throw new Error(e)}function N(e,t){e||R(t)}j.prototype.isEmpty=function(){return isNaN(this.x1)||isNaN(this.y1)||isNaN(this.x2)||isNaN(this.y2)},j.prototype.addPoint=function(e,t){"number"==typeof e&&((isNaN(this.x1)||isNaN(this.x2))&&(this.x1=e,this.x2=e),e<this.x1&&(this.x1=e),e>this.x2&&(this.x2=e)),"number"==typeof t&&((isNaN(this.y1)||isNaN(this.y2))&&(this.y1=t,this.y2=t),t<this.y1&&(this.y1=t),t>this.y2&&(this.y2=t))},j.prototype.addX=function(e){this.addPoint(e,null)},j.prototype.addY=function(e){this.addPoint(null,e)},j.prototype.addBezier=function(e,t,n,a,o,i,r,s){var l=[e,t],p=[n,a],d=[o,i],c=[r,s];this.addPoint(e,t),this.addPoint(r,s);for(var u=0;u<=1;u++){var m=6*l[u]-12*p[u]+6*d[u],h=-3*l[u]+9*p[u]-9*d[u]+3*c[u],f=3*p[u]-3*l[u];if(0!==h){var g=Math.pow(m,2)-4*f*h;if(!(g<0)){var y=(-m+Math.sqrt(g))/(2*h);0<y&&y<1&&(0===u&&this.addX(M(l[u],p[u],d[u],c[u],y)),1===u&&this.addY(M(l[u],p[u],d[u],c[u],y)));var v=(-m-Math.sqrt(g))/(2*h);0<v&&v<1&&(0===u&&this.addX(M(l[u],p[u],d[u],c[u],v)),1===u&&this.addY(M(l[u],p[u],d[u],c[u],v)))}}else{if(0===m)continue;var b=-f/m;0<b&&b<1&&(0===u&&this.addX(M(l[u],p[u],d[u],c[u],b)),1===u&&this.addY(M(l[u],p[u],d[u],c[u],b)))}}},j.prototype.addQuad=function(e,t,n,a,o,i){var r=e+2/3*(n-e),s=t+2/3*(a-t),l=r+1/3*(o-e),p=s+1/3*(i-t);this.addBezier(e,t,r,s,l,p,o,i)},I.prototype.moveTo=function(e,t){this.commands.push({type:"M",x:e,y:t})},I.prototype.lineTo=function(e,t){this.commands.push({type:"L",x:e,y:t})},I.prototype.curveTo=I.prototype.bezierCurveTo=function(e,t,n,a,o,i){this.commands.push({type:"C",x1:e,y1:t,x2:n,y2:a,x:o,y:i})},I.prototype.quadTo=I.prototype.quadraticCurveTo=function(e,t,n,a){this.commands.push({type:"Q",x1:e,y1:t,x:n,y:a})},I.prototype.close=I.prototype.closePath=function(){this.commands.push({type:"Z"})},I.prototype.extend=function(e){if(e.commands)e=e.commands;else if(e instanceof j){var t=e;return this.moveTo(t.x1,t.y1),this.lineTo(t.x2,t.y1),this.lineTo(t.x2,t.y2),this.lineTo(t.x1,t.y2),void this.close()}Array.prototype.push.apply(this.commands,e)},I.prototype.getBoundingBox=function(){for(var e=new j,t=0,n=0,a=0,o=0,i=0;i<this.commands.length;i++){var r=this.commands[i];switch(r.type){case"M":e.addPoint(r.x,r.y),t=a=r.x,n=o=r.y;break;case"L":e.addPoint(r.x,r.y),a=r.x,o=r.y;break;case"Q":e.addQuad(a,o,r.x1,r.y1,r.x,r.y),a=r.x,o=r.y;break;case"C":e.addBezier(a,o,r.x1,r.y1,r.x2,r.y2,r.x,r.y),a=r.x,o=r.y;break;case"Z":a=t,o=n;break;default:throw new Error("Unexpected path command "+r.type)}}return e.isEmpty()&&e.addPoint(0,0),e},I.prototype.draw=function(e){e.beginPath();for(var t=0;t<this.commands.length;t+=1){var n=this.commands[t];"M"===n.type?e.moveTo(n.x,n.y):"L"===n.type?e.lineTo(n.x,n.y):"C"===n.type?e.bezierCurveTo(n.x1,n.y1,n.x2,n.y2,n.x,n.y):"Q"===n.type?e.quadraticCurveTo(n.x1,n.y1,n.x,n.y):"Z"===n.type&&e.closePath()}this.fill&&(e.fillStyle=this.fill,e.fill()),this.stroke&&(e.strokeStyle=this.stroke,e.lineWidth=this.strokeWidth,e.stroke())},I.prototype.toPathData=function(e){function t(t){return Math.round(t)===t?""+Math.round(t):t.toFixed(e)}function n(){for(var e=arguments,n="",a=0;a<arguments.length;a+=1){var o=e[a];o>=0&&a>0&&(n+=" "),n+=t(o)}return n}e=void 0!==e?e:2;for(var a="",o=0;o<this.commands.length;o+=1){var i=this.commands[o];"M"===i.type?a+="M"+n(i.x,i.y):"L"===i.type?a+="L"+n(i.x,i.y):"C"===i.type?a+="C"+n(i.x1,i.y1,i.x2,i.y2,i.x,i.y):"Q"===i.type?a+="Q"+n(i.x1,i.y1,i.x,i.y):"Z"===i.type&&(a+="Z")}return a},I.prototype.toSVG=function(e){var t='<path d="';return t+=this.toPathData(e),t+='"',this.fill&&"black"!==this.fill&&(null===this.fill?t+=' fill="none"':t+=' fill="'+this.fill+'"'),this.stroke&&(t+=' stroke="'+this.stroke+'" stroke-width="'+this.strokeWidth+'"'),t+="/>"},I.prototype.toDOMElement=function(e){var t=this.toPathData(e),n=document.createElementNS("http://www.w3.org/2000/svg","path");return n.setAttribute("d",t),n};var A={fail:R,argument:N,assert:N},D={},L={},P={};function O(e){return function(){return e}}L.BYTE=function(e){return A.argument(e>=0&&e<=255,"Byte value should be between 0 and 255."),[e]},P.BYTE=O(1),L.CHAR=function(e){return[e.charCodeAt(0)]},P.CHAR=O(1),L.CHARARRAY=function(e){for(var t=[],n=0;n<e.length;n+=1)t[n]=e.charCodeAt(n);return t},P.CHARARRAY=function(e){return e.length},L.USHORT=function(e){return[e>>8&255,255&e]},P.USHORT=O(2),L.SHORT=function(e){return e>=32768&&(e=-(65536-e)),[e>>8&255,255&e]},P.SHORT=O(2),L.UINT24=function(e){return[e>>16&255,e>>8&255,255&e]},P.UINT24=O(3),L.ULONG=function(e){return[e>>24&255,e>>16&255,e>>8&255,255&e]},P.ULONG=O(4),L.LONG=function(e){return e>=2147483648&&(e=-(4294967296-e)),[e>>24&255,e>>16&255,e>>8&255,255&e]},P.LONG=O(4),L.FIXED=L.ULONG,P.FIXED=P.ULONG,L.FWORD=L.SHORT,P.FWORD=P.SHORT,L.UFWORD=L.USHORT,P.UFWORD=P.USHORT,L.LONGDATETIME=function(e){return[0,0,0,0,e>>24&255,e>>16&255,e>>8&255,255&e]},P.LONGDATETIME=O(8),L.TAG=function(e){return A.argument(4===e.length,"Tag should be exactly 4 ASCII characters."),[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]},P.TAG=O(4),L.Card8=L.BYTE,P.Card8=P.BYTE,L.Card16=L.USHORT,P.Card16=P.USHORT,L.OffSize=L.BYTE,P.OffSize=P.BYTE,L.SID=L.USHORT,P.SID=P.USHORT,L.NUMBER=function(e){return e>=-107&&e<=107?[e+139]:e>=108&&e<=1131?[247+((e-=108)>>8),255&e]:e>=-1131&&e<=-108?[251+((e=-e-108)>>8),255&e]:e>=-32768&&e<=32767?L.NUMBER16(e):L.NUMBER32(e)},P.NUMBER=function(e){return L.NUMBER(e).length},L.NUMBER16=function(e){return[28,e>>8&255,255&e]},P.NUMBER16=O(3),L.NUMBER32=function(e){return[29,e>>24&255,e>>16&255,e>>8&255,255&e]},P.NUMBER32=O(5),L.REAL=function(e){var t=e.toString(),n=/\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/.exec(t);if(n){var a=parseFloat("1e"+((n[2]?+n[2]:0)+n[1].length));t=(Math.round(e*a)/a).toString()}for(var o="",i=0,r=t.length;i<r;i+=1){var s=t[i];o+="e"===s?"-"===t[++i]?"c":"b":"."===s?"a":"-"===s?"e":s}for(var l=[30],p=0,d=(o+=1&o.length?"f":"ff").length;p<d;p+=2)l.push(parseInt(o.substr(p,2),16));return l},P.REAL=function(e){return L.REAL(e).length},L.NAME=L.CHARARRAY,P.NAME=P.CHARARRAY,L.STRING=L.CHARARRAY,P.STRING=P.CHARARRAY,D.UTF8=function(e,t,n){for(var a=[],o=n,i=0;i<o;i++,t+=1)a[i]=e.getUint8(t);return String.fromCharCode.apply(null,a)},D.UTF16=function(e,t,n){for(var a=[],o=n/2,i=0;i<o;i++,t+=2)a[i]=e.getUint16(t);return String.fromCharCode.apply(null,a)},L.UTF16=function(e){for(var t=[],n=0;n<e.length;n+=1){var a=e.charCodeAt(n);t[t.length]=a>>8&255,t[t.length]=255&a}return t},P.UTF16=function(e){return 2*e.length};var F={"x-mac-croatian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®Š™´¨≠ŽØ∞±≤≥∆µ∂∑∏š∫ªºΩžø¿¡¬√ƒ≈ƫȅ ÀÃÕŒœĐ—“”‘’÷◊©⁄€‹›Æ»–·‚„‰ÂćÁčÈÍÎÏÌÓÔđÒÚÛÙıˆ˜¯πË˚¸Êæˇ","x-mac-cyrillic":"АБВГДЕЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯ†°Ґ£§•¶І®©™Ђђ≠Ѓѓ∞±≤≥іµґЈЄєЇїЉљЊњјЅ¬√ƒ≈∆«»… ЋћЌќѕ–—“”‘’÷„ЎўЏџ№Ёёяабвгдежзийклмнопрстуфхцчшщъыьэю","x-mac-gaelic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØḂ±≤≥ḃĊċḊḋḞḟĠġṀæøṁṖṗɼƒſṠ«»… ÀÃÕŒœ–—“”‘’ṡẛÿŸṪ€‹›Ŷŷṫ·Ỳỳ⁊ÂÊÁËÈÍÎÏÌÓÔ♣ÒÚÛÙıÝýŴŵẄẅẀẁẂẃ","x-mac-greek":"Ĺ²É³ÖÜ΅àâä΄¨çéèê룙î‰ôö¦€ùûü†ΓΔΘΛΞΠß®©ΣΪ§≠°·Α±≤≥¥ΒΕΖΗΙΚΜΦΫΨΩάΝ¬ΟΡ≈Τ«»… ΥΧΆΈœ–―“”‘’÷ΉΊΌΎέήίόΏύαβψδεφγηιξκλμνοπώρστθωςχυζϊϋΐΰ­","x-mac-icelandic":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûüݰ¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€ÐðÞþý·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-inuit":"ᐃᐄᐅᐆᐊᐋᐱᐲᐳᐴᐸᐹᑉᑎᑏᑐᑑᑕᑖᑦᑭᑮᑯᑰᑲᑳᒃᒋᒌᒍᒎᒐᒑ°ᒡᒥᒦ•¶ᒧ®©™ᒨᒪᒫᒻᓂᓃᓄᓅᓇᓈᓐᓯᓰᓱᓲᓴᓵᔅᓕᓖᓗᓘᓚᓛᓪᔨᔩᔪᔫᔭ… ᔮᔾᕕᕖᕗ–—“”‘’ᕘᕙᕚᕝᕆᕇᕈᕉᕋᕌᕐᕿᖀᖁᖂᖃᖄᖅᖏᖐᖑᖒᖓᖔᖕᙱᙲᙳᙴᙵᙶᖖᖠᖡᖢᖣᖤᖥᖦᕼŁł","x-mac-ce":"ÄĀāÉĄÖÜáąČäčĆć鏟ĎíďĒēĖóėôöõúĚěü†°Ę£§•¶ß®©™ę¨≠ģĮįĪ≤≥īĶ∂∑łĻļĽľĹĺŅņѬ√ńŇ∆«»… ňŐÕőŌ–—“”‘’÷◊ōŔŕŘ‹›řŖŗŠ‚„šŚśÁŤťÍŽžŪÓÔūŮÚůŰűŲųÝýķŻŁżĢˇ",macintosh:"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›fifl‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-romanian":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ĂȘ∞±≤≥¥µ∂∑∏π∫ªºΩăș¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸ⁄€‹›Țț‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙıˆ˜¯˘˙˚¸˝˛ˇ","x-mac-turkish":"ÄÅÇÉÑÖÜáàâäãåçéèêëíìîïñóòôöõúùûü†°¢£§•¶ß®©™´¨≠ÆØ∞±≤≥¥µ∂∑∏π∫ªºΩæø¿¡¬√ƒ≈∆«»… ÀÃÕŒœ–—“”‘’÷◊ÿŸĞğİıŞş‡·‚„‰ÂÊÁËÈÍÎÏÌÓÔÒÚÛÙˆ˜¯˘˙˚¸˝˛ˇ"};D.MACSTRING=function(e,t,n,a){var o=F[a];if(void 0!==o){for(var i="",r=0;r<n;r++){var s=e.getUint8(t+r);i+=s<=127?String.fromCharCode(s):o[127&s]}return i}};var B,G="function"==typeof WeakMap&&new WeakMap;function U(e){return e>=-128&&e<=127}function z(e,t,n){for(var a=0,o=e.length;t<o&&a<64&&0===e[t];)++t,++a;return n.push(128|a-1),t}function q(e,t,n){for(var a=0,o=e.length,i=t;i<o&&a<64;){var r=e[i];if(!U(r))break;if(0===r&&i+1<o&&0===e[i+1])break;++i,++a}n.push(a-1);for(var s=t;s<i;++s)n.push(e[s]+256&255);return i}function V(e,t,n){for(var a=0,o=e.length,i=t;i<o&&a<64;){var r=e[i];if(0===r)break;if(U(r)&&i+1<o&&U(e[i+1]))break;++i,++a}n.push(64|a-1);for(var s=t;s<i;++s){var l=e[s];n.push(l+65536>>8&255,l+256&255)}return i}L.MACSTRING=function(e,t){var n=function(e){if(!B)for(var t in B={},F)B[t]=new String(t);var n=B[e];if(void 0!==n){if(G){var a=G.get(n);if(void 0!==a)return a}var o=F[e];if(void 0!==o){for(var i={},r=0;r<o.length;r++)i[o.charCodeAt(r)]=r+128;return G&&G.set(n,i),i}}}(t);if(void 0!==n){for(var a=[],o=0;o<e.length;o++){var i=e.charCodeAt(o);if(i>=128&&void 0===(i=n[i]))return;a[o]=i}return a}},P.MACSTRING=function(e,t){var n=L.MACSTRING(e,t);return void 0!==n?n.length:0},L.VARDELTAS=function(e){for(var t=0,n=[];t<e.length;){var a=e[t];t=0===a?z(e,t,n):a>=-128&&a<=127?q(e,t,n):V(e,t,n)}return n},L.INDEX=function(e){for(var t=1,n=[t],a=[],o=0;o<e.length;o+=1){var i=L.OBJECT(e[o]);Array.prototype.push.apply(a,i),t+=i.length,n.push(t)}if(0===a.length)return[0,0];for(var r=[],s=1+Math.floor(Math.log(t)/Math.log(2))/8|0,l=[void 0,L.BYTE,L.USHORT,L.UINT24,L.ULONG][s],p=0;p<n.length;p+=1){var d=l(n[p]);Array.prototype.push.apply(r,d)}return Array.prototype.concat(L.Card16(e.length),L.OffSize(s),r,a)},P.INDEX=function(e){return L.INDEX(e).length},L.DICT=function(e){for(var t=[],n=Object.keys(e),a=n.length,o=0;o<a;o+=1){var i=parseInt(n[o],0),r=e[i];t=(t=t.concat(L.OPERAND(r.value,r.type))).concat(L.OPERATOR(i))}return t},P.DICT=function(e){return L.DICT(e).length},L.OPERATOR=function(e){return e<1200?[e]:[12,e-1200]},L.OPERAND=function(e,t){var n=[];if(Array.isArray(t))for(var a=0;a<t.length;a+=1)A.argument(e.length===t.length,"Not enough arguments given for type"+t),n=n.concat(L.OPERAND(e[a],t[a]));else if("SID"===t)n=n.concat(L.NUMBER(e));else if("offset"===t)n=n.concat(L.NUMBER32(e));else if("number"===t)n=n.concat(L.NUMBER(e));else{if("real"!==t)throw new Error("Unknown operand type "+t);n=n.concat(L.REAL(e))}return n},L.OP=L.BYTE,P.OP=P.BYTE;var W="function"==typeof WeakMap&&new WeakMap;function X(e,t,n){for(var a=0;a<t.length;a+=1){var o=t[a];this[o.name]=o.value}if(this.tableName=e,this.fields=t,n)for(var i=Object.keys(n),r=0;r<i.length;r+=1){var s=i[r],l=n[s];void 0!==this[s]&&(this[s]=l)}}function H(e,t,n){void 0===n&&(n=t.length);var a=new Array(t.length+1);a[0]={name:e+"Count",type:"USHORT",value:n};for(var o=0;o<t.length;o++)a[o+1]={name:e+o,type:"USHORT",value:t[o]};return a}function Y(e,t,n){var a=t.length,o=new Array(a+1);o[0]={name:e+"Count",type:"USHORT",value:a};for(var i=0;i<a;i++)o[i+1]={name:e+i,type:"TABLE",value:n(t[i],i)};return o}function Z(e,t,n){var a=t.length,o=[];o[0]={name:e+"Count",type:"USHORT",value:a};for(var i=0;i<a;i++)o=o.concat(n(t[i],i));return o}function J(e){1===e.format?X.call(this,"coverageTable",[{name:"coverageFormat",type:"USHORT",value:1}].concat(H("glyph",e.glyphs))):A.assert(!1,"Can't create coverage table format 2 yet.")}function Q(e){X.call(this,"scriptListTable",Z("scriptRecord",e,function(e,t){var n=e.script,a=n.defaultLangSys;return A.assert(!!a,"Unable to write GSUB: script "+e.tag+" has no default language system."),[{name:"scriptTag"+t,type:"TAG",value:e.tag},{name:"script"+t,type:"TABLE",value:new X("scriptTable",[{name:"defaultLangSys",type:"TABLE",value:new X("defaultLangSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:a.reqFeatureIndex}].concat(H("featureIndex",a.featureIndexes)))}].concat(Z("langSys",n.langSysRecords,function(e,t){var n=e.langSys;return[{name:"langSysTag"+t,type:"TAG",value:e.tag},{name:"langSys"+t,type:"TABLE",value:new X("langSys",[{name:"lookupOrder",type:"USHORT",value:0},{name:"reqFeatureIndex",type:"USHORT",value:n.reqFeatureIndex}].concat(H("featureIndex",n.featureIndexes)))}]})))}]}))}function K(e){X.call(this,"featureListTable",Z("featureRecord",e,function(e,t){var n=e.feature;return[{name:"featureTag"+t,type:"TAG",value:e.tag},{name:"feature"+t,type:"TABLE",value:new X("featureTable",[{name:"featureParams",type:"USHORT",value:n.featureParams}].concat(H("lookupListIndex",n.lookupListIndexes)))}]}))}function $(e,t){X.call(this,"lookupListTable",Y("lookup",e,function(e){var n=t[e.lookupType];return A.assert(!!n,"Unable to write GSUB lookup type "+e.lookupType+" tables."),new X("lookupTable",[{name:"lookupType",type:"USHORT",value:e.lookupType},{name:"lookupFlag",type:"USHORT",value:e.lookupFlag}].concat(Y("subtable",e.subtables,n)))}))}L.CHARSTRING=function(e){if(W){var t=W.get(e);if(void 0!==t)return t}for(var n=[],a=e.length,o=0;o<a;o+=1){var i=e[o];n=n.concat(L[i.type](i.value))}return W&&W.set(e,n),n},P.CHARSTRING=function(e){return L.CHARSTRING(e).length},L.OBJECT=function(e){var t=L[e.type];return A.argument(void 0!==t,"No encoding function for type "+e.type),t(e.value)},P.OBJECT=function(e){var t=P[e.type];return A.argument(void 0!==t,"No sizeOf function for type "+e.type),t(e.value)},L.TABLE=function(e){for(var t=[],n=e.fields.length,a=[],o=[],i=0;i<n;i+=1){var r=e.fields[i],s=L[r.type];A.argument(void 0!==s,"No encoding function for field type "+r.type+" ("+r.name+")");var l=e[r.name];void 0===l&&(l=r.value);var p=s(l);"TABLE"===r.type?(o.push(t.length),t=t.concat([0,0]),a.push(p)):t=t.concat(p)}for(var d=0;d<a.length;d+=1){var c=o[d],u=t.length;A.argument(u<65536,"Table "+e.tableName+" too big."),t[c]=u>>8,t[c+1]=255&u,t=t.concat(a[d])}return t},P.TABLE=function(e){for(var t=0,n=e.fields.length,a=0;a<n;a+=1){var o=e.fields[a],i=P[o.type];A.argument(void 0!==i,"No sizeOf function for field type "+o.type+" ("+o.name+")");var r=e[o.name];void 0===r&&(r=o.value),t+=i(r),"TABLE"===o.type&&(t+=2)}return t},L.RECORD=L.TABLE,P.RECORD=P.TABLE,L.LITERAL=function(e){return e},P.LITERAL=function(e){return e.length},X.prototype.encode=function(){return L.TABLE(this)},X.prototype.sizeOf=function(){return P.TABLE(this)},J.prototype=Object.create(X.prototype),J.prototype.constructor=J,Q.prototype=Object.create(X.prototype),Q.prototype.constructor=Q,K.prototype=Object.create(X.prototype),K.prototype.constructor=K,$.prototype=Object.create(X.prototype),$.prototype.constructor=$;var ee={Table:X,Record:X,Coverage:J,ScriptList:Q,FeatureList:K,LookupList:$,ushortList:H,tableList:Y,recordList:Z};function te(e,t){return e.getUint8(t)}function ne(e,t){return e.getUint16(t,!1)}function ae(e,t){return e.getUint32(t,!1)}function oe(e,t){return e.getInt16(t,!1)+e.getUint16(t+2,!1)/65535}var ie={byte:1,uShort:2,short:2,uLong:4,fixed:4,longDateTime:8,tag:4};function re(e,t){this.data=e,this.offset=t,this.relativeOffset=0}re.prototype.parseByte=function(){var e=this.data.getUint8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},re.prototype.parseChar=function(){var e=this.data.getInt8(this.offset+this.relativeOffset);return this.relativeOffset+=1,e},re.prototype.parseCard8=re.prototype.parseByte,re.prototype.parseUShort=function(){var e=this.data.getUint16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},re.prototype.parseCard16=re.prototype.parseUShort,re.prototype.parseSID=re.prototype.parseUShort,re.prototype.parseOffset16=re.prototype.parseUShort,re.prototype.parseShort=function(){var e=this.data.getInt16(this.offset+this.relativeOffset);return this.relativeOffset+=2,e},re.prototype.parseF2Dot14=function(){var e=this.data.getInt16(this.offset+this.relativeOffset)/16384;return this.relativeOffset+=2,e},re.prototype.parseULong=function(){var e=ae(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},re.prototype.parseOffset32=re.prototype.parseULong,re.prototype.parseFixed=function(){var e=oe(this.data,this.offset+this.relativeOffset);return this.relativeOffset+=4,e},re.prototype.parseString=function(e){var t=this.data,n=this.offset+this.relativeOffset,a="";this.relativeOffset+=e;for(var o=0;o<e;o++)a+=String.fromCharCode(t.getUint8(n+o));return a},re.prototype.parseTag=function(){return this.parseString(4)},re.prototype.parseLongDateTime=function(){var e=ae(this.data,this.offset+this.relativeOffset+4);return e-=2082844800,this.relativeOffset+=8,e},re.prototype.parseVersion=function(e){var t=ne(this.data,this.offset+this.relativeOffset),n=ne(this.data,this.offset+this.relativeOffset+2);return this.relativeOffset+=4,void 0===e&&(e=4096),t+n/e/10},re.prototype.skip=function(e,t){void 0===t&&(t=1),this.relativeOffset+=ie[e]*t},re.prototype.parseULongList=function(e){void 0===e&&(e=this.parseULong());for(var t=new Array(e),n=this.data,a=this.offset+this.relativeOffset,o=0;o<e;o++)t[o]=n.getUint32(a),a+=4;return this.relativeOffset+=4*e,t},re.prototype.parseOffset16List=re.prototype.parseUShortList=function(e){void 0===e&&(e=this.parseUShort());for(var t=new Array(e),n=this.data,a=this.offset+this.relativeOffset,o=0;o<e;o++)t[o]=n.getUint16(a),a+=2;return this.relativeOffset+=2*e,t},re.prototype.parseShortList=function(e){for(var t=new Array(e),n=this.data,a=this.offset+this.relativeOffset,o=0;o<e;o++)t[o]=n.getInt16(a),a+=2;return this.relativeOffset+=2*e,t},re.prototype.parseByteList=function(e){for(var t=new Array(e),n=this.data,a=this.offset+this.relativeOffset,o=0;o<e;o++)t[o]=n.getUint8(a++);return this.relativeOffset+=e,t},re.prototype.parseList=function(e,t){t||(t=e,e=this.parseUShort());for(var n=new Array(e),a=0;a<e;a++)n[a]=t.call(this);return n},re.prototype.parseList32=function(e,t){t||(t=e,e=this.parseULong());for(var n=new Array(e),a=0;a<e;a++)n[a]=t.call(this);return n},re.prototype.parseRecordList=function(e,t){t||(t=e,e=this.parseUShort());for(var n=new Array(e),a=Object.keys(t),o=0;o<e;o++){for(var i={},r=0;r<a.length;r++){var s=a[r],l=t[s];i[s]=l.call(this)}n[o]=i}return n},re.prototype.parseRecordList32=function(e,t){t||(t=e,e=this.parseULong());for(var n=new Array(e),a=Object.keys(t),o=0;o<e;o++){for(var i={},r=0;r<a.length;r++){var s=a[r],l=t[s];i[s]=l.call(this)}n[o]=i}return n},re.prototype.parseStruct=function(e){if("function"==typeof e)return e.call(this);for(var t=Object.keys(e),n={},a=0;a<t.length;a++){var o=t[a],i=e[o];n[o]=i.call(this)}return n},re.prototype.parseValueRecord=function(e){if(void 0===e&&(e=this.parseUShort()),0!==e){var t={};return 1&e&&(t.xPlacement=this.parseShort()),2&e&&(t.yPlacement=this.parseShort()),4&e&&(t.xAdvance=this.parseShort()),8&e&&(t.yAdvance=this.parseShort()),16&e&&(t.xPlaDevice=void 0,this.parseShort()),32&e&&(t.yPlaDevice=void 0,this.parseShort()),64&e&&(t.xAdvDevice=void 0,this.parseShort()),128&e&&(t.yAdvDevice=void 0,this.parseShort()),t}},re.prototype.parseValueRecordList=function(){for(var e=this.parseUShort(),t=this.parseUShort(),n=new Array(t),a=0;a<t;a++)n[a]=this.parseValueRecord(e);return n},re.prototype.parsePointer=function(e){var t=this.parseOffset16();if(t>0)return new re(this.data,this.offset+t).parseStruct(e)},re.prototype.parsePointer32=function(e){var t=this.parseOffset32();if(t>0)return new re(this.data,this.offset+t).parseStruct(e)},re.prototype.parseListOfLists=function(e){for(var t=this.parseOffset16List(),n=t.length,a=this.relativeOffset,o=new Array(n),i=0;i<n;i++){var r=t[i];if(0!==r)if(this.relativeOffset=r,e){for(var s=this.parseOffset16List(),l=new Array(s.length),p=0;p<s.length;p++)this.relativeOffset=r+s[p],l[p]=e.call(this);o[i]=l}else o[i]=this.parseUShortList();else o[i]=void 0}return this.relativeOffset=a,o},re.prototype.parseCoverage=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort(),n=this.parseUShort();if(1===t)return{format:1,glyphs:this.parseUShortList(n)};if(2===t){for(var a=new Array(n),o=0;o<n;o++)a[o]={start:this.parseUShort(),end:this.parseUShort(),index:this.parseUShort()};return{format:2,ranges:a}}throw new Error("0x"+e.toString(16)+": Coverage format must be 1 or 2.")},re.prototype.parseClassDef=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(1===t)return{format:1,startGlyph:this.parseUShort(),classes:this.parseUShortList()};if(2===t)return{format:2,ranges:this.parseRecordList({start:re.uShort,end:re.uShort,classId:re.uShort})};throw new Error("0x"+e.toString(16)+": ClassDef format must be 1 or 2.")},re.list=function(e,t){return function(){return this.parseList(e,t)}},re.list32=function(e,t){return function(){return this.parseList32(e,t)}},re.recordList=function(e,t){return function(){return this.parseRecordList(e,t)}},re.recordList32=function(e,t){return function(){return this.parseRecordList32(e,t)}},re.pointer=function(e){return function(){return this.parsePointer(e)}},re.pointer32=function(e){return function(){return this.parsePointer32(e)}},re.tag=re.prototype.parseTag,re.byte=re.prototype.parseByte,re.uShort=re.offset16=re.prototype.parseUShort,re.uShortList=re.prototype.parseUShortList,re.uLong=re.offset32=re.prototype.parseULong,re.uLongList=re.prototype.parseULongList,re.struct=re.prototype.parseStruct,re.coverage=re.prototype.parseCoverage,re.classDef=re.prototype.parseClassDef;var se={reserved:re.uShort,reqFeatureIndex:re.uShort,featureIndexes:re.uShortList};re.prototype.parseScriptList=function(){return this.parsePointer(re.recordList({tag:re.tag,script:re.pointer({defaultLangSys:re.pointer(se),langSysRecords:re.recordList({tag:re.tag,langSys:re.pointer(se)})})}))||[]},re.prototype.parseFeatureList=function(){return this.parsePointer(re.recordList({tag:re.tag,feature:re.pointer({featureParam
21s:re.offset16,lookupListIndexes:re.uShortList})}))||[]},re.prototype.parseLookupList=function(e){return this.parsePointer(re.list(re.pointer(function(){var t=this.parseUShort();A.argument(1<=t&&t<=9,"GPOS/GSUB lookup type "+t+" unknown.");var n=this.parseUShort(),a=16&n;return{lookupType:t,lookupFlag:n,subtables:this.parseList(re.pointer(e[t])),markFilteringSet:a?this.parseUShort():void 0}})))||[]},re.prototype.parseFeatureVariationsList=function(){return this.parsePointer32(function(){var e=this.parseUShort(),t=this.parseUShort();return A.argument(1===e&&t<1,"GPOS/GSUB feature variations table unknown."),this.parseRecordList32({conditionSetOffset:re.offset32,featureTableSubstitutionOffset:re.offset32})})||[]};var le={getByte:te,getCard8:te,getUShort:ne,getCard16:ne,getShort:function(e,t){return e.getInt16(t,!1)},getULong:ae,getFixed:oe,getTag:function(e,t){for(var n="",a=t;a<t+4;a+=1)n+=String.fromCharCode(e.getInt8(a));return n},getOffset:function(e,t,n){for(var a=0,o=0;o<n;o+=1)a<<=8,a+=e.getUint8(t+o);return a},getBytes:function(e,t,n){for(var a=[],o=t;o<n;o+=1)a.push(e.getUint8(o));return a},bytesToString:function(e){for(var t="",n=0;n<e.length;n+=1)t+=String.fromCharCode(e[n]);return t},Parser:re};function pe(e,t,n){e.segments.push({end:t,start:t,delta:-(t-n),offset:0,glyphIndex:n})}var de={parse:function(e,t){var n={};n.version=le.getUShort(e,t),A.argument(0===n.version,"cmap table version should be 0."),n.numTables=le.getUShort(e,t+2);for(var a=-1,o=n.numTables-1;o>=0;o-=1){var i=le.getUShort(e,t+4+8*o),r=le.getUShort(e,t+4+8*o+2);if(3===i&&(0===r||1===r||10===r)||0===i&&(0===r||1===r||2===r||3===r||4===r)){a=le.getULong(e,t+4+8*o+4);break}}if(-1===a)throw new Error("No valid cmap sub-tables found.");var s=new le.Parser(e,t+a);if(n.format=s.parseUShort(),12===n.format)!function(e,t){var n;t.parseUShort(),e.length=t.parseULong(),e.language=t.parseULong(),e.groupCount=n=t.parseULong(),e.glyphIndexMap={};for(var a=0;a<n;a+=1)for(var o=t.parseULong(),i=t.parseULong(),r=t.parseULong(),s=o;s<=i;s+=1)e.glyphIndexMap[s]=r,r++}(n,s);else{if(4!==n.format)throw new Error("Only format 4 and 12 cmap tables are supported (found format "+n.format+").");!function(e,t,n,a,o){var i;e.length=t.parseUShort(),e.language=t.parseUShort(),e.segCount=i=t.parseUShort()>>1,t.skip("uShort",3),e.glyphIndexMap={};for(var r=new le.Parser(n,a+o+14),s=new le.Parser(n,a+o+16+2*i),l=new le.Parser(n,a+o+16+4*i),p=new le.Parser(n,a+o+16+6*i),d=a+o+16+8*i,c=0;c<i-1;c+=1)for(var u=void 0,m=r.parseUShort(),h=s.parseUShort(),f=l.parseShort(),g=p.parseUShort(),y=h;y<=m;y+=1)0!==g?(d=p.offset+p.relativeOffset-2,d+=g,d+=2*(y-h),0!==(u=le.getUShort(n,d))&&(u=u+f&65535)):u=y+f&65535,e.glyphIndexMap[y]=u}(n,s,e,t,a)}return n},make:function(e){var t,n=!0;for(t=e.length-1;t>0;t-=1)if(e.get(t).unicode>65535){console.log("Adding CMAP format 12 (needed!)"),n=!1;break}var a=[{name:"version",type:"USHORT",value:0},{name:"numTables",type:"USHORT",value:n?1:2},{name:"platformID",type:"USHORT",value:3},{name:"encodingID",type:"USHORT",value:1},{name:"offset",type:"ULONG",value:n?12:20}];n||(a=a.concat([{name:"cmap12PlatformID",type:"USHORT",value:3},{name:"cmap12EncodingID",type:"USHORT",value:10},{name:"cmap12Offset",type:"ULONG",value:0}])),a=a.concat([{name:"format",type:"USHORT",value:4},{name:"cmap4Length",type:"USHORT",value:0},{name:"language",type:"USHORT",value:0},{name:"segCountX2",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);var o=new ee.Table("cmap",a);for(o.segments=[],t=0;t<e.length;t+=1){for(var i=e.get(t),r=0;r<i.unicodes.length;r+=1)pe(o,i.unicodes[r],t);o.segments=o.segments.sort(function(e,t){return e.start-t.start})}!function(e){e.segments.push({end:65535,start:65535,delta:1,offset:0})}(o);var s=o.segments.length,l=0,p=[],d=[],c=[],u=[],m=[],h=[];for(t=0;t<s;t+=1){var f=o.segments[t];f.end<=65535&&f.start<=65535?(p=p.concat({name:"end_"+t,type:"USHORT",value:f.end}),d=d.concat({name:"start_"+t,type:"USHORT",value:f.start}),c=c.concat({name:"idDelta_"+t,type:"SHORT",value:f.delta}),u=u.concat({name:"idRangeOffset_"+t,type:"USHORT",value:f.offset}),void 0!==f.glyphId&&(m=m.concat({name:"glyph_"+t,type:"USHORT",value:f.glyphId}))):l+=1,n||void 0===f.glyphIndex||(h=(h=(h=h.concat({name:"cmap12Start_"+t,type:"ULONG",value:f.start})).concat({name:"cmap12End_"+t,type:"ULONG",value:f.end})).concat({name:"cmap12Glyph_"+t,type:"ULONG",value:f.glyphIndex}))}if(o.segCountX2=2*(s-l),o.searchRange=2*Math.pow(2,Math.floor(Math.log(s-l)/Math.log(2))),o.entrySelector=Math.log(o.searchRange/2)/Math.log(2),o.rangeShift=o.segCountX2-o.searchRange,o.fields=o.fields.concat(p),o.fields.push({name:"reservedPad",type:"USHORT",value:0}),o.fields=o.fields.concat(d),o.fields=o.fields.concat(c),o.fields=o.fields.concat(u),o.fields=o.fields.concat(m),o.cmap4Length=14+2*p.length+2+2*d.length+2*c.length+2*u.length+2*m.length,!n){var g=16+4*h.length;o.cmap12Offset=20+o.cmap4Length,o.fields=o.fields.concat([{name:"cmap12Format",type:"USHORT",value:12},{name:"cmap12Reserved",type:"USHORT",value:0},{name:"cmap12Length",type:"ULONG",value:g},{name:"cmap12Language",type:"ULONG",value:0},{name:"cmap12nGroups",type:"ULONG",value:h.length/3}]),o.fields=o.fields.concat(h)}return o}},ce=[".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","periodce
21ntered","paragraph","bullet","quotesinglbase","quotedblbase","quotedblright","guillemotright","ellipsis","perthousand","questiondown","grave","acute","circumflex","tilde","macron","breve","dotaccent","dieresis","ring","cedilla","hungarumlaut","ogonek","caron","emdash","AE","ordfeminine","Lslash","Oslash","OE","ordmasculine","ae","dotlessi","lslash","oslash","oe","germandbls","onesuperior","logicalnot","mu","trademark","Eth","onehalf","plusminus","Thorn","onequarter","divide","brokenbar","degree","thorn","threequarters","twosuperior","registered","minus","eth","multiply","threesuperior","copyright","Aacute","Acircumflex","Adieresis","Agrave","Aring","Atilde","Ccedilla","Eacute","Ecircumflex","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Ntilde","Oacute","Ocircumflex","Odieresis","Ograve","Otilde","Scaron","Uacute","Ucircumflex","Udieresis","Ugrave","Yacute","Ydieresis","Zcaron","aacute","acircumflex","adieresis","agrave","aring","atilde","ccedilla","eacute","ecircumflex","edieresis","egrave","iacute","icircumflex","idieresis","igrave","ntilde","oacute","ocircumflex","odieresis","ograve","otilde","scaron","uacute","ucircumflex","udieresis","ugrave","yacute","ydieresis","zcaron","exclamsmall","Hungarumlautsmall","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","266 ff","onedotenleader","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","commasuperior","threequartersemdash","periodsuperior","questionsmall","asuperior","bsuperior","centsuperior","dsuperior","esuperior","isuperior","lsuperior","msuperior","nsuperior","osuperior","rsuperior","ssuperior","tsuperior","ff","ffi","ffl","parenleftinferior","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","exclamdownsmall","centoldstyle","Lslashsmall","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","Dotaccentsmall","Macronsmall","figuredash","hypheninferior","Ogoneksmall","Ringsmall","Cedillasmall","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","zerosuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall","001.000","001.001","001.002","001.003","Black","Bold","Book","Light","Medium","Regular","Roman","Semibold"],ue=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","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","","end
21ash","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"],me=["","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","space","exclamsmall","Hungarumlautsmall","","dollaroldstyle","dollarsuperior","ampersandsmall","Acutesmall","parenleftsuperior","parenrightsuperior","twodotenleader","onedotenleader","comma","hyphen","period","fraction","zerooldstyle","oneoldstyle","twooldstyle","threeoldstyle","fouroldstyle","fiveoldstyle","sixoldstyle","sevenoldstyle","eightoldstyle","nineoldstyle","colon","semicolon","commasuperior","threequartersemdash","periodsuperior","questionsmall","","asuperior","bsuperior","centsuperior","dsuperior","esuperior","","","isuperior","","","lsuperior","msuperior","nsuperior","osuperior","","","rsuperior","ssuperior","tsuperior","","ff","fi","fl","ffi","ffl","parenleftinferior","","parenrightinferior","Circumflexsmall","hyphensuperior","Gravesmall","Asmall","Bsmall","Csmall","Dsmall","Esmall","Fsmall","Gsmall","Hsmall","Ismall","Jsmall","Ksmall","Lsmall","Msmall","Nsmall","Osmall","Psmall","Qsmall","Rsmall","Ssmall","Tsmall","Usmall","Vsmall","Wsmall","Xsmall","Ysmall","Zsmall","colonmonetary","onefitted","rupiah","Tildesmall","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","exclamdownsmall","centoldstyle","Lslashsmall","","","Scaronsmall","Zcaronsmall","Dieresissmall","Brevesmall","Caronsmall","","Dotaccentsmall","","","Macronsmall","","","figuredash","hypheninferior","","","Ogoneksmall","Ringsmall","Cedillasmall","","","","onequarter","onehalf","threequarters","questiondownsmall","oneeighth","threeeighths","fiveeighths","seveneighths","onethird","twothirds","","","zerosuperior","onesuperior","twosuperior","threesuperior","foursuperior","fivesuperior","sixsuperior","sevensuperior","eightsuperior","ninesuperior","zeroinferior","oneinferior","twoinferior","threeinferior","fourinferior","fiveinferior","sixinferior","seveninferior","eightinferior","nineinferior","centinferior","dollarinferior","periodinferior","commainferior","Agravesmall","Aacutesmall","Acircumflexsmall","Atildesmall","Adieresissmall","Aringsmall","AEsmall","Ccedillasmall","Egravesmall","Eacutesmall","Ecircumflexsmall","Edieresissmall","Igravesmall","Iacutesmall","Icircumflexsmall","Idieresissmall","Ethsmall","Ntildesmall","Ogravesmall","Oacutesmall","Ocircumflexsmall","Otildesmall","Odieresissmall","OEsmall","Oslashsmall","Ugravesmall","Uacutesmall","Ucircumflexsmall","Udieresissmall","Yacutesmall","Thornsmall","Ydieresissmall"],he=[".notdef",".null","nonmarkingreturn","space","exclam","quotedbl","numbersign","dollar","percent","ampersand","quotesingle","parenleft","parenright","asterisk","plus","comma","hyphen","period","slash","zero","one","two","three","four","five","six","seven","eight","nine","colon","semicolon","less","equal","greater","question","at","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","bracketleft","backslash","bracketright","asciicircum","underscore","grave","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","braceleft","bar","braceright","asciitilde","Adieresis","Aring","Ccedilla","Eacute","Ntilde","Odieresis","Udieresis","aacute","agrave","acircumflex","adieresis","atilde","aring","ccedilla","eacute","egrave","ecircumflex","edieresis","iacute","igrave","icircumflex","idieresis","ntilde","oacute","ograve","ocircumflex","odieresis","otilde","uacute","ugrave","ucircumflex","udieresis","dagger","degree","cent","sterling","section","bullet","paragraph","germandbls","registered","copyright","trademark","acute","dieresis","notequal","AE","Oslash","infinity","plusminus","lessequal","greaterequal","yen","mu","partialdiff","summation","product","pi","integral","ordfeminine","ordmasculine","Omega","ae","oslas
21h","questiondown","exclamdown","logicalnot","radical","florin","approxequal","Delta","guillemotleft","guillemotright","ellipsis","nonbreakingspace","Agrave","Atilde","Otilde","OE","oe","endash","emdash","quotedblleft","quotedblright","quoteleft","quoteright","divide","lozenge","ydieresis","Ydieresis","fraction","currency","guilsinglleft","guilsinglright","fi","fl","daggerdbl","periodcentered","quotesinglbase","quotedblbase","perthousand","Acircumflex","Ecircumflex","Aacute","Edieresis","Egrave","Iacute","Icircumflex","Idieresis","Igrave","Oacute","Ocircumflex","apple","Ograve","Uacute","Ucircumflex","Ugrave","dotlessi","circumflex","tilde","macron","breve","dotaccent","ring","cedilla","hungarumlaut","ogonek","caron","Lslash","lslash","Scaron","scaron","Zcaron","zcaron","brokenbar","Eth","eth","Yacute","yacute","Thorn","thorn","minus","multiply","onesuperior","twosuperior","threesuperior","onehalf","onequarter","threequarters","franc","Gbreve","gbreve","Idotaccent","Scedilla","scedilla","Cacute","cacute","Ccaron","ccaron","dcroat"];function fe(e){this.font=e}function ge(e){this.cmap=e}function ye(e,t){this.encoding=e,this.charset=t}function ve(e){switch(e.version){case 1:this.names=he.slice();break;case 2:this.names=new Array(e.numberOfGlyphs);for(var t=0;t<e.numberOfGlyphs;t++)e.glyphNameIndex[t]<he.length?this.names[t]=he[e.glyphNameIndex[t]]:this.names[t]=e.names[e.glyphNameIndex[t]-he.length];break;case 2.5:this.names=new Array(e.numberOfGlyphs);for(var n=0;n<e.numberOfGlyphs;n++)this.names[n]=he[n+e.glyphNameIndex[n]];break;case 3:default:this.names=[]}}fe.prototype.charToGlyphIndex=function(e){var t=e.codePointAt(0),n=this.font.glyphs;if(n)for(var a=0;a<n.length;a+=1)for(var o=n.get(a),i=0;i<o.unicodes.length;i+=1)if(o.unicodes[i]===t)return a;return null},ge.prototype.charToGlyphIndex=function(e){return this.cmap.glyphIndexMap[e.codePointAt(0)]||0},ye.prototype.charToGlyphIndex=function(e){var t=e.codePointAt(0),n=this.encoding[t];return this.charset.indexOf(n)},ve.prototype.nameToGlyphIndex=function(e){return this.names.indexOf(e)},ve.prototype.glyphIndexToName=function(e){return this.names[e]};var be={line:function(e,t,n,a,o){e.beginPath(),e.moveTo(t,n),e.lineTo(a,o),e.stroke()}};function we(e){this.bindConstructorValues(e)}function xe(e,t,n){Object.defineProperty(e,t,{get:function(){return e.path,e[n]},set:function(t){e[n]=t},enumerable:!0,configurable:!0})}function Se(e,t){if(this.font=e,this.glyphs={},Array.isArray(t))for(var n=0;n<t.length;n++)this.glyphs[n]=t[n];this.length=t&&t.length||0}we.prototype.bindConstructorValues=function(e){var t,n;this.index=e.index||0,this.name=e.name||null,this.unicode=e.unicode||void 0,this.unicodes=e.unicodes||void 0!==e.unicode?[e.unicode]:[],e.xMin&&(this.xMin=e.xMin),e.yMin&&(this.yMin=e.yMin),e.xMax&&(this.xMax=e.xMax),e.yMax&&(this.yMax=e.yMax),e.advanceWidth&&(this.advanceWidth=e.advanceWidth),Object.defineProperty(this,"path",(t=e.path,n=t||new I,{configurable:!0,get:function(){return"function"==typeof n&&(n=n()),n},set:function(e){n=e}}))},we.prototype.addUnicode=function(e){0===this.unicodes.length&&(this.unicode=e),this.unicodes.push(e)},we.prototype.getBoundingBox=function(){return this.path.getBoundingBox()},we.prototype.getPath=function(e,t,n,a,o){var i,r;e=void 0!==e?e:0,t=void 0!==t?t:0,n=void 0!==n?n:72,a||(a={});var s=a.xScale,l=a.yScale;if(a.hinting&&o&&o.hinting&&(r=this.path&&o.hinting.exec(this,n)),r)i=o.hinting.getCommands(r),e=Math.round(e),t=Math.round(t),s=l=1;else{i=this.path.commands;var p=1/this.path.unitsPerEm*n;void 0===s&&(s=p),void 0===l&&(l=p)}for(var d=new I,c=0;c<i.length;c+=1){var u=i[c];"M"===u.type?d.moveTo(e+u.x*s,t+-u.y*l):"L"===u.type?d.lineTo(e+u.x*s,t+-u.y*l):"Q"===u.type?d.quadraticCurveTo(e+u.x1*s,t+-u.y1*l,e+u.x*s,t+-u.y*l):"C"===u.type?d.curveTo(e+u.x1*s,t+-u.y1*l,e+u.x2*s,t+-u.
21y2*l,e+u.x*s,t+-u.y*l):"Z"===u.type&&d.closePath()}return d},we.prototype.getContours=function(){if(void 0===this.points)return[];for(var e=[],t=[],n=0;n<this.points.length;n+=1){var a=this.points[n];t.push(a),a.lastPointOfContour&&(e.push(t),t=[])}return A.argument(0===t.length,"There are still points left in the current contour."),e},we.prototype.getMetrics=function(){for(var e=this.path.commands,t=[],n=[],a=0;a<e.length;a+=1){var o=e[a];"Z"!==o.type&&(t.push(o.x),n.push(o.y)),"Q"!==o.type&&"C"!==o.type||(t.push(o.x1),n.push(o.y1)),"C"===o.type&&(t.push(o.x2),n.push(o.y2))}var i={xMin:Math.min.apply(null,t),yMin:Math.min.apply(null,n),xMax:Math.max.apply(null,t),yMax:Math.max.apply(null,n),leftSideBearing:this.leftSideBearing};return isFinite(i.xMin)||(i.xMin=0),isFinite(i.xMax)||(i.xMax=this.advanceWidth),isFinite(i.yMin)||(i.yMin=0),isFinite(i.yMax)||(i.yMax=0),i.rightSideBearing=this.advanceWidth-i.leftSideBearing-(i.xMax-i.xMin),i},we.prototype.draw=function(e,t,n,a,o){this.getPath(t,n,a,o).draw(e)},we.prototype.drawPoints=function(e,t,n,a){function o(t,n,a,o){var i=2*Math.PI;e.beginPath();for(var r=0;r<t.length;r+=1)e.moveTo(n+t[r].x*o,a+t[r].y*o),e.arc(n+t[r].x*o,a+t[r].y*o,2,0,i,!1);e.closePath(),e.fill()}t=void 0!==t?t:0,n=void 0!==n?n:0,a=void 0!==a?a:24;for(var i=1/this.path.unitsPerEm*a,r=[],s=[],l=this.path,p=0;p<l.commands.length;p+=1){var d=l.commands[p];void 0!==d.x&&r.push({x:d.x,y:-d.y}),void 0!==d.x1&&s.push({x:d.x1,y:-d.y1}),void 0!==d.x2&&s.push({x:d.x2,y:-d.y2})}e.fillStyle="blue",o(r,t,n,i),e.fillStyle="red",o(s,t,n,i)},we.prototype.drawMetrics=function(e,t,n,a){var o;t=void 0!==t?t:0,n=void 0!==n?n:0,a=void 0!==a?a:24,o=1/this.path.unitsPerEm*a,e.lineWidth=1,e.strokeStyle="black",be.line(e,t,-1e4,t,1e4),be.line(e,-1e4,n,1e4,n);var i=this.xMin||0,r=this.yMin||0,s=this.xMax||0,l=this.yMax||0,p=this.advanceWidth||0;e.strokeStyle="blue",be.line(e,t+i*o,-1e4,t+i*o,1e4),be.line(e,t+s*o,-1e4,t+s*o,1e4),be.line(e,-1e4,n+-r*o,1e4,n+-r*o),be.line(e,-1e4,n+-l*o,1e4,n+-l*o),e.strokeStyle="green",be.line(e,t+p*o,-1e4,t+p*o,1e4)},Se.prototype.get=function(e){return"function"==typeof this.glyphs[e]&&(this.glyphs[e]=this.glyphs[e]()),this.glyphs[e]},Se.prototype.push=function(e,t){this.glyphs[e]=t,this.length++};var ke={GlyphSet:Se,glyphLoader:function(e,t){return new we({index:t,font:e})},ttfGlyphLoader:function(e,t,n,a,o,i){return function(){var r=new we({index:t,font:e});return r.path=function(){n(r,a,o);var t=i(e.glyphs,r);return t.unitsPerEm=e.unitsPerEm,t},xe(r,"xMin","_xMin"),xe(r,"xMax","_xMax"),xe(r,"yMin","_yMin"),xe(r,"yMax","_yMax"),r}},cffGlyphLoader:function(e,t,n,a){return function(){var o=new we({index:t,font:e});return o.path=function(){var t=n(e,o,a);return t.unitsPerEm=e.unitsPerEm,t},o}}};function Te(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(var n=0;n<e.length;n+=1)if(!Te(e[n],t[n]))return!1;return!0}return!1}function Ce(e){return e.length<1240?107:e.length<33900?1131:32768}function _e(e,t,n){var a,o,i=[],r=[],s=le.getCard16(e,t);if(0!==s){var l=le.getByte(e,t+2);a=t+(s+1)*l+2;for(var p=t+3,d=0;d<s+1;d+=1)i.push(le.getOffset(e,p,l)),p+=l;o=a+i[s]}else o=t+2;for(var c=0;c<i.length-1;c+=1){var u=le.getBytes(e,a+i[c],a+i[c+1]);n&&(u=n(u)),r.push(u)}return{objects:r,startOffset:t,endOffset:o}}function Ee(e,t){if(28===t)return e.parseByte()<<8|e.parseByte();if(29===t)return e.parseByte()<<24|e.parseByte()<<16|e.parseByte()<<8|e.parseByte();if(30===t)return function(e){for(var t="",n=["0","1","2","3","4","5","6","7","8","9",".","E","E-",null,"-"];;){var a=e.parseByte(),o=a>>4,i=15&a;if(15===o)break;if(t+=n[o],15===i)break;t+=n[i]}return parseFloat(t)}(e);if(t>=32&&t<=246)return t-139;if(t>=247&&t<=250)return 256*(t-247)+e.parseByte()+108;if(t>=251&&t<=254)return 256*-(t-251)-e.parseByte()-108;throw new Error("Invalid b0 "+t)}function Me(e,t,n){t=void 0!==t?t:0;var a=new le.Parser(e,t),o=[],i=[];for(n=void 0!==n?n:e.length;a.relativeOffset<n;){var r=a.parseByte();r<=21?(12===r&&(r=1200+a.parseByte()),o.push([r,i]),i=[]):i.push(Ee(a,r))}return function(e){for(var t={},n=0;n<e.length;n+=1){var a=e[n][0],o=e[n][1],i=void 0;if(i=1===o.length?o[0]:o,t.hasOwnProperty(a)&&!isNaN(t[a]))throw new Error("Object "+t+" already has key "+a);t[a]=i}return t}(o)}function je(e,t){return t=t<=390?ce[t]:e[t-391]}function Ie(e,t,n){for(var a,o={},i=0;i<t.length;i+=1){var r=t[i];if(Array.isArray(r.type)){var s=[];s.length=r.type.length;for(var l=0;l<r.type.length;l++)void 0===(a=void 0!==e[r.op]?e[r.op][l]:void 0)&&(a=void 0!==r.value&&void 0!==r.value[l]?r.value[l]:null),"SID"===r.type[l]&&(a=je(n,a)),s[l]=a;o[r.name]=s}else void 0===(a=e[r.op])&&(a=void 0!==r.value?r.value:null),"SID"===r.type&&(a=je(n,a)),o[r.name]=a}return o}var Re=[{name:"version",op:0,type:"SID"},{name:"notice",op:1,type:"SID"},{name:"copyright",op:1200,type:"SID"},{name:"fullName",op:2,type:"SID"},{name:"familyName",op:3,type:"SID"},{name:"weight",op:4,type:"SID"},{name:"isFixedPitch",op:1201,type:"number",value:0},{name:"italicAngle",op:1202,type:"number",value:0},{name:"underlinePosition",op:1203,type:"number",value:-100},{name:"underlineThickness",op:1204,type:"number",value:50},{name:"paintType",op:1205,type:"number",value:0},{name:"charstringType",op:1206,type:"number",value:2}
vendor: 17,366 bytes, line 21
21,{name:"fontMatrix",op:1207,type:["real","real","real","real","real","real"],value:[.001,0,0,.001,0,0]},{name:"uniqueId",op:13,type:"number"},{name:"fontBBox",op:5,type:["number","number","number","number"],value:[0,0,0,0]},{name:"strokeWidth",op:1208,type:"number",value:0},{name:"xuid",op:14,type:[],value:null},{name:"charset",op:15,type:"offset",value:0},{name:"encoding",op:16,type:"offset",value:0},{name:"charStrings",op:17,type:"offset",value:0},{name:"private",op:18,type:["number","offset"],value:[0,0]},{name:"ros",op:1230,type:["SID","SID","number"]},{name:"cidFontVersion",op:1231,type:"number",value:0},{name:"cidFontRevision",op:1232,type:"number",value:0},{name:"cidFontType",op:1233,type:"number",value:0},{name:"cidCount",op:1234,type:"number",value:8720},{name:"uidBase",op:1235,type:"number"},{name:"fdArray",op:1236,type:"offset"},{name:"fdSelect",op:1237,type:"offset"},{name:"fontName",op:1238,type:"SID"}],Ne=[{name:"subrs",op:19,type:"offset",value:0},{name:"defaultWidthX",op:20,type:"number",value:0},{name:"nominalWidthX",op:21,type:"number",value:0}];function Ae(e,t){return Ie(Me(e,0,e.byteLength),Re,t)}function De(e,t,n,a){return Ie(Me(e,t,n),Ne,a)}function Le(e,t,n,a){for(var o=[],i=0;i<n.length;i+=1){var r=Ae(new DataView(new Uint8Array(n[i]).buffer),a);r._subrs=[],r._subrsBias=0;var s=r.private[0],l=r.private[1];if(0!==s&&0!==l){var p=De(e,l+t,s,a);if(r._defaultWidthX=p.defaultWidthX,r._nominalWidthX=p.nominalWidthX,0!==p.subrs){var d=_e(e,l+p.subrs+t);r._subrs=d.objects,r._subrsBias=Ce(r._subrs)}r._privateDict=p}o.push(r)}return o}function Pe(e,t,n){var a,o,i,r,s,l,p,d,c=new I,u=[],m=0,h=!1,f=!1,g=0,y=0;if(e.isCIDFont){var v=e.tables.cff.topDict._fdSelect[t.index],b=e.tables.cff.topDict._fdArray[v];s=b._subrs,l=b._subrsBias,p=b._defaultWidthX,d=b._nominalWidthX}else s=e.tables.cff.topDict._subrs,l=e.tables.cff.topDict._subrsBias,p=e.tables.cff.topDict._defaultWidthX,d=e.tables.cff.topDict._nominalWidthX;var w=p;function x(e,t){f&&c.closePath(),c.moveTo(e,t),f=!0}function S(){u.length%2!=0&&!h&&(w=u.shift()+d),m+=u.length>>1,u.length=0,h=!0}return function n(p){for(var v,b,k,T,C,_,E,M,j,I,R,N,A=0;A<p.length;){var D=p[A];switch(A+=1,D){case 1:case 3:S();break;case 4:u.length>1&&!h&&(w=u.shift()+d,h=!0),y+=u.pop(),x(g,y);break;case 5:for(;u.length>0;)g+=u.shift(),y+=u.shift(),c.lineTo(g,y);break;case 6:for(;u.length>0&&(g+=u.shift(),c.lineTo(g,y),0!==u.length);)y+=u.shift(),c.lineTo(g,y);break;case 7:for(;u.length>0&&(y+=u.shift(),c.lineTo(g,y),0!==u.length);)g+=u.shift(),c.lineTo(g,y);break;case 8:for(;u.length>0;)a=g+u.shift(),o=y+u.shift(),i=a+u.shift(),r=o+u.shift(),g=i+u.shift(),y=r+u.shift(),c.curveTo(a,o,i,r,g,y);break;case 10:C=u.pop()+l,(_=s[C])&&n(_);break;case 11:return;case 12:switch(D=p[A],A+=1,D){case 35:a=g+u.shift(),o=y+u.shift(),i=a+u.shift(),r=o+u.shift(),E=i+u.shift(),M=r+u.shift(),j=E+u.shift(),I=M+u.shift(),R=j+u.shift(),N=I+u.shift(),g=R+u.shift(),y=N+u.shift(),u.shift(),c.curveTo(a,o,i,r,E,M),c.curveTo(j,I,R,N,g,y);break;case 34:a=g+u.shift(),o=y,i=a+u.shift(),r=o+u.shift(),E=i+u.shift(),M=r,j=E+u.shift(),I=r,R=j+u.shift(),N=y,g=R+u.shift(),c.curveTo(a,o,i,r,E,M),c.curveTo(j,I,R,N,g,y);break;case 36:a=g+u.shift(),o=y+u.shift(),i=a+u.shift(),r=o+u.shift(),E=i+u.shift(),M=r,j=E+u.shift(),I=r,R=j+u.shift(),N=I+u.shift(),g=R+u.shift(),c.curveTo(a,o,i,r,E,M),c.curveTo(j,I,R,N,g,y);break;case 37:a=g+u.shift(),o=y+u.shift(),i=a+u.shift(),r=o+u.shift(),E=i+u.shift(),M=r+u.shift(),j=E+u.shift(),I=M+u.shift(),R=j+u.shift(),N=I+u.shift(),Math.abs(R-g)>Math.abs(N-y)?g=R+u.shift():y=N+u.shift(),c.curveTo(a,o,i,r,E,M),c.curveTo(j,I,R,N,g,y);break;default:console.log("Glyph "+t.index+": unknown operator 1200"+D),u.length=0}break;case 14:u.length>0&&!h&&(w=u.shift()+d,h=!0),f&&(c.closePath(),f=!1);break;case 18:S();break;case 19:case 20:S(),A+=m+7>>3;break;case 21:u.length>2&&!h&&(w=u.shift()+d,h=!0),y+=u.pop(),x(g+=u.pop(),y);break;case 22:u.length>1&&!h&&(w=u.shift()+d,h=!0),x(g+=u.pop(),y);break;case 23:S();break;case 24:for(;u.length>2;)a=g+u.shift(),o=y+u.shift(),i=a+u.shift(),r=o+u.shift(),g=i+u.shift(),y=r+u.shift(),c.curveTo(a,o,i,r,g,y);g+=u.shift(),y+=u.shift(),c.lineTo(g,y);break;case 25:for(;u.length>6;)g+=u.shift(),y+=u.shift(),c.lineTo(g,y);a=g+u.shift(),o=y+u.shift(),i=a+u.shift(),r=o+u.shift(),g=i+u.shift(),y=r+u.shift(),c.curveTo(a,o,i,r,g,y);break;case 26:for(u.length%2&&(g+=u.shift());u.length>0;)a=g,o=y+u.shift(),i=a+u.shift(),r=o+u.shift(),g=i,y=r+u.shift(),c.curveTo(a,o,i,r,g,y);break;case 27:for(u.length%2&&(y+=u.shift());u.length>0;)a=g+u.shift(),o=y,i=a+u.shift(),r=o+u.shift(),g=i+u.shift(),y=r,c.curveTo(a,o,i,r,g,y);break;case 28:v=p[A],b=p[A+1],u.push((v<<24|b<<16)>>16),A+=2;break;case 29:C=u.pop()+e.gsubrsBias,(_=e.gsubrs[C])&&n(_);break;case 30:for(;u.length>0&&(a=g,o=y+u.shift(),i=a+u.shift(),r=o+u.shift(),g=i+u.shift(),y=r+(1===u.length?u.shift():0),c.curveTo(a,o,i,r,g,y),0!==u.length);)a=g+u.shift(),o=y,i=a+u.shift(),r=o+u.shift(),y=r+u.shift(),g=i+(1===u.length?u.shift():0),c.curveTo(a,o,i,r,g,y);break;case 31:for(;u.length>0&&(a=g+u.shift(),o=y,i=a+u.shift(),r=o+u.shift(),y=r+u.shift(),g=i+(1===u.length?u.shift():0),c.curveTo(a,o,i,r,g,y),0!==u.length);)a=g,o=y+u.shift(),i=a+u.shift(),r=o+u.shift(),g=i+u.shift(),y=r+(1===u.length?u.shift():0),c.curveTo(a,o,i,r,g,y);break;default:D<32?console.log("Glyph "+t.index+": unknown operator "+D):D<247?u.push(D-139):D<251?(v=p[A],A+=1,u.push(256*(D-247)+v+108)):D<255?(v=p[A],A+=1,u.push(256*-(D-251)-v-108)):(v=p[A],b=p[A+1],k=p[A+2],T=p[A+3],A+=4,u.push((v<<24|b<<16|k<<8|T)/65536))}}}(n),t.advanceWidth=w,c}function Oe(e,t){var n,a=ce.indexOf(e);return a>=0&&(n=a),(a=t.indexOf(e))>=0?n=a+ce.length:(n=ce.length+t.length,t.push(e)),n}function Fe(e,t,n){for(var a={},o=0;o<e.length;o+=1){var i=e[o],r=t[i.name];void 0===r||Te(r,i.value)||("SID"===i.type&&(r=Oe(r,n)),a[i.op]={name:i.name,type:i.type,value:r})}return a}function Be(e,t){var n=new ee.Record("Top DICT",[{name:"dict",type:"DICT",value:{}}]);return n.dict=Fe(Re,e,t),n}function Ge(e){var t=new ee.Record("Top DICT INDEX",[{name:"topDicts",type:"INDEX",value:[]}]);return t.topDicts=[{name:"topDict_0",type:"TABLE",value:e}],t}function Ue(e){var t=[],n=e.path;t.push({name:"width",type:"NUMBER",value:e.advanceWidth});for(var a=0,o=0,i=0;i<n.commands.length;i+=1){var r=void 0,s=void 0,l=n.commands[i];if("Q"===l.type){l={type:"C",x:l.x,y:l.y,x1:1/3*a+2/3*l.x1,y1:1/3*o+2/3*l.y1,x2:1/3*l.x+2/3*l.x1,y2:1/3*l.y+2/3*l.y1}}if("M"===l.type)r=Math.round(l.x-a),s=Math.round(l.y-o),t.push({name:"dx",type:"NUMBER",value:r}),t.push({name:"dy",type:"NUMBER",value:s}),t.push({name:"rmoveto",type:"OP",value:21}),a=Math.round(l.x),o=Math.round(l.y);else if("L"===l.type)r=Math.round(l.x-a),s=Math.round(l.y-o),t.push({name:"dx",type:"NUMBER",value:r}),t.push({name:"dy",type:"NUMBER",value:s}),t.push({name:"rlineto",type:"OP",value:5}),a=Math.round(l.x),o=Math.round(l.y);else if("C"===l.type){var p=Math.round(l.x1-a),d=Math.round(l.y1-o),c=Math.round(l.x2-l.x1),u=Math.round(l.y2-l.y1);r=Math.round(l.x-l.x2),s=Math.round(l.y-l.y2),t.push({name:"dx1",type:"NUMBER",value:p}),t.push({name:"dy1",type:"NUMBER",value:d}),t.push({name:"dx2",type:"NUMBER",value:c}),t.push({name:"dy2",type:"NUMBER",value:u}),t.push({name:"dx",type:"NUMBER",value:r}),t.push({name:"dy",type:"NUMBER",value:s}),t.push({name:"rrcurveto",type:"OP",value:8}),a=Math.round(l.x),o=Math.round(l.y)}}return t.push({name:"endchar",type:"OP",value:14}),t}var ze={parse:function(e,t,n){n.tables.cff={};var a=_e(e,function(e,t){var n={};return n.formatMajor=le.getCard8(e,t),n.formatMinor=le.getCard8(e,t+1),n.size=le.getCard8(e,t+2),n.offsetSize=le.getCard8(e,t+3),n.startOffset=t,n.endOffset=t+4,n}(e,t).endOffset,le.bytesToString),o=_e(e,a.endOffset),i=_e(e,o.endOffset,le.bytesToString),r=_e(e,i.endOffset);n.gsubrs=r.objects,n.gsubrsBias=Ce(n.gsubrs);var s=Le(e,t,o.objects,i.objects);if(1!==s.length)throw new Error("CFF table has too many fonts in 'FontSet' - count of fonts NameIndex.length = "+s.length);var l=s[0];if(n.tables.cff.topDict=l,l._privateDict&&(n.defaultWidthX=l._privateDict.defaultWidthX,n.nominalWidthX=l._privateDict.nominalWidthX),void 0!==l.ros[0]&&void 0!==l.ros[1]&&(n.isCIDFont=!0),n.isCIDFont){var p=l.fdArray,d=l.fdSelect;if(0===p||0===d)throw new Error("Font is marked as a CID font, but FDArray and/or FDSelect information is missing");var c=Le(e,t,_e(e,p+=t).objects,i.objects);l._fdArray=c,d+=t,l._fdSelect=function(e,t,n,a){var o,i=[],r=new le.Parser(e,t),s=r.parseCard8();if(0===s)for(var l=0;l<n;l++){if((o=r.parseCard8())>=a)throw new Error("CFF table CID Font FDSelect has bad FD index value "+o+" (FD count "+a+")");i.push(o)}else{if(3!==s)throw new Error("CFF Table CID Font FDSelect table has unsupported format "+s);var p,d=r.parseCard16(),c=r.parseCard16();if(0!==c)throw new Error("CFF Table CID Font FDSelect format 3 range has bad initial GID "+c);for(var u=0;u<d;u++){if(o=r.parseCard8(),p=r.parseCard16(),o>=a)throw new Error("CFF table CID Font FDSelect has bad FD index value "+o+" (FD count "+a+")");if(p>n)throw new Error("CFF Table CID Font FDSelect format 3 range has bad GID "+p);for(;c<p;c++)i.push(o);c=p}if(p!==n)throw new Error("CFF Table CID Font FDSelect format 3 range has bad final GID "+p)}return i}(e,d,n.numGlyphs,c.length)}var u=t+l.private[1],m=De(e,u,l.private[0],i.objects);if(n.defaultWidthX=m.defaultWidthX,n.nominalWidthX=m.nominalWidthX,0!==m.subrs){var h=_e(e,u+m.subrs);n.subrs=h.objects,n.subrsBias=Ce(n.subrs)}else n.subrs=[],n.subrsBias=0;var f=_e(e,t+l.charStrings);n.nGlyphs=f.objects.length;var g=function(e,t,n,a){var o,i,r=new le.Parser(e,t);n-=1;var s=[".notdef"],l=r.parseCard8();if(0===l)for(var p=0;p<n;p+=1)o=r.parseSID(),s.push(je(a,o));else if(1===l)for(;s.length<=n;){o=r.parseSID(),i=r.parseCard8();for(var d=0;d<=i;d+=1)s.push(je(a,o)),o+=1}else{if(2!==l)throw new Error("Unknown charset format "+l);for(;s.length<=n;){o=r.parseSID(),i=r.parseCard16();for(var c=0;c<=i;c+=1)s.push(je(a,o)),o+=1}}return s}(e,t+l.charset,n.nGlyphs,i.objects);0===l.encoding?n.cffEncoding=new ye(ue,g):1===l.encoding?n.cffEncoding=new ye(me,g):n.cffEncoding=function(e,t,n){var a,o={},i=new le.Parser(e,t),r=i.parseCard8();if(0===r)for(var s=i.parseCard8(),l=0;l<s;l+=1)o[a=i.parseCard8()]=l;else{if(1!==r)throw new Error("Unknown encoding format "+r);var p=i.parseCard8();a=1;for(var d=0;d<p;d+=1)for(var c=i.parseCard8(),u=i.parseCard8(),m=c;m<=c+u;m+=1)o[m]=a,a+=1}return new ye(o,n)}(e,t+l.encoding,g),n.encoding=n.encoding||n.cffEncoding,n.glyphs=new ke.GlyphSet(n);for(var y=0;y<n.nGlyphs;y+=1){var v=f.objects[y];n.glyphs.push(y,ke.cffGlyphLoader(n,y,Pe,v))}},make:function(e,t){for(var n,a=new ee.Table("CFF ",[{name:"header",type:"RECORD"},{name:"nameIndex",type:"RECORD"},{name:"topDictIndex",type:"RECORD"},{name:"stringIndex",type:"RECORD"},{name:"globalSubrIndex",type:"RECORD"},{name:"charsets",type:"RECORD"},{name:"charStringsIndex",type:"RECORD"},{name:"privateDict",type:"RECORD"}]),o=1/t.unitsPerEm,i={version:t.version,fullName:t.fullName,familyName:t.familyName,weight:t.weightName,fontBBox:t.fontBBox||[0,0,0,0],fontMatrix:[o,0,0,o,0,0],charset:999,encoding:0,charStrings:999,private:[0,999]},r=[],s=1;s<e.length;s+=1)n=e.get(s),r.push(n.name);var l=[];a.header=new ee.Record("Header",[{name:"major",type:"Card8",value:1},{name:"minor",type:"Card8",value:0},{name:"hdrSize",type:"Card8",value:4},{name:"major",type:"Card8",value:1}]),a.nameIndex=function(e){var t=new ee.Record("Name INDEX",[{name:"names",type:"INDEX",value:[]}]);t.names=[];for(var n=0;n<e.length;n+=1)t.names.push({name:"name_"+n,type:"NAME",value:e[n]});return t}([t.postScriptName]);var p=Be(i,l);a.topDictIndex=Ge(p),a.globalSubrIndex=new ee.Record("Global Subr INDEX",[{name:"subrs",type:"INDEX",value:[]}]),a.charsets=function(e,t){for(var n=new ee.Record("Charsets",[{name:"format",type:"Card8",value:0}]),a=0;a<e.length;a+=1){var o=Oe(e[a],t);n.fields.push({name:"glyph_"+a,type:"SID",value:o})}return n}(r,l),a.charStringsIndex=function(e){for(var t=new ee.Record("CharStrings INDEX",[{name:"charStrings",type:"INDEX",value:[]}]),n=0;n<e.length;n+=1){var a=e.get(n),o=Ue(a);t.charStrings.push({name:a.name,type:"CHARSTRING",value:o})}return t}(e),a.privateDict=function(e,t){var n=new ee.Record("Private DICT",[{name:"dict",type:"DICT",value:{}}]);return n.dict=Fe(Ne,e,t),n}({},l),a.stringIndex=function(e){var t=new ee.Record("String INDEX",[{name:"strings",type:"INDEX",value:[]}]);t.strings=[];for(var n=0;n<e.length;n+=1)t.strings.push({name:"string_"+n,type:"STRING",value:e[n]});return t}(l);var d=a.header.sizeOf()+a.nameIndex.sizeOf()+a.topDictIndex.sizeOf()+a.stringIndex.sizeOf()+a.globalSubrIndex.sizeOf();return i.charset=d,i.encoding=0,i.charStrings=i.charset+a.charsets.sizeOf(),i.private[1]=i.charStrings+a.charStringsIndex.sizeOf(),p=Be(i,l),a.topDictIndex=Ge(p),a}},qe={parse:function(e,t){var n={},a=new le.Parser(e,t);return n.version=a.parseVersion(),n.fontRevision=Math.round(1e3*a.parseFixed())/1e3,n.checkSumAdjustment=a.parseULong(),n.magicNumber=a.parseULong(),A.argument(1594834165===n.magicNumber,"Font header has wrong magic number."),n.flags=a.parseUShort(),n.unitsPerEm=a.parseUShort(),n.created=a.parseLongDateTime(),n.modified=a.parseLongDateTime(),n.xMin=a.parseShort(),n.yMin=a.parseShort(),n.xMax=a.parseShort(),n.yMax=a.parseShort(),n.macStyle=a.parseUShort(),n.lowestRecPPEM=a.parseUShort(),n.fontDirectionHint=a.parseShort(),n.indexToLocFormat=a.parseShort(),n.glyphDataFormat=a.parseShort(),n},make:function(e){var t=Math.round((new Date).getTime()/1e3)+2082844800,n=t;return e.createdTimestamp&&(n=e.createdTimestamp+2082844800),new ee.Table("head",[{name:"version",type:"FIXED",value:65536},{name:"fontRevision",type:"FIXED",value:65536},{name:"checkSumAdjustment",type:"ULONG",value:0},{name:"magicNumber",type:"ULONG",value:1594834165},{name:"flags",type:"USHORT",value:0},{name:"unitsPerEm",type:"USHORT",value:1e3},{name:"created",type:"LONGDATETIME",value:n},{name:"modified",type:"LONGDATETIME",value:t},{name:"xMin",type:"SHORT",value:0},{name:"yMin",type:"SHORT",value:0},{name:"xMax",type:"SHORT",value:0},{name:"yMax",type:"SHORT",value:0},{name:"macStyle",type:"USHORT",value:0},{name:"lowestRecPPEM",type:"USHORT",value:0},{name:"fontDirectionHint",type:"SHORT",value:2},{name:"indexToLocFormat",type:"SHORT",value:0},{name:"glyphDataFormat",type:"SHORT",value:0}],e)}},Ve={parse:function(e,t){var n={},a=new le.Parser(e,t);return n.version=a.parseVersion(),n.ascender=a.parseShort(),n.descender=a.parseShort(),n.lineGap=a.parseShort(),n.advanceWidthMax=a.parseUShort(),n.minLeftSideBearing=a.parseShort(),n.minRightSideBearing=a.parseShort(),n.xMaxExtent=a.parseShort(),n.caretSlopeRise=a.parseShort(),n.caretSlopeRun=a.parseShort(),n.caretOffset=a.parseShort(),a.relativeOffset+=8,n.metricDataFormat=a.parseShort(),n.numberOfHMetrics=a.parseUShort(),n},make:function(e){return new ee.Table("hhea",[{name:"version",type:"FIXED",value:65536},{name:"ascender",type:"FWORD",value:0},{name:"descender",type:"FWORD",value:0},{name:"lineGap",type:"FWORD",value:0},{name:"advanceWidthMax",type:"UFWORD",value:0},{name:"minLeftSideBearing",type:"FWORD",value:0},{name:"minRightSideBearing",type:"FWORD",value:0},{name:"xMaxExtent",type:"FWORD",value:0},{name:"caretSlopeRise",type:"SHORT",value:1},{name:"caretSlopeRun",type:"SHORT",value:0},{name:"caretOffset",type:"SHORT",value:0},{name:"reserved1",type:"SHORT",value:0},{name:"reserved2",type:"SHORT",value:0},{name:"reserved3",type:"SHORT",value:0},{name:"reserved4",type:"SHORT",value:0},{name:"metricDataFormat",type:"SHORT",value:0},{name:"numberOfHMetrics",type:"USHORT",value:0}],e)}},We={parse:function(e,t,n,a,o){for(var i,r,s=new le.Parser(e,t),l=0;l<a;l+=1){l<n&&(i=s.parseUShort(),r=s.parseShort());var p=o.get(l);p.advanceWidth=i,p.leftSideBearing=r}},make:function(e){for(var t=new ee.Table("hmtx",[]),n=0;n<e.length;n+=1){var a=e.get(n),o=a.advanceWidth||0,i=a.leftSideBearing||0;t.fields.push({name:"advanceWidth_"+n,type:"USHORT",value:o}),t.fields.push({name:"leftSideBearing_"+n,type:"SHORT",value:i})}return t}},Xe={make:function(e){for(var t=new ee.Table("ltag",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"numTags",type:"ULONG",value:e.length}]),n="",a=12+4*e.length,o=0;o<e.length;++o){var i=n.indexOf(e[o]);i<0&&(i=n.length,n+=e[o]),t.fields.push({name:"offset "+o,type:"USHORT",value:a+i}),t.fields.push({name:"length "+o,type:"USHORT",value:e[o].length})}return t.fields.push({name:"stringPool",type:"CHARARRAY",value:n}),t},parse:function(e,t){var n=new le.Parser(e,t),a=n.parseULong();A.argument(1===a,"Unsupported ltag table version."),n.skip("uLong",1);for(var o=n.parseULong(),i=[],r=0;r<o;r++){for(var s="",l=t+n.parseUShort(),p=n.parseUShort(),d=l;d<l+p;++d)s+=String.fromCharCode(e.getInt8(d));i.push(s)}return i}},He={parse:function(e,t){var n={},a=new le.Parser(e,t);return n.version=a.parseVersion(),n.numGlyphs=a.parseUShort(),1===n.version&&(n.maxPoints=a.parseUShort(),n.maxContours=a.parseUShort(),n.maxCompositePoints=a.parseUShort(),n.maxCompositeContours=a.parseUShort(),n.maxZones=a.parseUShort(),n.maxTwilightPoints=a.parseUShort(),n.maxStorage=a.parseUShort(),n.maxFunctionDefs=a.parseUShort(),n.maxInstructionDefs=a.parseUShort(),n.maxStackElements=a.parseUShort(),n.maxSizeOfInstru
21ctions=a.parseUShort(),n.maxComponentElements=a.parseUShort(),n.maxComponentDepth=a.parseUShort()),n},make:function(e){return new ee.Table("maxp",[{name:"version",type:"FIXED",value:20480},{name:"numGlyphs",type:"USHORT",value:e}])}},Ye=["copyright","fontFamily","fontSubfamily","uniqueID","fullName","version","postScriptName","trademark","manufacturer","designer","description","manufacturerURL","designerURL","license","licenseURL","reserved","preferredFamily","preferredSubfamily","compatibleFullName","sampleText","postScriptFindFontName","wwsFamily","wwsSubfamily"],Ze={0:"en",1:"fr",2:"de",3:"it",4:"nl",5:"sv",6:"es",7:"da",8:"pt",9:"no",10:"he",11:"ja",12:"ar",13:"fi",14:"el",15:"is",16:"mt",17:"tr",18:"hr",19:"zh-Hant",20:"ur",21:"hi",22:"th",23:"ko",24:"lt",25:"pl",26:"hu",27:"es",28:"lv",29:"se",30:"fo",31:"fa",32:"ru",33:"zh",34:"nl-BE",35:"ga",36:"sq",37:"ro",38:"cz",39:"sk",40:"si",41:"yi",42:"sr",43:"mk",44:"bg",45:"uk",46:"be",47:"uz",48:"kk",49:"az-Cyrl",50:"az-Arab",51:"hy",52:"ka",53:"mo",54:"ky",55:"tg",56:"tk",57:"mn-CN",58:"mn",59:"ps",60:"ks",61:"ku",62:"sd",63:"bo",64:"ne",65:"sa",66:"mr",67:"bn",68:"as",69
21:"gu",70:"pa",71:"or",72:"ml",73:"kn",74:"ta",75:"te",76:"si",77:"my",78:"km",79:"lo",80:"vi",81:"id",82:"tl",83:"ms",84:"ms-Arab",85:"am",86:"ti",87:"om",88:"so",89:"sw",90:"rw",91:"rn",92:"ny",93:"mg",94:"eo",128:"cy",129:"eu",130:"ca",131:"la",132:"qu",133:"gn",134:"ay",135:"tt",136:"ug",137:"dz",138:"jv",139:"su",140:"gl",141:"af",142:"br",143:"iu",144:"gd",145:"gv",146:"ga",147:"to",148:"el-polyton",149:"kl",150:"az",151:"nn"},Je={0:0,1:0,2:0,3:0,4:0,5:0,6:0,7:0,8:0,9:0,10:5,11:1,12:4,13:0,14:6,15:0,16:0,17:0,18:0,19:2,20:4,21:9,22:21,23:3,24:29,25:29,26:29,27:29,28:29,29:0,30:0,31:4,32:7,33:25,34:0,35:0,36:0,37:0,38:29,39:29,40:0,41:5,42:7,43:7,44:7,45:7,46:7,47:7,48:7,49:7,50:4,51:24,52:23,53:7,54:7,55:7,56:7,57:27,58:7,59:4,60:4,61:4,62:4,63:26,64:9,65:9,66:9,67:13,68:13,69:11,70:10,71:12,72:17,73:16,74:14,75:15,76:18,77:19,78:20,79:22,80:30,81:0,82:0,83:0,84:4,85:28,86:28,87:28,88:0,89:0,90:0,91:0,92:0,93:0,94:0,128:0,129:0,130:0,131:0,132:0,133:0,134:0,135:7,136:4,137:26,138:0,139:0,140:0,141:0,142:0,143:28,144:0,145:0,146:0,147:0,148:6,149:0,150:0,151:0},Qe={1078:"af",1052:"sq",1156:"gsw",1118:"am",5121:"ar-DZ",15361:"ar-BH",3073:"ar",2049:"ar-IQ",11265:"ar-JO",13313:"ar-KW",12289:"ar-LB",4097:"ar-LY",6145:"ary",8193:"ar-OM",16385:"ar-QA",1025:"ar-SA",10241:"ar-SY",7169:"aeb",14337:"ar-AE",9217:"ar-YE",1067:"hy",1101:"as",2092:"az-Cyrl",1068:"az",1133:"ba",1069:"eu",1059:"be",2117:"bn",1093:"bn-IN",8218:"bs-Cyrl",5146:"bs",1150:"br",1026:"bg",1027:"ca",3076:"zh-HK",5124:"zh-MO",2052:"zh",4100:"zh-SG",1028:"zh-TW",1155:"co",1050:"hr",4122:"hr-BA",1029:"cs",1030:"da",1164:"prs",1125:"dv",2067:"nl-BE",1043:"nl",3081:"en-AU",10249:"en-BZ",4105:"en-CA",9225:"en-029",16393:"en-IN",6153:"en-IE",8201:"en-JM",17417:"en-MY",5129:"en-NZ",13321:"en-PH",18441:"en-SG",7177:"en-ZA",11273:"en-TT",2057:"en-GB",1033:"en",12297:"en-ZW",1061:"et",1080:"fo",1124:"fil",1035:"fi",2060:"fr-BE",3084:"fr-CA",1036:"fr",5132:"fr-LU",6156:"fr-MC",4108:"fr-CH",1122:"fy",1110:"gl",1079:"ka",3079:"de-AT",1031:"de",5127:"de-LI",4103:"de-LU",2055:"de-CH",1032:"el",1135:"kl",1095:"gu",1128:"ha",1037:"he",1081:"hi",1038:"hu",1039:"is",1136:"ig",1057:"id",1117:"iu",2141:"iu-Latn",2108:"ga",1076:"xh",1077:"zu",104
vendor: 33,341 bytes, line 21
210:"it",2064:"it-CH",1041:"ja",1099:"kn",1087:"kk",1107:"km",1158:"quc",1159:"rw",1089:"sw",1111:"kok",1042:"ko",1088:"ky",1108:"lo",1062:"lv",1063:"lt",2094:"dsb",1134:"lb",1071:"mk",2110:"ms-BN",1086:"ms",1100:"ml",1082:"mt",1153:"mi",1146:"arn",1102:"mr",1148:"moh",1104:"mn",2128:"mn-CN",1121:"ne",1044:"nb",2068:"nn",1154:"oc",1096:"or",1123:"ps",1045:"pl",1046:"pt",2070:"pt-PT",1094:"pa",1131:"qu-BO",2155:"qu-EC",3179:"qu",1048:"ro",1047:"rm",1049:"ru",9275:"smn",4155:"smj-NO",5179:"smj",3131:"se-FI",1083:"se",2107:"se-SE",8251:"sms",6203:"sma-NO",7227:"sms",1103:"sa",7194:"sr-Cyrl-BA",3098:"sr",6170:"sr-Latn-BA",2074:"sr-Latn",1132:"nso",1074:"tn",1115:"si",1051:"sk",1060:"sl",11274:"es-AR",16394:"es-BO",13322:"es-CL",9226:"es-CO",5130:"es-CR",7178:"es-DO",12298:"es-EC",17418:"es-SV",4106:"es-GT",18442:"es-HN",2058:"es-MX",19466:"es-NI",6154:"es-PA",15370:"es-PY",10250:"es-PE",20490:"es-PR",3082:"es",1034:"es",21514:"es-US",14346:"es-UY",8202:"es-VE",2077:"sv-FI",1053:"sv",1114:"syr",1064:"tg",2143:"tzm",1097:"ta",1092:"tt",1098:"te",1054:"th",1105:"bo",1055:"tr",1090:"tk",1152:"ug",1058:"uk",1070:"hsb",1056:"ur",2115:"uz-Cyrl",1091:"uz",1066:"vi",1106:"cy",1160:"wo",1157:"sah",1144:"ii",1130:"yo"};function Ke(e,t,n){switch(e){case 0:if(65535===t)return"und";if(n)return n[t];break;case 1:return Ze[t];case 3:return Qe[t]}}var $e="utf-16",et={0:"macintosh",1:"x-mac-japanese",2:"x-mac-chinesetrad",3:"x-mac-korean",6:"x-mac-greek",7:"x-mac-cyrillic",9:"x-mac-devanagai",10:"x-mac-gurmukhi",11:"x-mac-gujarati",12:"x-mac-oriya",13:"x-mac-bengali",14:"x-mac-tamil",15:"x-mac-telugu",16:"x-mac-kannada",17:"x-mac-malayalam",18:"x-mac-sinhalese",19:"x-mac-burmese",20:"x-mac-khmer",21:"x-mac-thai",22:"x-mac-lao",23:"x-mac-georgian",24:"x-mac-armenian",25:"x-mac-chinesesimp",26:"x-mac-tibetan",27:"x-mac-mongolian",28:"x-mac-ethiopic",29:"x-mac-ce",30:"x-mac-vietnamese",31:"x-mac-extarabic"},tt={15:"x-mac-icelandic",17:"x-mac-turkish",18:"x-mac-croatian",24:"x-mac-ce",25:"x-mac-ce",26:"x-mac-ce",27:"x-mac-ce",28:"x-mac-ce",30:"x-mac-icelandic",37:"x-mac-romanian",38:"x-mac-ce",39:"x-mac-ce",40:"x-mac-ce",143:"x-mac-inuit",146:"x-mac-gaelic"};function nt(e,t,n){switch(e){case 0:return $e;case 1:return tt[n]||et[t];case 3:if(1===t||10===t)return $e}}function at(e){var t={};for(var n in e)t[e[n]]=parseInt(n);return t}function ot(e,t,n,a,o,i){return new ee.Record("NameRecord",[{name:"platformID",type:"USHORT",value:e},{name:"encodingID",type:"USHORT",value:t},{name:"languageID",type:"USHORT",value:n},{name:"nameID",type:"USHORT",value:a},{name:"length",type:"USHORT",value:o},{name:"offset",type:"USHORT",value:i}])}function it(e,t){var n=function(e,t){var n=e.length,a=t.length-n+1;e:for(var o=0;o<a;o++)for(;o<a;o++){for(var i=0;i<n;i++)if(t[o+i]!==e[i])continue e;return o}return-1}(e,t);if(n<0){n=t.length;for(var a=0,o=e.length;a<o;++a)t.push(e[a])}return n}var rt={parse:function(e,t,n){for(var a={},o=new le.Parser(e,t),i=o.parseUShort(),r=o.parseUShort(),s=o.offset+o.parseUShort(),l=0;l<r;l++){var p=o.parseUShort(),d=o.parseUShort(),c=o.parseUShort(),u=o.parseUShort(),m=Ye[u]||u,h=o.parseUShort(),f=o.parseUShort(),g=Ke(p,c,n),y=nt(p,d,c);if(void 0!==y&&void 0!==g){var v=void 0;if(v=y===$e?D.UTF16(e,s+f,h):D.MACSTRING(e,s+f,h,y)){var b=a[m];void 0===b&&(b=a[m]={}),b[g]=v}}}return 1===i&&o.parseUShort(),a},make:function(e,t){var n,a=[],o={},i=at(Ye);for(var r in e){var s=i[r];if(void 0===s&&(s=r),n=parseInt(s),isNaN(n))throw new Error('Name table entry "'+r+'" does not exist, see nameTableNames for complete list.');o[n]=e[r],a.push(n)}for(var l=at(Ze),p=at(Qe),d=[],c=[],u=0;u<a.length;u++){var m=o[n=a[u]];for(var h in m){var f=m[h],g=1,y=l[h],v=Je[y],b=nt(g,v,y),w=L.MACSTRING(f,b);void 0===w&&(g=0,(y=t.indexOf(h))<0&&(y=t.length,t.push(h)),v=4,w=L.UTF16(f));var x=it(w,c);d.push(ot(g,v,y,n,w.length,x));var S=p[h];if(void 0!==S){var k=L.UTF16(f),T=it(k,c);d.push(ot(3,1,S,n,k.length,T))}}}d.sort(function(e,t){return e.platformID-t.platformID||e.encodingID-t.encodingID||e.languageID-t.languageID||e.nameID-t.nameID});for(var C=new ee.Table("name",[{name:"format",type:"USHORT",value:0},{name:"count",type:"USHORT",value:d.length},{name:"stringOffset",type:"USHORT",value:6+12*d.length}]),_=0;_<d.length;_++)C.fields.push({name:"record_"+_,type:"RECORD",value:d[_]});return C.fields.push({name:"strings",type:"LITERAL",value:c}),C}},st=[{begin:0,end:127},{begin:128,end:255},{begin:256,end:383},{begin:384,end:591},{begin:592,end:687},{begin:688,end:767},{begin:768,end:879},{begin:880,end:1023},{begin:11392,end:11519},{begin:1024,end:1279},{begin:1328,end:1423},{begin:1424,end:1535},{begin:42240,end:42559},{begin:1536,end:1791},{begin:1984,end:2047},{begin:2304,end:2431},{begin:2432,end:2559},{begin:2560,end:2687},{begin:2688,end:2815},{begin:2816,end:2943},{begin:2944,end:3071},{begin:3072,end:3199},{begin:3200,end:3327},{begin:3328,end:3455},{begin:3584,end:3711},{begin:3712,end:3839},{begin:4256,end:4351},{begin:6912,end:7039},{begin:4352,end:4607},{begin:7680,end:7935},{begin:7936,end:8191},{begin:8192,end:8303},{begin:8304,end:8351},{begin:8352,end:8399},{begin:8400,end:8447},{begin:8448,end:8527},{begin:8528,end:8591},{begin:8592,end:8703},{begin:8704,end:8959},{begin:8960,end:9215},{begin:9216,end:9279},{begin:9280,end:9311},{begin:9312,end:9471},{begin:9472,end:9599},{begin:9600,end:9631},{begin:9632,end:9727},{begin:9728,end:9983},{begin:9984,end:10175},{begin:12288,end:12351},{begin:12352,end:12447},{begin:12448,end:12543},{begin:12544,end:12591},{begin:12592,end:12687},{begin:43072,end:43135},{begin:12800,end:13055},{begin:13056,end:13311},{begin:44032,end:55215},{begin:55296,end:57343},{begin:67840,end:67871},{begin:19968,end:40959},{begin:57344,end:63743},{begin:12736,end:12783},{begin:64256,end:64335},{begin:64336,end:65023},{begin:65056,end:65071},{begin:65040,end:65055},{begin:65104,end:65135},{begin:65136,end:65279},{begin:65280,end:65519},{begin:65520,end:65535},{begin:3840,end:4095},{begin:1792,end:1871},{begin:1920,end:1983},{begin:3456,end:3583},{begin:4096,end:4255},{begin:4608,end:4991},{begin:5024,end:5119},{begin:5120,end:5759},{begin:5760,end:5791},{begin:5792,end:5887},{begin:6016,end:6143},{begin:6144,end:6319},{begin:10240,end:10495},{begin:40960,end:42127},{begin:5888,end:5919},{begin:66304,end:66351},{begin:66352,end:66383},{begin:66560,end:66639},{begin:118784,end:119039},{begin:119808,end:120831},{begin:1044480,end:1048573},{begin:65024,end:65039},{begin:917504,end:917631},{begin:6400,end:6479},{begin:6480,end:6527},{begin:6528,end:6623},{begin:6656,end:6687},{begin:11264,end:11359},{begin:11568,end:11647},{begin:19904,end:19967},{begin:43008,end:43055},{begin:65536,end:65663},{begin:65856,end:65935},{begin:66432,end:66463},{begin:66464,end:66527},{begin:66640,end:66687},{begin:66688,end:66735},{begin:67584,end:67647},{begin:68096,end:68191},{begin:119552,end:119647},{begin:73728,end:74751},{begin:119648,end:119679},{begin:7040,end:7103},{begin:7168,end:7247},{begin:7248,end:7295},{begin:43136,end:43231},{begin:43264,end:43311},{begin:43312,end:43359},{begin:43520,end:43615},{begin:65936,end:65999},{begin:66e3,end:66047},{begin:66208,end:66271},{begin:127024,end:127135}],lt={parse:function(e,t){var n={},a=new le.Parser(e,t);n.version=a.parseUShort(),n.xAvgCharWidth=a.parseShort(),n.usWeightClass=a.parseUShort(),n.usWidthClass=a.parseUShort(),n.fsType=a.parseUShort(),n.ySubscriptXSize=a.parseShort(),n.ySubscriptYSize=a.parseShort(),n.ySubscriptXOffset=a.parseShort(),n.ySubscriptYOffset=a.parseShort(),n.ySuperscriptXSize=a.parseShort(),n.ySuperscriptYSize=a.parseShort(),n.ySuperscriptXOffset=a.parseShort(),n.ySuperscriptYOffset=a.parseShort(),n.yStrikeoutSize=a.parseShort(),n.yStrikeoutPosition=a.parseShort(),n.sFamilyClass=a.parseShort(),n.panose=[];for(var o=0;o<10;o++)n.panose[o]=a.parseByte();return n.ulUnicodeRange1=a.parseULong(),n.ulUnicodeRange2=a.parseULong(),n.ulUnicodeRange3=a.parseULong(),n.ulUnicodeRange4=a.parseULong(),n.achVendID=String.fromCharCode(a.parseByte(),a.parseByte(),a.parseByte(),a.parseByte()),n.fsSelection=a.parseUShort(),n.usFirstCharIndex=a.parseUShort(),n.usLastCharIndex=a.parseUShort(),n.sTypoAscender=a.parseShort(),n.sTypoDescender=a.parseShort(),n.sTypoLineGap=a.parseShort(),n.usWinAscent=a.parseUShort(),n.usWinDescent=a.parseUShort(),n.version>=1&&(n.ulCodePageRange1=a.parseULong(),n.ulCodePageRange2=a.parseULong()),n.version>=2&&(n.sxHeight=a.parseShort(),n.sCapHeight=a.parseShort(),n.usDefaultChar=a.parseUShort(),n.usBreakChar=a.parseUShort(),n.usMaxContent=a.parseUShort()),n},make:function(e){return new ee.Table("OS/2",[{name:"version",type:"USHORT",value:3},{name:"xAvgCharWidth",type:"SHORT",value:0},{name:"usWeightClass",type:"USHORT",value:0},{name:"usWidthClass",type:"USHORT",value:0},{name:"fsType",type:"USHORT",value:0},{name:"ySubscriptXSize",type:"SHORT",value:650},{name:"ySubscriptYSize",type:"SHORT",value:699},{name:"ySubscriptXOffset",type:"SHORT",value:0},{name:"ySubscriptYOffset",type:"SHORT",value:140},{name:"ySuperscriptXSize",type:"SHORT",value:650},{name:"ySuperscriptYSize",type:"SHORT",value:699},{name:"ySuperscriptXOffset",type:"SHORT",value:0},{name:"ySuperscriptYOffset",type:"SHORT",value:479},{name:"yStrikeoutSize",type:"SHORT",value:49},{name:"yStrikeoutPosition",type:"SHORT",value:258},{name:"sFamilyClass",type:"SHORT",value:0},{name:"bFamilyType",type:"BYTE",value:0},{name:"bSerifStyle",type:"BYTE",value:0},{name:"bWeight",type:"BYTE",value:0},{name:"bProportion",type:"BYTE",value:0},{name:"bContrast",type:"BYTE",value:0},{name:"bStrokeVariation",type:"BYTE",value:0},{name:"bArmStyle",type:"BYTE",value:0},{name:"bLetterform",type:"BYTE",value:0},{name:"bMidline",type:"BYTE",value:0},{name:"bXHeight",type:"BYTE",value:0},{name:"ulUnicodeRange1",type:"ULONG",value:0},{name:"ulUnicodeRange2",type:"ULONG",value:0},{name:"ulUnicodeRange3",type:"ULONG",value:0},{name:"ulUnicodeRange4",type:"ULONG",value:0},{name:"achVendID",type:"CHARARRAY",value:"XXXX"},{name:"fsSelection",type:"USHORT",value:0},{name:"usFirstCharIndex",type:"USHORT",value:0},{name:"usLastCharIndex",type:"USHORT",value:0},{name:"sTypoAscender",type:"SHORT",value:0},{name:"sTypoDescender",type:"SHORT",value:0},{name:"sTypoLineGap",type:"SHORT",value:0},{name:"usWinAscent",type:"USHORT",value:0},{name:"usWinDescent",type:"USHORT",value:0},{name:"ulCodePageRange1",type:"ULONG",value:0},{name:"ulCodePageRange2",type:"ULONG",value:0},{name:"sxHeight",type:"SHORT",value:0},{name:"sCapHeight",type:"SHORT",value:0},{name:"usDefaultChar",type:"USHORT",value:0},{name:"usBreakChar",type:"USHORT",value:0},{name:"usMaxContext",type:"USHORT",value:0}],e)},unicodeRanges:st,getUnicodeRange:function(e){for(var t=0;t<st.length;t+=1){var n=st[t];if(e>=n.begin&&e<n.end)return t}return-1}},pt={parse:function(e,t){var n={},a=new le.Parser(e,t);switch(n.version=a.parseVersion(),n.italicAngle=a.parseFixed(),n.underlinePosition=a.parseShort(),n.underlineThickness=a.parseShort(),n.isFixedPitch=a.parseULong(),n.minMemType42=a.parseULong(),n.maxMemType42=a.parseULong(),n.minMemType1=a.parseULong(),n.maxMemType1=a.parseULong(),n.version){case 1:n.names=he.slice();break;case 2:n.numberOfGlyphs=a.parseUShort(),n.glyphNameIndex=new Array(n.numberOfGlyphs);for(var o=0;o<n.numberOfGlyphs;o++)n.glyphNameIndex[o]=a.parseUShort();n.names=[];for(var i=0;i<n.numberOfGlyphs;i++)if(n.glyphNameIndex[i]>=he.length){var r=a.parseChar();n.names.push(a.parseString(r))}break;case 2.5:n.numberOfGlyphs=a.parseUShort(),n.offset=new Array(n.numberOfGlyphs);for(var s=0;s<n.numberOfGlyphs;s++)n.offset[s]=a.parseChar()}return n},make:function(){return new ee.Table("post",[{name:"version",type:"FIXED",value:196608},{name:"italicAngle",type:"FIXED",value:0},{name:"underlinePosition",type:"FWORD",value:0},{name:"underlineThickness",type:"FWORD",value:0},{name:"isFixedPitch",type:"ULONG",value:0},{name:"minMemType42",type:"ULONG",value:0},{name:"maxMemType42",type:"ULONG",value:0},{name:"minMemType1",type:"ULONG",value:0},{name:"maxMemType1",type:"ULONG",value:0}])}},dt=new Array(9);dt[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();return 1===t?{substFormat:1,coverage:this.parsePointer(re.coverage),deltaGlyphId:this.parseUShort()}:2===t?{substFormat:2,coverage:this.parsePointer(re.coverage),substitute:this.parseOffset16List()}:void A.assert(!1,"0x"+e.toString(16)+": lookup type 1 format must be 1 or 2.")},dt[2]=function(){var e=this.parseUShort();return A.argument(1===e,"GSUB Multiple Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(re.coverage),sequences:this.parseListOfLists()}},dt[3]=function(){var e=this.parseUShort();return A.argument(1===e,"GSUB Alternate Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(re.coverage),alternateSets:this.parseListOfLists()}},dt[4]=function(){var e=this.parseUShort();return A.argument(1===e,"GSUB ligature table identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(re.coverage),ligatureSets:this.parseListOfLists(function(){return{ligGlyph:this.parseUShort(),components:this.parseUShortList(this.parseUShort()-1)}})}};var ct={sequenceIndex:re.uShort,lookupListIndex:re.uShort};dt[5]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();if(1===t)return{substFormat:t,coverage:this.parsePointer(re.coverage),ruleSets:this.parseListOfLists(function(){var e=this.parseUShort(),t=this.parseUShort();return{input:this.parseUShortList(e-1),lookupRecords:this.parseRecordList(t,ct)}})};if(2===t)return{substFormat:t,coverage:this.parsePointer(re.coverage),classDef:this.parsePointer(re.classDef),classSets:this.parseListOfLists(function(){var e=this.parseUShort(),t=this.parseUShort();return{classes:this.parseUShortList(e-1),lookupRecords:this.parseRecordList(t,ct)}})};if(3===t){var n=this.parseUShort(),a=this.parseUShort();return{substFormat:t,coverages:this.parseList(n,re.pointer(re.coverage)),lookupRecords:this.parseRecordList(a,ct)}}A.assert(!1,"0x"+e.toString(16)+": lookup type 5 format must be 1, 2 or 3.")},dt[6]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();return 1===t?{substFormat:1,coverage:this.parsePointer(re.coverage),chainRuleSets:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(ct)}})}:2===t?{substFormat:2,coverage:this.parsePointer(re.coverage),backtrackClassDef:this.parsePointer(re.classDef),inputClassDef:this.parsePointer(re.classDef),lookaheadClassDef:this.parsePointer(re.classDef),chainClassSet:this.parseListOfLists(function(){return{backtrack:this.parseUShortList(),input:this.parseUShortList(this.parseShort()-1),lookahead:this.parseUShortList(),lookupRecords:this.parseRecordList(ct)}})}:3===t?{substFormat:3,backtrackCoverage:this.parseList(re.pointer(re.coverage)),inputCoverage:this.parseList(re.pointer(re.coverage)),lookaheadCoverage:this.parseList(re.pointer(re.coverage)),lookupRecords:this.parseRecordList(ct)}:void A.assert(!1,"0x"+e.toString(16)+": lookup type 6 format must be 1, 2 or 3.")},dt[7]=function(){var e=this.parseUShort();A.argument(1===e,"GSUB Extension Substitution subtable identifier-format must be 1");var t=this.parseUShort(),n=new re(this.data,this.offset+this.parseULong());return{substFormat:1,lookupType:t,extension:dt[t].call(n)}},dt[8]=function(){var e=this.parseUShort();return A.argument(1===e,"GSUB Reverse Chaining Contextual Single Substitution Subtable identifier-format must be 1"),{substFormat:e,coverage:this.parsePointer(re.coverage),backtrackCoverage:this.parseList(re.pointer(re.coverage)),lookaheadCoverage:this.parseList(re.pointer(re.coverage)),substitutes:this.parseUShortList()}};var ut=new Array(9);ut[1]=function(e){return 1===e.substFormat?new ee.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ee.Coverage(e.coverage)},{name:"deltaGlyphID",type:"USHORT",value:e.deltaGlyphId}]):new ee.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:2},{name:"coverage",type:"TABLE",value:new ee.Coverage(e.coverage)}].concat(ee.ushortList("substitute",e.substitute)))},ut[3]=function(e){return A.assert(1===e.substFormat,"Lookup type 3 substFormat must be 1."),new ee.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ee.Coverage(e.coverage)}].concat(ee.tableList("altSet",e.alternateSets,function(e){return new ee.Table("alternateSetTable",ee.ushortList("alternate",e))})))},ut[4]=function(e){return A.assert(1===e.substFormat,"Lookup type 4 substFormat must be 1."),new ee.Table("substitutionTable",[{name:"substFormat",type:"USHORT",value:1},{name:"coverage",type:"TABLE",value:new ee.Coverage(e.coverage)}].concat(ee.tableList("ligSet",e.ligatureSets,function(e){return new ee.Table("ligatureSetTable",ee.tableList("ligature",e,function(e){return new ee.Table("ligatureTable",[{name:"ligGlyph",type:"USHORT",value:e.ligGlyph}].concat(ee.ushortList("component",e.components,e.components.length+1)))}))})))};var mt={parse:function(e,t){var n=new re(e,t=t||0),a=n.parseVersion(1);return A.argument(1===a||1.1===a,"Unsupported GSUB table version."),1===a?{version:a,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(dt)}:{version:a,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(dt),variations:n.parseFeatureVariationsList()}},make:function(e){return new ee.Table("GSUB",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new ee.ScriptList(e.scripts)},{name:"features",type:"TABLE",value:new ee.FeatureList(e.features)},{name:"lookups",type:"TABLE",value:new ee.LookupList(e.lookups,ut)}])}},ht={parse:function(e,t){var n=new le.Parser(e,t),a=n.parseULong();A.argument(1===a,"Unsupported META table version."),n.parseULong(),n.parseULong();for(var o=n.parseULong(),i={},r=0;r<o;r++){var s=n.parseTag(),l=n.parseULong(),p=n.parseULong(),d=D.UTF8(e,t+l,p);i[s]=d}return i},make:function(e){var t=Object.keys(e).length,n="",a=16+12*t,o=new ee.Table("meta",[{name:"version",type:"ULONG",value:1},{name:"flags",type:"ULONG",value:0},{name:"offset",type:"ULONG",value:a},{name:"numTags",type:"ULONG",value:t}]);for(var i in e){var r=n.length;n+=e[i],o.fields.push({name:"tag "+i,type:"TAG",value:i}),o.fields.push({name:"offset "+i,type:"ULONG",value:a+r}),o.fields.push({name:"length "+i,type:"ULONG",value:e[i].length})}return o.fields.push({name:"stringPool",type:"CHARARRAY",value:n}),o}};function ft(e){return Math.log(e)/Math.log(2)|0}function gt(e){for(;e.length%4!=0;)e.push(0);for(var t=0,n=0;n<e.length;n+=4)t+=(e[n]<<24)+(e[n+1]<<16)+(e[n+2]<<8)+e[n+3];return t%=Math.pow(2,32)}function yt(e,t,n,a){return new ee.Record("Table Record",[{name:"tag",type:"TAG",value:void 0!==e?e:""},{name:"checkSum",type:"ULONG",value:void 0!==t?t:0},{name:"offset",type:"ULONG",value:void 0!==n?n:0},{name:"length",type:"ULONG",value:void 0!==a?a:0}])}function vt(e){var t=new ee.Table("sfnt",[{name:"version",type:"TAG",value:"OTTO"},{name:"numTables",type:"USHORT",value:0},{name:"searchRange",type:"USHORT",value:0},{name:"entrySelector",type:"USHORT",value:0},{name:"rangeShift",type:"USHORT",value:0}]);t.tables=e,t.numTables=e.length;var n=Math.pow(2,ft(t.numTables));t.searchRange=16*n,t.entrySelector=ft(n),t.rangeShift=16*t.numTables-t.searchRange;for(var a=[],o=[],i=t.sizeOf()+yt().sizeOf()*t.numTables;i%4!=0;)i+=1,o.push({name:"padding",type:"BYTE",value:0});for(var r=0;r<e.length;r+=1){var s=e[r];A.argument(4===s.tableName.length,"Table name"+s.tableName+" is invalid.");var l=s.sizeOf(),p=yt(s.tableName,gt(s.encode()),i,l);for(a.push({name:p.tag+" Table Record",type:"RECORD",value:p}),o.push({name:s.tableName+" table",type:"RECORD",value:s}),i+=l,A.argument(!isNaN(i),"Something went wrong calculating the offset.");i%4!=0;)i+=1,o.push({name:"padding",type:"BYTE",value:0})}return a.sort(function(e,t){return e.value.tag>t.value.tag?1:-1}),t.fields=t.fields.concat(a),t.fields=t.fields.concat(o),t}function bt(e,t,n){for(var a=0;a<t.length;a+=1){var o=e.charToGlyphIndex(t[a]);if(o>0)return e.glyphs.get(o).getMetrics()}return n}function wt(e){for(var t=0,n=0;n<e.length;n+=1)t+=e[n];return t/e.length}var xt={make:vt,fontToTable:function(e){for(var t,n=[],a=[],o=[],i=[],r=[],s=[],l=[],p=0,d=0,c=0,u=0,m=0,h=0;h<e.glyphs.length;h+=1){var f=e.glyphs.get(h),g=0|f.unicode;if(isNaN(f.advanceWidth))throw new Error("Glyph "+f.name+" ("+h+"): advanceWidth is not a number.");(t>g||void 0===t)&&g>0&&(t=g),p<g&&(p=g);var y=lt.getUnicodeRange(g);if(y<32)d|=1<<y;else if(y<64)c|=1<<y-32;else if(y<96)u|=1<<y-64;else{if(!(y<123))throw new Error("Unicode ranges bits > 123 are reserved for internal usage");m|=1<<y-96}if(".notdef"!==f.name){var v=f.getMetrics();n.push(v.xMin),a.push(v.yMin),o.push(v.xMax),i.push(v.yMax),s.push(v.leftSideBearing),l.push(v.rightSideBearing),r.push(f.advanceWidth)}}var b={xMin:Math.min.apply(null,n),yMin:Math.min.apply(null,a),xMax:Math.max.apply(null,o),yMax:Math.max.apply(null,i),advanceWidthMax:Math.max.apply(null,r),advanceWidthAvg:wt(r),minLeftSideBearing:Math.min.apply(null,s),maxLeftSideBearing:Math.max.apply(null,s),minRightSideBearing:Math.min.apply(null,l)};b.ascender=e.ascender,b.descender=e.descender;var w=qe.make({flags:3,unitsPerEm:e.unitsPerEm,xMin:b.xMin,yMin:b.yMin,xMax:b.xMax,yMax:b.yMax,lowestRecPPEM:3,createdTimestamp:e.createdTimestamp}),x=Ve.make({ascender:b.ascender,descender:b.descender,advanceWidthMax:b.advanceWidthMax,minLeftSideBearing:b.minLeftSideBearing,minRightSideBearing:b.minRightSideBearing,xMaxExtent:b.maxLeftSideBearing+(b.xMax-b.xMin),numberOfHMetrics:e.glyphs.length}),S=He.make(e.glyphs.length),k=lt.make({xAvgCharWidth:Math.round(b.advanceWidthAvg),usWeightClass:e.tables.os2.usWeightClass,usWidthClass:e.tables.os2.usWidthClass,usFirstCharIndex:t,usLastCharIndex:p,ulUnicodeRange1:d,ulUnicodeRange2:c,ulUnicodeRange3:u,ulUnicodeRange4:m,fsSelection:e.tables.os2.fsSelection,sTypoAscender:b.ascender,sTypoDescender:b.descender,sTypoLineGap:0,usWinAscent:b.yMax,usWinDescent:Math.abs(b.yMin),ulCodePageRange1:1,sxHeight:bt(e,"xyvw",{yMax:Math.round(b.ascender/2)}).yMax,sCapHeight:bt(e,"HIKLEFJMNTZBDPRAGOQSUVWXY",b).yMax,usDefaultChar:e.hasChar(" ")?32:0,usBreakChar:e.hasChar(" ")?32:0}),T=We.make(e.glyphs),C=de.make(e.glyphs),_=e.getEnglishName("fontFamily"),E=e.getEnglishName("fontSubfamily"),M=_+" "+E,j=e.getEnglishName("postScriptName");j||(j=_.replace(/\s/g,"")+"-"+E);var I={};for(var R in e.names)I[R]=e.names[R];I.uniqueID||(I.uniqueID={en:e.getEnglishName("manufacturer")+":"+M}),I.postScriptName||(I.postScriptName={en:j}),I.preferredFamily||(I.preferredFamily=e.names.fontFamily),I.preferredSubfamily||(I.preferredSubfamily=e.names.fontSubfamily);var N=[],A=rt.make(I,N),D=N.length>0?Xe.make(N):void 0,L=pt.make(),P=ze.make(e.glyphs,{version:e.getEnglishName("version"),fullName:M,familyName:_,weightName:E,postScriptName:j,unitsPerEm:e.unitsPerEm,fontBBox:[0,b.yMin,b.ascender,b.advanceWidthMax]}),O=e.metas&&Object.keys(e.metas).length>0?ht.make(e.metas):void 0,F=[w,x,S,k,A,C,L,P,T];D&&F.push(D),e.tables.gsub&&F.push(mt.make(e.tables.gsub)),O&&F.push(O);for(var B=vt(F),G=gt(B.encode()),U=B.fields,z=!1,q=0;q<U.length;q+=1)if("head table"===U[q].name){U[q].value.checkSumAdjustment=2981146554-G,z=!0;break}if(!z)throw new Error("Could not find head table with checkSum to adjust.");return B},computeCheckSum:gt};function St(e,t){for(var n=0,a=e.length-1;n<=a;){var o=n+a>>>1,i=e[o].tag;if(i===t)return o;i<t?n=o+1:a=o-1}return-n-1}function kt(e,t){for(var n=0,a=e.length-1;n<=a;){var o=n+a>>>1,i=e[o];if(i===t)return o;i<t?n=o+1:a=o-1}return-n-1}function Tt(e,t){for(var n,a=0,o=e.length-1;a<=o;){var i=a+o>>>1,r=(n=e[i]).start;if(r===t)return n;r<t?a=i+1:o=i-1}if(a>0)return t>(n=e[a-1]).end?0:n}function Ct(e,t){this.font=e,this.tableName=t}function _t(e){Ct.call(this,e,"gpos")}function Et(e){Ct.call(this,e,"gsub")}function Mt(e,t){var n=e.length;if(n!==t.length)return!1;for(var a=0;a<n;a++)if(e[a]!==t[a])return!1;return!0}function jt(e,t,n){for(var a=e.subtables,o=0;o<a.length;o++){var i=a[o];if(i.substFormat===t)return i}if(n)return a.push(n),n}function It(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),a=0;a<e.length;++a)n[a]=e[a];return t}function Rt(e,t){if(!e)throw t}function Nt(e,t,n,a,o){var i;return(t&a)>0?(i=e.parseByte(),0==(t&o)&&(i=-i),i=n+i):i=(t&o)>0?n:n+e.parseShort(),i}function At(e,t,n){var a,o,i=new le.Parser(t,n);if(e.numberOfContours=i.parseShort(),e._xMin=i.parseShort(),e._yMin=i.parseShort(),e._xMax=i.parseShort(),e._yMax=i.parseShort(),e.numberOfContours>0){for(var r=e.endPointIndices=[],s=0;s<e.numberOfContours;s+=1)r.push(i.parseUShort());e.instructionLength=i.parseUShort(),e.instructions=[];for(var l=0;l<e.instructionLength;l+=1)e.instructions.push(i.parseByte());var p=r[r.length-1]+1;a=[];for(var d=0;d<p;d+=1)if(o=i.parseByte(),a.push(o),(8&o)>0)for(var c=i.parseByte(),u=0;u<c;u+=1)a.push(o),d+=1;if(A.argument(a.length===p,"Bad flags."),r.length>0){var m,h=[];if(p>0){for(var f=0;f<p;f+=1)o=a[f],(m={}).onCurve=!!(1&o),m.lastPointOfContour=r.indexOf(f)>=0,h.push(m);for(var g=0,y=0;y<p;y+=1)o=a[y],(m=h[y]).x=Nt(i,o,g,2,16),g=m.x;for(var v=0,b=0;b<p;b+=1)o=a[b],(m=h[b]).y=Nt(i,o,v,4,32),v=m.y}e.points=h}else e.points=[]}else if(0===e.numberOfContours)e.points=[];else{e.isComposite=!0,e.points=[],e.components=[];for(var w=!0;w;){a=i.parseUShort();var x={glyphIndex:i.parseUShort(),xScale:1,scale01:0,scale10:0,yScale:1,dx:0,dy:0};(1&a)>0?(2&a)>0?(x.dx=i.parseShort(),x.dy=i.parseShort()):x.matchedPoints=[i.parseUShort(),i.parseUShort()]:(2&a)>0?(x.dx=i.parseChar(),x.dy=i.parseChar()):x.matchedPoints=[i.parseByte(),i.parseByte()],(8&a)>0?x.xScale=x.yScale=i.parseF2Dot14():(64&a)>0?(x.xScale=i.parseF2Dot14(),x.yScale=i.parseF2Dot14()):(128&a)>0&&(x.xScale=i.parseF2Dot14(),x.scale01=i.parseF2Dot14(),x.scale10=i.parseF2Dot14(),x.yScale=i.parseF2Dot14()),e.components.push(x),w=!!(32&a)}if(256&a){e.instructionLength=i.parseUShort(),e.instructions=[];for(var S=0;S<e.instructionLength;S+=1)e.instructions.push(i.parseByte())}}}function Dt(e,t){for(var n=[],a=0;a<e.length;a+=1){var o=e[a],i={x:t.xScale*o.x+t.scale01*o.y+t.dx,y:t.scale10*o.x+t.yScale*o.y+t.dy,onCurve:o.onCurve,lastPointOfContour:o.lastPointOfContour};n.push(i)}return n}function Lt(e){var t=new I;if(!e)return t;for(var n=function(e){for(var t=[],n=[],a=0;a<e.length;a+=1){var o=e[a];n.push(o),o.lastPointOfContour&&(t.push(n),n=[])}return A.argument(0===n.length,"There are still points left in the current contour."),t}(e),a=0;a<n.length;++a){var o=n[a],i=null,r=o[o.length-1],s=o[0];if(r.onCurve)t.moveTo(r.x,r.y);else if(s.onCurve)t.moveTo(s.x,s.y);else{var l={x:.5*(r.x+s.x),y:.5*(r.y+s.y)};t.moveTo(l.x,l.y)}for(var p=0;p<o.length;++p)if(i=r,r=s,s=o[(p+1)%o.length],r.onCurve)t.lineTo(r.x,r.y);else{var d=s;i.onCurve||{x:.5*(r.x+i.x),y:.5*(r.y+i.y)},s.onCurve||(d={x:.5*(r.x+s.x),y:.5*(r.y+s.y)}),t.quadraticCurveTo(r.x,r.y,d.x,d.y)}t.closePath()}return t}function Pt(e,t){if(t.isComposite)for(var n=0;n<t.components.length;n+=1){var a=t.components[n],o=e.get(a.glyphIndex);if(o.getPath(),o.points){var i=void 0;if(void 0===a.matchedPoints)i=Dt(o.points,a);else{if(a.matchedPoints[0]>t.points.length-1||a.matchedPoints[1]>o.points.length-1)throw Error("Matched points out of range in "+t.name);var r=t.points[a.matchedPoints[0]],s=o.points[a.matchedPoints[1]],l={xScale:a.xScale,scale01:a.scale01,scale10:a.scale10,yScale:a.yScale,dx:0,dy:0};s=Dt([s],l)[0],l.dx=r.x-s.x,l.dy=r.y-s.y,i=Dt(o.points,l)}t.points=t.points.concat(i)}}return Lt(t.points)}Ct.prototype={searchTag:St,binSearch:kt,getTable:function(e){var t=this.font.tables[this.tableName];return!t&&e&&(t=this.font.tables[this.tableName]=this.createDefaultTable()),t},getScriptNames:function(){var e=this.getTable();return e?e.scripts.map(function(e){return e.tag}):[]},getDefaultScriptName:function(){var e=this.getTable();if(e){for(var t=!1,n=0;n<e.scripts.length;n++){var a=e.scripts[n].tag;if("DFLT"===a)return a;"latn"===a&&(t=!0)}return t?"latn":void 0}},getScriptTable:function(e,t){var n=this.getTable(t);if(n){e=e||"DFLT";var a=n.scripts,o=St(n.scripts,e);if(o>=0)return a[o].script;if(t){var i={tag:e,script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}};return a.splice(-1-o,0,i),i.script}}},getLangSysTable:function(e,t,n){var a=this.getScriptTable(e,n);if(a){if(!t||"dflt"===t||"DFLT"===t)return a.defaultLangSys;var o=St(a.langSysRecords,t);if(o>=0)return a.langSysRecords[o].langSys;if(n){var i={tag:t,langSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]}};return a.langSysRecords.splice(-1-o,0,i),i.langSys}}},getFeatureTable:function(e,t,n,a){var o=this.getLangSysTable(e,t,a);if(o){for(var i,r=o.featureIndexes,s=this.font.tables[this.tableName].features,l=0;l<r.length;l++)if((i=s[r[l]]).tag===n)return i.feature;if(a){var p=s.length;return A.assert(0===p||n>=s[p-1].tag,"Features must be added in alphabetical order."),i={tag:n,feature:{params:0,lookupListIndexes:[]}},s.push(i),r.push(p),i.feature}}},getLookupTables:function(e,t,n,a,o){var i=this.getFeatureTable(e,t,n,o),r=[];if(i){for(var s,l=i.lookupListIndexes,p=this.font.tables[this.tableName].lookups,d=0;d<l.length;d++)(s=p[l[d]]).lookupType===a&&r.push(s);if(0===r.length&&o){s={lookupType:a,lookupFlag:0,subtables:[],markFilteringSet:void 0};var c=p.length;return p.push(s),l.push(c),[s]}}return r},getGlyphClass:function(e,t){switch(e.format){case 1:return e.startGlyph<=t&&t<e.startGlyph+e.classes.length?e.classes[t-e.startGlyph]:0;case 2:var n=Tt(e.ranges,t);return n?n.classId:0}},getCoverageIndex:function(e,t){switch(e.format){case 1:var n=kt(e.glyphs,t);return n>=0?n:-1;case 2:var a=Tt(e.ranges,t);return a?a.index+t-a.start:-1}},expandCoverage:function(e){if(1===e.format)return e.glyphs;for(var t=[],n=e.ranges,a=0;a<n.length;a++)for(var o=n[a],i=o.start,r=o.end,s=i;s<=r;s++)t.push(s);return t}},_t.prototype=Ct.prototype,_t.prototype.init=function(){var e=this.getDefaultScriptName();this.defaultKerningTables=this.getKerningTables(e)},_t.prototype.getKerningValue=function(e,t,n){for(var a=0;a<e.length;a++)for(var o=e[a].subtables,i=0;i<o.length;i++){var r=o[i],s=this.getCoverageIndex(r.coverage,t);if(!(s<0))switch(r.posFormat){case 1:for(var l=r.pairSets[s],p=0;p<l.length;p++){var d=l[p];if(d.secondGlyph===n)return d.value1&&d.value1.xAdvance||0}break;case 2:var c=this.getGlyphClass(r.classDef1,t),u=this.getGlyphClass(r.classDef2,n),m=r.classRecords[c][u];return m.value1&&m.value1.xAdvance||0}}return 0},_t.prototype.getKerningTables=function(e,t){if(this.font.tables.gpos)return this.getLookupTables(e,t,"kern",2)},Et.prototype=Ct.prototype,Et.prototype.createDefaultTable=function(){return{version:1,scripts:[{tag:"DFLT",script:{defaultLangSys:{reserved:0,reqFeatureIndex:65535,featureIndexes:[]},langSysRecords:[]}}],features:[],lookups:[]}},Et.prototype.getSingle=function(e,t,n){for(var a=[],o=this.getLookupTables(t,n,e,1),i=0;i<o.length;i++)for(var r=o[i].subtables,s=0;s<r.length;s++){var l=r[s],p=this.expandCoverage(l.coverage),d=void 0;if(1===l.substFormat){var c=l.deltaGlyphId;for(d=0;d<p.length;d++){var u=p[d];a.push({sub:u,by:u+c})}}else{var m=l.substitute;for(d=0;d<p.length;d++)a.push({sub:p[d],by:m[d]})}}return a},Et.prototype.getAlternates=function(e,t,n){for(var a=[],o=this.getLookupTables(t,n,e,3),i=0;i<o.length;i++)for(var r=o[i].subtables,s=0;s<r.length;s++)for(var l=r[s],p=this.expandCoverage(l.coverage),d=l.alternateSets,c=0;c<p.length;c++)a.push({sub:p[c],by:d[c]});return a},Et.prototype.getLigatures=function(e,t,n){for(var a=[],o=this.getLookupTables(t,n,e,4),i=0;i<o.length;i++)for(var r=o[i].subtables,s=0;s<r.length;s++)for(var l=r[s],p=this.expandCoverage(l.coverage),d=l.ligatureSets,c=0;c<p.length;c++)for(var u=p[c],m=d[c],h=0;h<m.length;h++){var f=m[h];a.push({sub:[u].concat(f.components),by:f.ligGlyph})}return a},Et.prototype.addSingle=function(e,t,n,a){var o=jt(this.getLookupTables(n,a,e,1,!0)[0],2,{substFormat:2,coverage:{format:1,glyphs:[]},substitute:[]});A.assert(1===o.coverage.format,"Ligature: unable to modify coverage table format "+o.coverage.format);var i=t.sub,r=this.binSearch(o.coverage.glyphs,i);r<0&&(r=-1-r,o.coverage.glyphs.splice(r,0,i),o.substitute.splice(r,0,0)),o.substitute[r]=t.by},Et.prototype.addAlternate=function(e,t,n,a){var o=jt(this.getLookupTables(n,a,e,3,!0)[0],1,{substFormat:1,coverage:{format:1,glyphs:[]},alternateSets:[]});A.assert(1===o.coverage.format,"Ligature: unable to modify coverage table format "+o.coverage.format);var i=t.sub,r=this.binSearch(o.coverage.glyphs,i);r<0&&(r=-1-r,o.coverage.glyphs.splice(r,0,i),o.alternateSets.splice(r,0,0)),o.alternateSets[r]=t.by},Et.prototype.addLigature=function(e,t,n,a){var o=this.getLookupTables(n,a,e,4,!0)[0],i=o.subtables[0];i||(i={substFormat:1,coverage:{format:1,glyphs:[]},ligatureSets:[]},o.subtables[0]=i),A.assert(1===i.coverage.format,"Ligature: unable to modify coverage table format "+i.coverage.format);var r=t.sub[0],s=t.sub.slice(1),l={ligGlyph:t.by,components:s},p=this.binSearch(i.coverage.glyphs,r);if(p>=0){for(var d=i.ligatureSets[p],c=0;c<d.length;
21c++)if(Mt(d[c].components,s))return;d.push(l)}else p=-1-p,i.coverage.glyphs.splice(p,0,r),i.ligatureSets.splice(p,0,[l])},Et.prototype.getFeature=function(e,t,n){if(/ss\d\d/.test(e))return this.getSingle(e,t,n);switch(e){case"aalt":case"salt":return this.getSingle(e,t,n).concat(this.getAlternates(e,t,n));case"dlig":case"liga":case"rlig":return this.getLigatures(e,t,n)}},Et.prototype.add=function(e,t,n,a){if(/ss\d\d/.test(e))return this.addSingle(e,t,n,a);switch(e){case"aalt":case"salt":return"number"==typeof t.by?this.addSingle(e,t,n,a):this.addAlternate(e,t,n,a);case"dlig":case"liga":case"rlig":return this.addLigature(e,t,n,a)}};var Ot,Ft,Bt,Gt,Ut={getPath:Lt,parse:function(e,t,n,a){for(var o=new ke.GlyphSet(a),i=0;i<n.length-1;i+=1){var r=n[i];r!==n[i+1]?o.push(i,ke.ttfGlyphLoader(a,i,At,e,t+r,Pt)):o.push(i,ke.glyphLoader(a,i))}return o}};function zt(e){this.font=e,this.getCommands=function(e){return Ut.getPath(e).commands},this._fpgmState=this._prepState=void 0,this._errorState=0}function qt(e){return e}function Vt(e){return Math.sign(e)*Math.round(Math.abs(e))}function Wt(e){return Math.sign(e)*Math.round(Math.abs(2*e))/2}function Xt(e){return Math.sign(e)*(Math.round(Math.abs(e)+.5)-.5)}function Ht(e){return Math.sign(e)*Math.ceil(Math.abs(e))}function Yt(e){return Math.sign(e)*Math.floor(Math.abs(e))}var Zt=function(e){var t=this.srPeriod,n=this.srPhase,a=1;return e<0&&(e=-e,a=-1),e+=this.srThreshold-n,e=Math.trunc(e/t)*t,(e+=n)<0?n*a:e*a},Jt={x:1,y:0,axis:"x",distance:function(e,t,n,a){return(n?e.xo:e.x)-(a?t.xo:t.x)},interpolate:function(e,t,n,a){var o,i,r,s,l,p,d;if(!a||a===this)return o=e.xo-t.xo,i=e.xo-n.xo,l=t.x-t.xo,p=n.x-n.xo,0===(d=(r=Math.abs(o))+(s=Math.abs(i)))?void(e.x=e.xo+(l+p)/2):void(e.x=e.xo+(l*s+p*r)/d);o=a.distance(e,t,!0,!0),i=a.distance(e,n,!0,!0),l=a.distance(t,t,!1,!0),p=a.distance(n,n,!1,!0),0!==(d=(r=Math.abs(o))+(s=Math.abs(i)))?Jt.setRelative(e,e,(l*s+p*r)/d,a,!0):Jt.setRelative(e,e,(l+p)/2,a,!0)},normalSlope:Number.NEGATIVE_INFINITY,setRelative:function(e,t,n,a,o){if(a&&a!==this){var i=o?t.xo:t.x,r=o?t.yo:t.y,s=i+n*a.x,l=r+n*a.y;e.x=s+(e.y-l)/a.normalSlope}else e.x=(o?t.xo:t.x)+n},slope:0,touch:function(e){e.xTouched=!0},touched:function(e){return e.xTouched},untouch:function(e){e.xTouched=!1}},Qt={x:0,y:1,axis:"y",distance:function(e,t,n,a){return(n?e.yo:e.y)-(a?t.yo:t.y)},interpolate:function(e,t,n,a){var o,i,r,s,l,p,d;if(!a||a===this)return o=e.yo-t.yo,i=e.yo-n.yo,l=t.y-t.yo,p=n.y-n.yo,0===(d=(r=Math.abs(o))+(s=Math.abs(i)))?void(e.y=e.yo+(l+p)/2):void(e.y=e.yo+(l*s+p*r)/d);o=a.distance(e,t,!0,!0),i=a.distance(e,n,!0,!0),l=a.distance(t,t,!1,!0),p=a.distance(n,n,!1,!0),0!==(d=(r=Math.abs(o))+(s=Math.abs(i)))?Qt.setRelative(e,e,(l*s+p*r)/d,a,!0):Qt.setRelative(e,e,(l+p)/2,a,!0)},normalSlope:0,setRelative:function(e,t,n,a,o){if(a&&a!==this){var i=o?t.xo:t.x,r=o?t.yo:t.y,s=i+n*a.x,l=r+n*a.y;e.y=l+a.normalSlope*(e.x-s)}else e.y=(o?t.yo:t.y)+n},slope:Number.POSITIVE_INFINITY,touch:function(e){e.yTouched=!0},touched:function(e){return e.yTouched},untouch:function(e){e.yTouched=!1}};function Kt(e,t){this.x=e,this.y=t,this.axis=void 0,this.slope=t/e,this.normalSlope=-e/t,Object.freeze(this)}function $t(e,t){var n=Math.sqrt(e*e+t*t);return t/=n,1===(e/=n)&&0===t?Jt:0===e&&1===t?Qt:new Kt(e,t)}function en(e,t,n,a){this.x=this.xo=Math.round(64*e)/64,this.y=this.yo=Math.round(64*t)/64,this.lastPointOfContour=n,this.onCurve=a,this.prevPointOnContour=void 0,this.nextPointOnContour=void 0,this.xTouched=!1,this.yTouched=!1,Object.preventExtensions(this)}Object.freeze(Jt),Object.freeze(Qt),Kt.prototype.distance=function(e,t,n,a){return this.x*Jt.distance(e,t,n,a)+this.y*Qt.distance(e,t,n,a)},Kt.prototype.interpolate=function(e,t,n,a){var o,i,r,s,l,p,d;r=a.distance(e,t,!0,!0),s=a.distance(e,n,!0,!0),o=a.distance(t,t,!1,!0),i=a.distance(n,n,!1,!0),0!==(d=(l=Math.abs(r))+(p=Math.abs(s)))?this.setRelative(e,e,(o*p+i*l)/d,a,!0):this.setRelative(e,e,(o+i)/2,a,!0)},Kt.prototype.setRelative=function(e,t,n,a,o){a=a||this;var i=o?t.xo:t.x,r=o?t.yo:t.y,s=i+n*a.x,l=r+n*a.y,p=a.normalSlope,d=this.slope,c=e.x,u=e.y;e.x=(d*c-p*s+l-u)/(d-p),e.y=d*(e.x-c)+u},Kt.prototype.touch=function(e){e.xTouched=!0,e.yTouched=!0},en.prototype.nextTouched=function(e){for(var t=this.nextPointOnContour;!e.touched(t)&&t!==this;)t=t.nextPointOnContour;return t},en.prototype.prevTouched=function(e){for(var t=this.prevPointOnContour;!e.touched(t)&&t!==this;)t=t.prevPointOnContour;return t};var tn=Object.freeze(new en(0,0)),nn={cvCutIn:17/16,deltaBase:9,deltaShift:.125,loop:1,minDis:1,autoFlip:!0};function an(e,t){switch(this.env=e,this.stack=[],this.prog=t,e){case"glyf":this.zp0=this.zp1=this.zp2=1,this.rp0=this.rp1=this.rp2=0;case"prep":this.fv=this.pv=this.dpv=Jt,this.round=Vt}}function on(e){for(var t=e.tZone=new Array(e.gZone.length),n=0;n<t.length;n++)t[n]=new en(0,0)}function rn(e,t){var n,a=e.prog,o=e.ip,i=1;do{if(88===(n=a[++o]))i++;else if(89===n)i--;else if(64===n)o+=a[o+1]+1;else if(65===n)o+=2*a[o+1]+1;else if(n>=176&&n<=183)o+=n-176+1;else if(n>=184&&n<=191)o+=2*(n-184+1);else if(t&&1===i&&27===n)break}while(i>0);e.ip=o}function sn(e,n){t.DEBUG&&console.log(n.step,"SVTCA["+e.axis+"]"),n.fv=n.pv=n.dpv=e}function ln(e,n){t.DEBUG&&console.log(n.step,"SPVTCA["+e.axis+"]"),n.pv=n.dpv=e}function pn(e,n){t.DEBUG&&console.log(n.step,"SFVTCA["+e.axis+"]"),n.fv=e}function dn(e,n){var a,o,i=n.stack,r=i.pop(),s=i.pop(),l=n.z2[r],p=n.z1[s];t.DEBUG&&console.log("SPVTL["+e+"]",r,s),e?(a=l.y-p.y,o=p.x-l.x):(a=p.x-l.x,o=p.y-l.y),n.pv=n.dpv=$t(a,o)}function cn(e,n){var a,o,i=n.stack,r=i.pop(),s=i.pop(),l=n.z2[r],p=n.z1[s];t.DEBUG&&console.log("SFVTL["+e+"]",r,s),e?(a=l.y-p.y,o=p.x-l.x):(a=p.x-l.x,o=p.y-l.y),n.fv=$t(a,o)}function un(e){t.DEBUG&&console.log(e.step,"POP[]"),e.stack.pop()}function mn(e,n){var a=n.stack.pop(),o=n.z0[a],i=n.fv,r=n.pv;t.DEBUG&&console.log(n.step,"MDAP["+e+"]",a);var s=r.distance(o,tn);e&&(s=n.round(s)),i.setRelative(o,tn,s,r),i.touch(o),n.rp0=n.rp1=a}function hn(e,n){var a,o,i,r=n.z2,s=r.length-2;t.DEBUG&&console.log(n.step,"IUP["+e.axis+"]");for(var l=0;l<s;l++)a=r[l],e.touched(a)||(o=a.prevTouched(e))!==a&&(o===(i=a.nextTouched(e))&&e.setRelative(a,a,e.distance(o,o,!1,!0),e,!0),e.interpolate(a,o,i,e))}function fn(e,n){for(var a=n.stack,o=e?n.rp1:n.rp2,i=(e?n.z0:n.z1)[o],r
vendor: 4,627 bytes, line 21
21=n.fv,s=n.pv,l=n.loop,p=n.z2;l--;){var d=a.pop(),c=p[d],u=s.distance(i,i,!1,!0);r.setRelative(c,c,u,s),r.touch(c),t.DEBUG&&console.log(n.step,(n.loop>1?"loop "+(n.loop-l)+": ":"")+"SHP["+(e?"rp1":"rp2")+"]",d)}n.loop=1}function gn(e,n){var a=n.stack,o=e?n.rp1:n.rp2,i=(e?n.z0:n.z1)[o],r=n.fv,s=n.pv,l=a.pop(),p=n.z2[n.contours[l]],d=p;t.DEBUG&&console.log(n.step,"SHC["+e+"]",l);var c=s.distance(i,i,!1,!0);do{d!==i&&r.setRelative(d,d,c,s),d=d.nextPointOnContour}while(d!==p)}function yn(e,n){var a,o,i=n.stack,r=e?n.rp1:n.rp2,s=(e?n.z0:n.z1)[r],l=n.fv,p=n.pv,d=i.pop();switch(t.DEBUG&&console.log(n.step,"SHZ["+e+"]",d),d){case 0:a=n.tZone;break;case 1:a=n.gZone;break;default:throw new Error("Invalid zone")}for(var c=p.distance(s,s,!1,!0),u=a.length-2,m=0;m<u;m++)o=a[m],l.setRelative(o,o,c,p)}function vn(e,n){var a=n.stack,o=a.pop()/64,i=a.pop(),r=n.z1[i],s=n.z0[n.rp0],l=n.fv,p=n.pv;l.setRelative(r,s,o,p),l.touch(r),t.DEBUG&&console.log(n.step,"MSIRP["+e+"]",o,i),n.rp1=n.rp0,n.rp2=i,e&&(n.rp0=i)}function bn(e,n){var a=n.stack,o=a.pop(),i=a.pop(),r=n.z0[i],s=n.fv,l=n.pv,p=n.cvt[o];t.DEBUG&&console.log(n.step,"MIAP["+e+"]",o,"(",p,")",i);var d=l.distance(r,tn);e&&(Math.abs(d-p)<n.cvCutIn&&(d=p),d=n.round(d)),s.setRelative(r,tn,d,l),0===n.zp0&&(r.xo=r.x,r.yo=r.y),s.touch(r),n.rp0=n.rp1=i}function wn(e,n){var a=n.stack,o=a.pop(),i=n.z2[o];t.DEBUG&&console.log(n.step,"GC["+e+"]",o),a.push(64*n.dpv.distance(i,tn,e,!1))}function xn(e,n){var a=n.stack,o=a.pop(),i=a.pop(),r=n.z1[o],s=n.z0[i],l=n.dpv.distance(s,r,e,e);t.DEBUG&&console.log(n.step,"MD["+e+"]",o,i,"->",l),n.stack.push(Math.round(64*l))}function Sn(e,n){var a=n.stack,o=a.pop(),i=n.fv,r=n.pv,s=n.ppem,l=n.deltaBase+16*(e-1),p=n.deltaShift,d=n.z0;t.DEBUG&&console.log(n.step,"DELTAP["+e+"]",o,a);for(var c=0;c<o;c++){var u=a.pop(),m=a.pop();if(l+((240&m)>>4)===s){var h=(15&m)-8;h>=0&&h++,t.DEBUG&&console.log(n.step,"DELTAPFIX",u,"by",h*p);var f=d[u];i.setRelative(f,f,h*p,r)}}}function kn(e,n){var a=n.stack,o=a.pop();t.DEBUG&&console.log(n.step,"ROUND[]"),a.push(64*n.round(o/64))}function Tn(e,n){var a=n.stack,o=a.pop(),i=n.ppem,r=n.deltaBase+16*(e-1),s=n.deltaShift;t.DEBUG&&console.log(n.step,"DELTAC["+e+"]",o,a);for(var l=0;l<o;l++){var p=a.pop(),d=a.pop();if(r+((240&d)>>4)===i){var c=(15&d)-8;c>=0&&c++;var u=c*s;t.DEBUG&&console.log(n.step,"DELTACFIX",p,"by",u),n.cvt[p]+=u}}}function Cn(e,n){var a,o,i=n.stack,r=i.pop(),s=i.pop(),l=n.z2[r],p=n.z1[s];t.DEBUG&&console.log(n.step,"SDPVTL["+e+"]",r,s),e?(a=l.y-p.y,o=p.x-l.x):(a=p.x-l.x,o=p.y-l.y),n.dpv=$t(a,o)}function _n(e,n){var a=n.stack,o=n.prog,i=n.ip;t.DEBUG&&console.log(n.step,"PUSHB["+e+"]");for(var r=0;r<e;r++)a.push(o[++i]);n.ip=i}function En(e,n){var a=n.ip,o=n.prog,i=n.stack;t.DEBUG&&console.log(n.ip,"PUSHW["+e+"]");for(var r=0;r<e;r++){var s=o[++a]<<8|o[++a];32768&s&&(s=-(1+(65535^s))),i.push(s)}n.ip=a}function Mn(e,n,a,o,i,r){var s,l,p,d,c=r.stack,u=e&&c.pop(),m=c.pop(),h=r.rp0,f=r.z0[h],g=r.z1[m],y=r.minDis,v=r.fv,b=r.dpv;p=(l=s=b.distance(g,f,!0,!0))>=0?1:-1,l=Math.abs(l),e&&(d=r.cvt[u],o&&Math.abs(l-d)<r.cvCutIn&&(l=d)),a&&l<y&&(l=y),o&&(l=r.round(l)),v.setRelative(g,f,p*l,b),v.touch(g),t.DEBUG&&console.log(r.step,(e?"MIRP[":"MDRP[")+(n?"M":"m")+(a?">":"_")+(o?"R":"_")+(0===i?"Gr":1===i?"Bl":2===i?"Wh":"")+"]",e?u+"("+r.cvt[u]+","+d+")":"",m,"(d =",s,"->",p*l,")"),r.rp1=r.rp0,r.rp2=m,n&&(r.rp0=m)}zt.prototype.exec=function(e,n){if("number"!=typeof n)throw new Error("Point size is not a number!");if(!(this._errorState>2)){var a=this.font,o=this._prepState;if(!o||o.ppem!==n){var i=this._fpgmState;if(!i){an.prototype=nn,(i=this._fpgmState=new an("fpgm",a.tables.fpgm)).funcs=[],i.font=a,t.DEBUG&&(console.log("---EXEC FPGM---"),i.step=-1);try{Ft(i)}catch(d){return console.log("Hinting error in FPGM:"+d),void(this._errorState=3)}}an.prototype=i,(o=this._prepState=new an("prep",a.tables.prep)).ppem=n;var r=a.tables.cvt;if(r)for(var s=o.cvt=new Array(r.length),l=n/a.unitsPerEm,p=0;p<r.length;p++)s[p]=r[p]*l;else o.cvt=[];t.DEBUG&&(console.log("---EXEC PREP---"),o.step=-1);try{Ft(o)}catch(d){this._errorState<2&&console.log("Hinting error in PREP:"+d),this._errorState=2}}if(!(this._errorState>1))try{return Bt(e,o)}catch(d){return this._errorState<1&&(console.log("Hinting error:"+d),console.log("Note: further hinting errors are silenced")),void(this._errorState=1)}}},Bt=function(e,n){var a,o,i,r=n.ppem/n.font.unitsPerEm,s=r,l=e.components;if(an.prototype=n,l){var p=n.font;o=[],a=[];for(var d=0;d<l.length;d++){var c=l[d],u=p.glyphs.get(c.glyphIndex);i=new an("glyf",u.instructions),t.DEBUG&&(console.log("---EXEC COMP "+d+"---"),i.step=-1),Gt(u,i,r,s
21);for(var m=Math.round(c.dx*r),h=Math.round(c.dy*s),f=i.gZone,g=i.contours,y=0;y<f.length;y++){var v=f[y];v.xTouched=v.yTouched=!1,v.xo=v.x=v.x+m,v.yo=v.y=v.y+h}var b=o.length;o.push.apply(o,f);for(var w=0;w<g.length;w++)a.push(g[w]+b)}e.instructions&&!i.inhibitGridFit&&((i=new an("glyf",e.instructions)).gZone=i.z0=i.z1=i.z2=o,i.contours=a,o.push(new en(0,0),new en(Math.round(e.advanceWidth*r),0)),t.DEBUG&&(console.log("---EXEC COMPOSITE---"),i.step=-1),Ft(i),o.length-=2)}else i=new an("glyf",e.instructions),t.DEBUG&&(console.log("---EXEC GLYPH---"),i.step=-1),Gt(e,i,r,s),o=i.gZone;return o},Gt=function(e,n,a,o){for(var i,r,s,l=e.points||[],p=l.length,d=n.gZone=n.z0=n.z1=n.z2=[],c=n.contours=[],u=0;u<p;u++)i=l[u],d[u]=new en(i.x*a,i.y*o,i.lastPointOfContour,i.onCurve);for(var m=0;m<p;m++)i=d[m],r||(r=i,c.push(m)),i.lastPointOfContour?(i.nextPointOnContour=r,r.prevPointOnContour=i,r=void 0):(s=d[m+1],i.nextPointOnContour=s,s.prevPointOnContour=i);if(!n.inhibitGridFit){if(t.DEBUG){console.log("PROCESSING GLYPH",n.stack);for(var h=0;h<p;h++)console.log(h,d[h].x,d[h].y)}if(d.push(new en(0,0),new en(Math.round(e.advanceWidth*a),0)),Ft(n),d.length-=2,t.DEBUG){console.log("FINISHED GLYPH",n.stack);for(var f=0;f<p;f++)console.log(f,d[f].x,d[f].y)}}},Ft=function(e){var n=e.prog;if(n){var a,o=n.length;for(e.ip=0;e.ip<o;e.ip++){if(t.DEBUG&&e.step++,!(a=Ot[n[e.ip]]))throw new Error("unknown instruction: 0x"+Number(n[e.ip]).toString(16));a(e)}}},Ot=[sn.bind(void 0,Qt),sn.bind(void 0,Jt),ln.bind(void 0,Qt),ln.bind(void 0,Jt),pn.bind(void 0,Qt),pn.bind(void 0,Jt),dn.bind(void 0,0),dn.bind(void 0,1),cn.bind(void 0,0),cn.bind(void 0,1),function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"SPVFS[]",a,o),e.pv=e.dpv=$t(o,a)},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"SPVFS[]",a,o),e.fv=$t(o,a)},function(e){var n=e.stack,a=e.pv;t.DEBUG&&console.log(e.step,"GPV[]"),n.push(16384*a.x),n.push(16384*a.y)},function(e){var n=e.stack,a=e.fv;t.DEBUG&&console.log(e.step,"GFV[]"),n.push(16384*a.x),n.push(16384*a.y)},function(e){e.fv=e.pv,t.DEBUG&&console.log(e.step,"SFVTPV[]")},function(e){var n=e.stack,a=n.pop(),o=n.pop(),i=n.pop(),r=n.pop(),s=n.pop(),l=e.z0,p=e.z1,d=l[a],c=l[o],u=p[i],m=p[r],h=e.z2[s];t.DEBUG&&console.log("ISECT[], ",a,o,i,r,s);var f=d.x,g=d.y,y=c.x,v=c.y,b=u.x,w=u.y,x=m.x,S=m.y,k=(f-y)*(w-S)-(g-v)*(b-x),T=f*v-g*y,C=b*S-w*x;h.x=(T*(b-x)-C*(f-y))/k,h.y=(T*(w-S)-C*(g-v))/k},function(e){e.rp0=e.stack.pop(),t.DEBUG&&console.log(e.step,"SRP0[]",e.rp0)},function(e){e.rp1=e.stack.pop(),t.DEBUG&&console.log(e.step,"SRP1[]",e.rp1)},function(e){e.rp2=e.stack.pop(),t.DEBUG&&console.log(e.step,"SRP2[]",e.rp2)},function(e){var n=e.stack.pop();switch(t.DEBUG&&console.log(e.step,"SZP0[]",n),e.zp0=n,n){case 0:e.tZone||on(e),e.z0=e.tZone;break;case 1:e.z0=e.gZone;break;default:throw new Error("Invalid zone pointer")}},function(e){var n=e.stack.pop();switch(t.DEBUG&&console.log(e.step,"SZP1[]",n),e.zp1=n,n){case 0:e.tZone||on(e),e.z1=e.tZone;break;case 1:e.z1=e.gZone;break;default:throw new Error("Invalid zone pointer")}},function(e){var n=e.stack.pop();switch(t.DEBUG&&console.log(e.step,"SZP2[]",n),e.zp2=n,n){case 0:e.tZone||on(e),e.z2=e.tZone;break;case 1:e.z2=e.gZone;break;default:throw new Error("Invalid zone pointer")}},function(e){var n=e.stack.pop();switch(t.DEBUG&&console.log(e.step,"SZPS[]",n),e.zp0=e.zp1=e.zp2=n,n){case 0:e.tZone||on(e),e.z0=e.z1=e.z2=e.tZone;break;case 1:e.z0=e.z1=e.z2=e.gZone;break;default:throw new Error("Invalid zone pointer")}},function(e){e.loop=e.stack.pop(),t.DEBUG&&console.log(e.step,"SLOOP[]",e.loop)},function(e){t.DEBUG&&console.log(e.step,"RTG[]"),e.round=Vt},function(e){t.DEBUG&&console.log(e.step,"RTHG[]"),e.round=Xt},function(e){var n=e.stack.pop();t.DEBUG&&console.log(e.step,"SMD[]",n),e.minDis=n/64},function(e){t.DEBUG&&console.log(e.step,"ELSE[]"),rn(e,!1)},function(e){var n=e.stack.pop();t.DEBUG&&console.log(e.step,"JMPR[]",n),e.ip+=n-1},function(e){var n=e.stack.pop();t.DEBUG&&console.log(e.step,"SCVTCI[]",n),e.cvCutIn=n/64},void 0,void 0,function(e){var n=e.stack;t.DEBUG&&console.log(e.step,"DUP[]"),n.push(n[n.length-1])},un,function(e){t.DEBUG&&console.log(e.step,"CLEAR[]"),e.stack.length=0},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"SWAP[]"),n.push(a),n.push(o)},function(e){var n=e.stack;t.DEBUG&&console.log(e.step,"DEPTH[]"),n.push(n.length)},function(e){var n=e.stack,a=n.pop();t.DEBUG&&console.log(e.step,"CINDEX[]",a),n.push(n[n.length-a])},function(e){var n=e.stack,a=n.pop();t.DEBUG&&console.log(e.step,"MINDEX[]",a),n.push(n.splice(n.length-a,1)[0])},void 0,void 0,void 0,function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"LOOPCALL[]",a,o);var i=e.ip,r=e.prog;e.prog=e.funcs[a];for(var s=0;s<o;s++)Ft(e),t.DEBUG&&console.log(++e.step,s+1<o?"next loopcall":"done loopcall",s);e.ip=i,e.prog=r},function(e){var n=e.stack.pop();t.DEBUG&&console.log(e.step,"CALL[]",n);var a=e.ip,o=e.prog;e.prog=e.funcs[n],Ft(e),e.ip=a,e.prog=o,t.DEBUG&&console.log(++e.step,"returning from",n)},function(e){if("fpgm"!==e.env)throw new Error("FDEF not allowed here");var n=e.stack,a=e.prog,o=e.ip,i=n.pop(),r=o;for(t.DEBUG&&console.log(e.step,"FDEF[]",i);45!==a[++o];);e.ip=o,e.funcs[i]=a.slice(r+1,o)}
21,void 0,mn.bind(void 0,0),mn.bind(void 0,1),hn.bind(void 0,Qt),hn.bind(void 0,Jt),fn.bind(void 0,0),fn.bind(void 0,1),gn.bind(void 0,0),gn.bind(void 0,1),yn.bind(void 0,0),yn.bind(void 0,1),function(e){for(var n=e.stack,a=e.loop,o=e.fv,i=n.pop()/64,r=e.z2;a--;){var s=n.pop(),l=r[s];t.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-a)+": ":"")+"SHPIX[]",s,i),o.setRelative(l,l,i),o.touch(l)}e.loop=1},function(e){for(var n=e.stack,a=e.rp1,o=e.rp2,i=e.loop,r=e.z0[a],s=e.z1[o],l=e.fv,p=e.dpv,d=e.z2;i--;){var c=n.pop(),u=d[c];t.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-i)+": ":"")+"IP[]",c,a,"<->",o),l.interpolate(u,r,s,p),l.touch(u)}e.loop=1},vn.bind(void 0,0),vn.bind(void 0,1),function(e){for(var n=e.stack,a=e.rp0,o=e.z0[a],i=e.loop,r=e.fv,s=e.pv,l=e.z1;i--;){var p=n.pop(),d=l[p];t.DEBUG&&console.log(e.step,(e.loop>1?"loop "+(e.loop-i)+": ":"")+"ALIGNRP[]",p),r.setRelative(d,o,0,s),r.touch(d)}e.loop=1},function(e){t.DEBUG&&console.log(e.step,"RTDG[]"),e.round=Wt},bn.bind(void 0,0),bn.bind(void 0,1),function(e){var n=e.prog,a=e.ip,o=e.stack,i=n[++a];t.DEBUG&&console.log(e.step,"NPUSHB[]",i);for(var r=0;r<i;r++)o.push(n[++a]);e.ip=a},function(e){var n=e.ip,a=e.prog,o=e.stack,i=a[++n];t.DEBUG&&console.log(e.step,"NPUSHW[]",i);for(var r=0;r<i;r++){var s=a[++n]<<8|a[++n];32768&s&&(s=-(1+(65535^s))),o.push(s)}e.ip=n},function(e){var n=e.stack,a=e.store;a||(a=e.store=[]);var o=n.pop(),i=n.pop();t.DEBUG&&console.log(e.step,"WS",o,i),a[i]=o},function(e){var n=e.stack,a=e.store,o=n.pop();t.DEBUG&&console.log(e.step,"RS",o);var i=a&&a[o]||0;n.push(i)},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"WCVTP",a,o),e.cvt[o]=a/64},function(e){var n=e.stack,a=n.pop();t.DEBUG&&console.log(e.step,"RCVT",a),n.push(64*e.cvt[a])},wn.bind(void 0,0),wn.bind(void 0,1),void 0,xn.bind(void 0,0),xn.bind(void 0,1),function(e){t.DEBUG&&console.log(e.step,"MPPEM[]"),e.stack.push(e.ppem)},void 0,function(e){t.DEBUG&&console.log(e.step,"FLIPON[]"),e.autoFlip=!0},void 0,void 0,function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"LT[]",a,o),n.push(o<a?1:0)},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"LTEQ[]",a,o),n.push(o<=a?1:0)},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"GT[]",a,o),n.push(o>a?1:0)},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"GTEQ[]",a,o),n.push(o>=a?1:0)},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"EQ[]",a,o),n.push(a===o?1:0)},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"NEQ[]",a,o),n.push(a!==o?1:0)},function(e){var n=e.stack,a=n.pop();t.DEBUG&&console.log(e.step,"ODD[]",a),n.push(Math.trunc(a)%2?1:0)},function(e){var n=e.stack,a=n.pop();t.DEBUG&&console.log(e.step,"EVEN[]",a),n.push(Math.trunc(a)%2?0:1)},function(e){var n=e.stack.pop();t.DEBUG&&console.log(e.step,"IF[]",n),n||(rn(e,!0),t.DEBUG&&console.log(e.step,"EIF[]"))},function(e){t.DEBUG&&console.log(e.step,"EIF[]")},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"AND[]",a,o),n.push(a&&o?1:0)},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"OR[]",a,o),n.push(a||o?1:0)},function(e){var n=e.stack,a=n.pop();t.DEBUG&&console.log(e.step,"NOT[]",a),n.push(a?0:1)},Sn.bind(void 0,1),function(e){var n=e.stack.pop();t.DEBUG&&console.log(e.step,"SDB[]",n),e.deltaBase=n},function(e){var n=e.stack.pop();t.DEBUG&&console.log(e.step,"SDS[]",n),e.deltaShift=Math.pow(.5,n)},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"ADD[]",a,o),n.push(o+a)},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"SUB[]",a,o),n.push(o-a)},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"DIV[]",a,o),n.push(64*o/a)},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"MUL[]",a,o),n.push(o*a/64)},function(e){var n=e.stack,a=n.pop();t.DEBUG&&console.log(e.step,"ABS[]",a),n.push(Math.abs(a))},function(e){var n=e.stack,a=n.pop();t.DEBUG&&console.log(e.step,"NEG[]",a),n.push(-a)},function(e){var n=e.stack,a=n.pop();t.DEBUG&&console.log(e.step,"FLOOR[]",a),n.push(64*Math.floor(a/64))},function(e){var n=e.stack,a=n.pop();t.DEBUG&&console.log(e.step,"CEILING[]",a),n.push(64*Math.ceil(a/64))}
21,kn.bind(void 0,0),kn.bind(void 0,1),kn.bind(void 0,2),kn.bind(void 0,3),void 0,void 0,void 0,void 0,function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"WCVTF[]",a,o),e.cvt[o]=a*e.ppem/e.font.unitsPerEm},Sn.bind(void 0,2),Sn.bind(void 0,3),Tn.bind(void 0,1),Tn.bind(void 0,2),Tn.bind(void 0,3),function(e){var n,a=e.stack.pop();switch(t.DEBUG&&console.log(e.step,"SROUND[]",a),e.round=Zt,192&a){case 0:n=.5;break;case 64:n=1;break;case 128:n=2;break;default:throw new Error("invalid SROUND value")}switch(e.srPeriod=n,48&a){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*n;break;case 32:e.srPhase=.5*n;break;case 48:e.srPhase=.75*n;break;default:throw new Error("invalid SROUND value")}a&=15,e.srThreshold=0===a?0:(a/8-.5)*n},function(e){var n,a=e.stack.pop();switch(t.DEBUG&&console.log(e.step,"S45ROUND[]",a),e.round=Zt,192&a){case 0:n=Math.sqrt(2)/2;break;case 64:n=Math.sqrt(2);break;case 128:n=2*Math.sqrt(2);break;default:throw new Error("invalid S45ROUND value")}switch(e.srPeriod=n,48&a){case 0:e.srPhase=0;break;case 16:e.srPhase=.25*n;break;case 32:e.srPhase=.5*n;break;case 48:e.srPhase=.75*n;break;default:throw new Error("invalid S45ROUND value")}a&=15,e.srThreshold=0===a?0:(a/8-.5)*n},void 0,void 0,function(e){t.DEBUG&&console.log(e.step,"ROFF[]"),e.round=qt},void 0,function(e){t.DEBUG&&console.log(e.step,"RUTG[]"),e.round=Ht},function(e){t.DEBUG&&console.log(e.step,"RDTG[]"),e.round=Yt},un,un,void 0,void 0,void 0,void 0,void 0,function(e){var n=e.stack.pop();t.DEBUG&&console.log(e.step,"SCANCTRL[]",n)},Cn.bind(void 0,0),Cn.bind(void 0,1),function(e){var n=e.stack,a=n.pop(),o=0;t.DEBUG&&console.log(e.step,"GETINFO[]",a),1&a&&(o=35),32&a&&(o|=4096),n.push(o)},void 0,function(e){var n=e.stack,a=n.pop(),o=n.pop(),i=n.pop();t.DEBUG&&console.log(e.step,"ROLL[]"),n.push(o),n.push(a),n.push(i)},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"MAX[]",a,o),n.push(Math.max(o,a))},function(e){var n=e.stack,a=n.pop(),o=n.pop();t.DEBUG&&console.log(e.step,"MIN[]",a,o),n.push(Math.min(o,a))},function(e){var n=e.stack.pop();t.DEBUG&&console.log(e.step,"SCANTYPE[]",n)},function(e){var n=e.stack.pop(),a=e.stack.pop();switch(t.DEBUG&&console.log(e.step,"INSTCTRL[]",n,a),n){case 1:return void(e.inhibitGridFit=!!a);case 2:return void(e.ignoreCvt=!!a);default:throw new Error("invalid INSTCTRL[] selector")}},void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,_n.bind(void 0,1),_n.bind(void 0,2),_n.bind(void 0,3),_n.bind(void 0,4),_n.bind(void 0,5),_n.bind(void 0,6),_n.bind(void 0,7),_n.bind(void 0,8),En.bind(void 0,1),En.bind(void 0,2),En.bind(void 0,3),En.bind(void 0,4),En.bind(void 0,5),En.bind(void 0,6),En.bind(void 0,7),En.bind(void 0,8),Mn.bind(void 0,0,0,0,0,0),Mn.bind(void 0,0,0,0,0,1),Mn.bind(void 0,0,0,0,0,2),Mn.bind(void 0,0,0,0,0,3),Mn.bind(void 0,0,0,0,1,0),Mn.bind(void 0,0,0,0,1,1),Mn.bind(void 0,0,0,0,1,2),Mn.bind(void 0,0,0,0,1,3),Mn.bind(void 0,0,0,1,0,0),Mn.bind(void 0,0,0,1,0,1),Mn.bind(void 0,0,0,1,0,2),Mn.bind(void 0,0,0,1,0,3),Mn.bind(void 0,0,0,1,1,0),Mn.bind(void 0,0,0,1,1,1),Mn.bind(void 0,0,0,1,1,2),Mn.bind(void 0,0,0,1,1,3),Mn.bind(void 0,0,1,0,0,0),Mn.bind(void 0,0,1,0,0,1),Mn.bind(void 0,0,1,0,0,2),Mn.bind(void 0,0,1,0,0,3),Mn.bind(void 0,0,1,0,1,0),Mn.bind(void 0,0,1,0,1,1),Mn.bind(void 0,0,1,0,1,2),Mn.bind(void 0,0,1,0,1,3),Mn.bind(void 0,0,1,1,0,0),Mn.bind(void 0,0,1,1,0,1),Mn.bind(void 0,0,1,1,0,2),Mn.bind(void 0,0,1,1,0,3),Mn.bind(void 0,0,1,1,1,0),Mn.bind(void 0,0,1,1,1,1),Mn.bind(void 0,0,1,1,1,2),Mn.bind(void 0,0,1,1,1,3),Mn.bind(void 0,1,0,0,0,0),Mn.bind(void 0,1,0,0,0,1),Mn.bind(void 0,1,0,0,0,2),Mn.bind(void 0,1,0,0,0,3),Mn.bind(void 0,1,0,0,1,0),Mn.bind(void 0,1,0,0,1,1),Mn.bind(void 0,1,0,0,1,2),Mn.bind(void 0,1,0,0,1,3),Mn.bind(void 0,1,0,1,0,0),Mn.bind(void 0,1,0,1,0,1),Mn.bind(void 0,1,0,1,0,2),Mn.bind(void 0,1,0,1,0,3),Mn.bind(void 0,1,0,1,1,0),Mn.bind(void 0,1,0,1,1,1),Mn.bind(void 0,1,0,1,1,2),Mn.bind(void 0,1,0,1,1,3),Mn.bind(void 0,1,1,0,0,0),Mn.bind(void 0,1,1,0,0,1),Mn.bind(void 0,1,1,0,0,2),Mn.bind(void 0,1,1,0,0,3),Mn.bind(void 0,1,1,0,1,0),Mn.bind(void 0,1,1,0,1,1),Mn.bind(void 0,1,1,0,1,2),Mn.bind(void 0,1,1,0,1,3),Mn.bind(void 0,1,1,1,0,0),Mn.bind(void 0,1,1,1,0,1),Mn.bind(void 0,1,1,1,0,2),Mn.bind(void 0,1,1,1,0,3),Mn.bind(void 0,1,1,1,1,0),Mn.bind(void 0,1,1,1,1,1),Mn.bind(void 0,1,1,1,1,2),Mn.bind(void 0,1,1,1,1,3)];var jn=Array.from||function(e){return e.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]?|[^\uD800-\uDFFF]|./g)||[]};function In(e){(e=e||{}).empty||(Rt(e.familyName,"When creating a new Font object, familyName is required."),Rt(e.styleName,"When creating a new Font object, styleName is required."),Rt(e.unitsPerEm,"When creating a new Font object, unitsPerEm is required."),Rt(e.ascender,"When creating a new Font object, ascender is required."),Rt(e.descender,"When creating a new Font object, descender is required."),Rt(e.descender<0,"Descender should be negative (e.g. -512)."),this.names={fontFamily:{en:e.familyName||" "}
21,fontSubfamily:{en:e.styleName||" "},fullName:{en:e.fullName||e.familyName+" "+e.styleName},postScriptName:{en:e.postScriptName||(e.familyName+e.styleName).replace(/\s/g,"")},designer:{en:e.designer||" "},designerURL:{en:e.designerURL||" "},manufacturer:{en:e.manufacturer||" "},manufacturerURL:{en:e.manufacturerURL||" "},license:{en:e.license||" "},licenseURL:{en:e.licenseURL||" "},version:{en:e.version||"Version 0.1"},description:{en:e.description||" "},copyright:{en:e.copyright||" "},trademark:{en:e.trademark||" "}},this.unitsPerEm=e.unitsPerEm||1e3,this.ascender=e.ascender,this.descender=e.descender,this.createdTimestamp=e.createdTimestamp,this.tables={os2:{usWeightClass:e.weightClass||this.usWeightClasses.MEDIUM,usWidthClass:e.widthClass||this.usWidthClasses.MEDIUM,fsSelection:e.fsSelection||this.fsSelectionValues.REGULAR}}),this.supported=!0,this.glyphs=new ke.GlyphSet(this,e.glyphs||[]),this.encoding=new fe(this),this.position=new _t(this),this.substitution=new Et(this),this.tables=this.tables||{},Object.defineProperty(this,"hinting",{get:function(){return this._hinting?this._hinting:"truetype"===this.outlinesFormat?this._hinting=new zt(this):void 0}})}function Rn(e,t){var n=JSON.stringify(e),a=256;for(var o in t){var i=parseInt(o);if(i&&!(i<256)){if(JSON.stringify(t[o])===n)return i;a<=i&&(a=i+1)}}return t[a]=e,a}function Nn(e,t,n){var a=Rn(t.name,n);return[{name:"tag_"+e,type:"TAG",value:t.tag},{name:"minValue_"+e,type:"FIXED",value:t.minValue<<16},{name:"defaultValue_"+e,type:"FIXED",value:t.defaultValue<<16},{name:"maxValue_"+e,type:"FIXED",value:t.maxValue<<16},{name:"flags_"+e,type:"USHORT",value:0},{name:"nameID_"+e,type:"USHORT",value:a}]}function An(e,t,n){var a={},o=new le.Parser(e,t);return a.tag=o.parseTag(),a.minValue=o.parseFixed(),a.defaultValue=o.parseFixed(),a.maxValue=o.parseFixed(),o.skip("uShort",1),a.name=n[o.parseUShort()]||{},a}function Dn(e,t,n,a){for(var o=[{name:"nameID_"+e,type:"USHORT",value:Rn(t.name,a)},{name:"flags_"+e,type:"USHORT",value:0}],i=0;i<n.length;++i){var r=n[i].tag;o.push({name:"axis_"+e+" "+r,type:"FIXED",value:t.coordinates[r]<<16})}return o}function Ln(e,t,n,a){var o={},i=new le.Parser(e,t);o.name=a[i.parseUShort()]||{},i.skip("uShort",1),o.coordinates={};for(var r=0;r<n.length;++r)o.coordinates[n[r].tag]=i.parseFixed();return o}In.prototype.hasChar=function(e){return null!==this.encoding.charToGlyphIndex(e)},In.prototype.charToGlyphIndex=function(e){return this.encoding.charToGlyphIndex(e)},In.prototype.charToGlyph=function(e){var t=this.charToGlyphIndex(e),n=this.glyphs.get(t);return n||(n=this.glyphs.get(0)),n},In.prototype.stringToGlyphs=function(e,t){t=t||this.defaultRenderOptions;for(var n=jn(e),a=[],o=0;o<n.length;o+=1){var i=n[o];a.push(this.charToGlyphIndex(i))}var r=a.length;if(t.features){var s=t.script||this.substitution.getDefaultScriptName(),l=[];t.features.liga&&(l=l.concat(this.substitution.getFeature("liga",s,t.language))),t.features.rlig&&(l=l.concat(this.substitution.getFeature("rlig",s,t.language)));for(var p=0;p<r;p+=1)for(var d=0;d<l.length;d++){for(var c=l[d],u=c.sub,m=u.length,h=0;h<m&&u[h]===a[p+h];)h++;h===m&&(a.splice(p,m,c.by),r=r-m+1)}}for(var f=new Array(r),g=this.glyphs.get(0),y=0;y<r;y+=1)f[y]=this.glyphs.get(a[y])||g;return f},In.prototype.nameToGlyphIndex=function(e){return this.glyphNames.nameToGlyphIndex(e)},In.prototype.nameToGlyph=function(e){var t=this.nameToGlyphIndex(e),n=this.glyphs.get(t);return n||(n=this.glyphs.get(0)),n},In.prototype.glyphIndexToName=function(e){return this.glyphNames.glyphIndexToName?this.glyphNames.glyphIndexToName(e):""},In.prototype.getKerningValue=function(e,t){e=e.index||e,t=t.index||t;var n=this.position.defaultKerningTables;return n?this.position.getKerningValue(n,e,t):this.kerningPairs[e+","+t]||0},In.prototype.defaultRenderOptions={kerning:!0,features:{liga:!0,rlig:!0}},In.prototype.forEachGlyph=function(e,t,n,a,o,i){t=void 0!==t?t:0,n=void 0!==n?n:0,a=void 0!==a?a:72,o=o||this.defaultRenderOptions;var r,s=1/this.unitsPerEm*a,l=this.stringToGlyphs(e,o);if(o.kerning){var p=o.script||this.position.getDefaultScriptName();r=this.position.getKerningTables(p,o.language)}for(var d=0;d<l.length;d+=1){var c=l[d];if(i.call(this,c,t,n,a,o),c.advanceWidth&&(t+=c.advanceWidth*s),o.kerning&&d<l.length-1)t+=(r?this.position.getKerningValue(r,c.index,l[d+1].index):this.getKerningValue(c,l[d+1]))*s;o.letterSpacing?t+=o.letterSpacing*a:o.tracking&&(t+=o.tracking/1e3*a)}return t},In.prototype.getPath=function(e,t,n,a,o){var i=new I;return this.forEachGlyph(e,t,n,a,o,function(e,t,n,a){var r=e.getPath(t,n,a,o,this);i.extend(r)}),i},In.prototype.getPaths=function(e,t,n,a,o){var i=[];return this.forEachGlyph(e,t,n,a,o,function(e,t,n,a){var r=e.getPath(t,n,a,o,this);i.push(r)}),i},In.prototype.getAdvanceWidth=function(e,t,n){return this.forEachGlyph(e,0,0,t,n,function(){})},In.prototype.draw=function(e,t,n,a,o,i){this.getPath(t,n,a,o,i).draw(e)},In.prototype.drawPoints=function(e,t,n,a,o,i){this.forEachGlyph(t,n,a,o,i,function(t,n,a,o){t.drawPoints(e,n,a,o)})},In.prototype.drawMetrics=function(e,t,n,a,o,i){this.forEachGlyph(t,n,a,o,i,function(t,n,a,o){t.drawMetrics(e,n,a,o)})},In.prototype.getEnglishName=function(e){var t=this.names[e];if(t)return t.en},In.prototype.validate=function(){var e=this;function t(t){var n=e.getEnglishName(t);n&&n.trim().length}t("fontFamily"),t("weightName"),t("manufacturer"),t("copyright"),t("version"),this.unitsPerEm},In.prototype.toTables=function(){return xt.fontToTable(this)},In.prototype.toBuffer=function(){return console.warn("Font.toBuffer is deprecated. Use Font.toArrayBuffer instead."),this.toArrayBuffer()},In.prototype.toArrayBuffer=function(){for(var e=this.toTables().encode(),t=new ArrayBuffer(e.length),n=new Uint8Array(t),a=0;a<e.length;a++)n[a]=e[a];return t},In.prototype.download=function(t){var n=this.getEnglishName("fontFamily"),o=this.getEnglishName("fontSubfam
21ily");t=t||n.replace(/\s/g,"")+"-"+o+".otf";var i=this.toArrayBuffer();if("undefined"!=typeof window)window.requestFileSystem=window.requestFileSystem||window.webkitRequestFileSystem,window.requestFileSystem(window.TEMPORARY,i.byteLength,function(e){e.root.getFile(t,{create:!0},function(e){e.createWriter(function(t){var n=new DataView(i),a=new Blob([n],{type:"font/opentype"});t.write(a),t.addEventListener("writeend",function(){location.href=e.toURL()},!1)})})},function(e){throw new Error(e.name+": "+e.message)});else{var r=e("fs"),s=function(e){for(var t=new a(e.byteLength),n=new Uint8Array(e),o=0;o<t.length;++o)t[o]=n[o];return t}(i);r.writeFileSync(t,s)}},In.prototype.fsSelectionValues={ITALIC:1,UNDERSCORE:2,NEGATIVE:4,OUTLINED:8,STRIKEOUT:16,BOLD:32,REGULAR:64,USER_TYPO_METRICS:128,WWS:256,OBLIQUE:512},In.prototype.usWidthClasses={ULTRA_CONDENSED:1,EXTRA_CONDENSED:2,CONDENSED:3,SEMI_CONDENSED:4,MEDIUM:5,SEMI_EXPANDED:6,EXPANDED:7,EXTRA_EXPANDED:8,ULTRA_EXPANDED:9},In.prototype.usWeightClasses={THIN:100,EXTRA_LIGHT:200,LIGHT:300,NORMAL:400,MEDIUM:500,SEMI_BOLD:600,BOLD:700,EXTRA_BOLD:800,BLACK:900};var Pn={make:function(e,t){var n=new ee.Table("fvar",[{name:"version",type:"ULONG",value:65536},{name:"offsetToData",type:"USHORT",value:0},{name:"countSizePairs",type:"USHORT",value:2},{name:"axisCount",type:"USHORT",value:e.axes.length},{name:"axisSize",type:"USHORT",value:20},{name:"instanceCount",type:"USHORT",value:e.instances.length},{name:"instanceSize",type:"USHORT",value:4+4*e.axes.length}]);n.offsetToData=n.sizeOf();for(var a=0;a<e.axes.length;a++)n.fields=n.fields.concat(Nn(a,e.axes[a],t));for(var o=0;o<e.instances.length;o++)n.fields=n.fields.concat(Dn(o,e.instances[o],e.axes,t));return n},parse:function(e,t,n){var a=new le.Parser(e,t),o=a.parseULong();A.argument(65536===o,"Unsupported fvar table version.");var i=a.parseOffset16();a.skip("uShort",1);for(var r=a.parseUShort(),s=a.parseUShort(),l=a.parseUShort(),p=a.parseUShort(),d=[],c=0;c<r;c++)d.push(An(e,t+i+c*s,n));for(var u=[],m=t+i+r*s,h=0;h<l;h++)u.push(Ln(e,m+h*p,d,n));return{axes:d,instances:u}}},On=new Array(10);On[1]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();return 1===t?{posFormat:1,coverage:this.parsePointer(re.coverage),value:this.parseValueRecord()}:2===t?{posFormat:2,coverage:this.parsePointer(re.coverage),values:this.parseValueRecordList()}:void A.assert(!1,"0x"+e.toString(16)+": GPOS lookup type 1 format must be 1 or 2.")},On[2]=function(){var e=this.offset+this.relativeOffset,t=this.parseUShort();A.assert(1===t||2===t,"0x"+e.toString(16)+": GPOS lookup type 2 format must be 1 or 2.");var n=this.parsePointer(re.coverage),a=this.parseUShort(),o=this.parseUShort();if(1===t)return{posFormat:t,coverage:n,valueFormat1:a,valueFormat2:o,pairSets:this.parseList(re.pointer(re.list(function(){return{secondGlyph:this.parseUShort(),value1:this.parseValueRecord(a),value2:this.parseValueRecord(o)}})))};if(2===t){var i=this.parsePointer(re.classDef),r=this.parsePointer(re.classDef),s=this.parseUShort(),l=this.parseUShort();return{posFormat:t,coverage:n,valueFormat1:a,valueFormat2:o,classDef1:i,classDef2:r,class1Count:s,class2Count:l,classRecords:this.parseList(s,re.list(l,function(){return{value1:this.parseValueRecord(a),value2:this.parseValueRecord(o)}}))}}},On[3]=function(){return{error:"GPOS Lookup 3 not supported"}},On[4]=function(){return{error:"GPOS Lookup 4 not supported"}},On[5]=function(){return{error:"GPOS Lookup 5 not supported"}}
21,On[6]=function(){return{error:"GPOS Lookup 6 not supported"}},On[7]=function(){return{error:"GPOS Lookup 7 not supported"}},On[8]=function(){return{error:"GPOS Lookup 8 not supported"}},On[9]=function(){return{error:"GPOS Lookup 9 not supported"}};var Fn=new Array(10),Bn={parse:function(e,t){var n=new re(e,t=t||0),a=n.parseVersion(1);return A.argument(1===a||1.1===a,"Unsupported GPOS table version "+a),1===a?{version:a,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(On)}:{version:a,scripts:n.parseScriptList(),features:n.parseFeatureList(),lookups:n.parseLookupList(On),variations:n.parseFeatureVariationsList()}},make:function(e){return new ee.Table("GPOS",[{name:"version",type:"ULONG",value:65536},{name:"scripts",type:"TABLE",value:new ee.ScriptList(e.scripts)},{name:"features",type:"TABLE",value:new ee.FeatureList(e.features)},{name:"lookups",type:"TABLE",value:new ee.LookupList(e.lookups,Fn)}])}},Gn={parse:function(e,t){var n=new le.Parser(e,t),a=n.parseUShort();if(0===a)return function(e){var t={};e.skip("uShort");var n=e.parseUShort();A.argument(0===n,"Unsupported kern sub-table version."),e.skip("uShort",2);var a=e.parseUShort();e.skip("uShort",3);for(var o=0;o<a;o+=1){var i=e.parseUShort(),r=e.parseUShort(),s=e.parseShort();t[i+","+r]=s}return t}(n);if(1===a)return function(e){var t={};e.skip("uShort"),e.parseULong()>1&&console.warn("Only the first kern subtable is supported."),e.skip("uLong");var n=255&e.parseUShort();if(e.skip("uShort"),0===n){var a=e.parseUShort();e.skip("uShort",3);for(var o=0;o<a;o+=1){var i=e.parseUShort(),r=e.parseUShort(),s=e.parseShort();t[i+","+r]=s}}return t}(n);throw new Error("Unsupported kern table version ("+a+").")}},Un={parse:function(e,t,n,a){for(var o=new le.Parser(e,t),i=a?o.parseUShort:o.parseULong,r=[],s=0;s<n+1;s+=1){var l=i.call(o);a&&(l*=2),r.push(l)}return r}};function zn(t,n){e("fs").readFile(t,function(e,t){if(e)return n(e.message);n(null,It(t))})}function qn(e,t){var n=new XMLHttpRequest;n.open("get",e,!0),n.responseType="arraybuffer",n.onload=function(){return n.response?t(null,n.response):t("Font could not be loaded: "+n.statusText)},n.onerror=function(){t("Font could not be loaded")},n.send()}function Vn(e,t){for(var n=[],a=12,o=0;o<t;o+=1){var i=le.getTag(e,a),r=le.getULong(e,a+4),s=le.getULong(e,a+8),l=le.getULong(e,a+12);n.push({tag:i,checksum:r,offset:s,length:l,compression:!1}),a+=16}return n}function Wn(e,t){if("WOFF"===t.compression){var n=new Uint8Array(e.buffer,t.offset+2,t.compressedLength-2),a=new Uint8Array(t.length);if(E(n,a),a.byteLength!==t.length)throw new Error("Decompression error: "+t.tag+" decompressed length doesn't match recorded length");return{data:new DataView(a.buffer,0),offset:0}}return{data:e,offset:t.offset}}function Xn(e){var t,n,a,o,i,r,s,l,p,d,c,u,m,h,f=new In({empty:!0}),g=new DataView(e,0),y=[],v=le.getTag(g,0);if(v===String.fromCharCode(0,1,0,0)||"true"===v||"typ1"===v)f.outlinesFormat="truetype",y=Vn(g,a=le.getUShort(g,4));else if("OTTO"===v)f.outlinesFormat="cff",y=Vn(g,a=le.getUShort(g,4));else{if("wOFF"!==v)throw new Error("Unsupported OpenType signature "+v);var b=le.getTag(g,4);if(b===String.fromCharCode(0,1,0,0))f.outlinesFormat="truetype";else{if("OTTO"!==b)throw new Error("Unsupported OpenType flavor "+v);f.outlinesFormat="cff"}y=function(e,t){for(var n=[],a=44,o=0;o<t;o+=1){var i=le.getTag(e,a),r=le.getULong(e,a+4),s=le.getULong(e,a+8),l=le.getULong(e,a+12),p=void 0;p=s<l&&"WOFF",n.push({tag:i,offset:r,compression:p,compressedLength:s,length:l}),a+=20}return n}(g,a=le.getUShort(g,12))}for(var w=0;w<a;w+=1){var x=y[w],S=void 0;switch(x.tag){case"cmap":S=Wn(g,x),f.tables.cmap=de.parse(S.data,S.offset),f.encoding=new ge(f.tables.cmap);break;case"cvt ":S=Wn(g,x),h=new le.Parser(S.data,S.offset),f.tables.cvt=h.parseShortList(x.length/2);break;case"fvar":i=x;break;case"fpgm":S=Wn(g,x),h=new le.Parser(S.data,S.offset),f.tables.fpgm=h.parseByteList(x.length);break;case"head":S=Wn(g,x),f.tables.head=qe.parse(S.data,S.offset),f.unitsPerEm=f.tables.head.unitsPerEm,t=f.tables.head.indexToLocFormat;break;case"hhea":S=Wn(g,x),f.tables.hhea=Ve.parse(S.data,S.offset),f.ascender=f.tables.hhea.ascender,f.desce
21nder=f.tables.hhea.descender,f.numberOfHMetrics=f.tables.hhea.numberOfHMetrics;break;case"hmtx":p=x;break;case"ltag":S=Wn(g,x),n=Xe.parse(S.data,S.offset);break;case"maxp":S=Wn(g,x),f.tables.maxp=He.parse(S.data,S.offset),f.numGlyphs=f.tables.maxp.numGlyphs;break;case"name":u=x;break;case"OS/2":S=Wn(g,x),f.tables.os2=lt.parse(S.data,S.offset);break;case"post":S=Wn(g,x),f.tables.post=pt.parse(S.data,S.offset),f.glyphNames=new ve(f.tables.post);break;case"prep":S=Wn(g,x),h=new le.Parser(S.data,S.offset),f.tables.prep=h.parseByteList(x.length);break;case"glyf":r=x;break;case"loca":c=x;break;case"CFF ":o=x;break;case"kern":d=x;break;case"GPOS":s=x;break;case"GSUB":l=x;break;case"meta":m=x}}var k=Wn(g,u);if(f.tables.name=rt.parse(k.data,k.offset,n),f.names=f.tables.name,r&&c){var T=0===t,C=Wn(g,c),_=Un.parse(C.data,C.offset,f.numGlyphs,T),E=Wn(g,r);f.glyphs=Ut.parse(E.data,E.offset,_,f)}else{if(!o)throw new Error("Font doesn't contain TrueType or CFF outlines.");var M=Wn(g,o);ze.parse(M.data,M.offset,f)}var j=Wn(g,p);if(We.parse(j.data,j.offset,f.numberOfHMetrics,f.numGlyphs,f.glyphs),function(e){for(var t,n=e.tables.cmap.glyphIndexMap,a=Object.keys(n),o=0;o<a.length;o+=1){var i=a[o],r=n[i];(t=e.glyphs.get(r)).addUnicode(parseInt(i))}for(var s=0;s<e.glyphs.length;s+=1)t=e.glyphs.get(s),e.cffEncoding?e.isCIDFont?t.name="gid"+s:t.name=e.cffEncoding.charset[s]:e.glyphNames.names&&(t.name=e.glyphNames.glyphIndexToName(s))}(f),d){var I=Wn(g,d);f.kerningPairs=Gn.parse(I.data,I.offset)}else f.kerningPairs={};if(s){var R=Wn(g,s);f.tables.gpos=Bn.parse(R.data,R.offset),f.position.init()}if(l){var N=Wn(g,l);f.tables.gsub=mt.parse(N.data,N.offset)}if(i){var A=Wn(g,i);f.tables.fvar=Pn.parse(A.data,A.offset,f.names)}if(m){var D=Wn(g,m);f.tables.meta=ht.parse(D.data,D.offset),f.metas=f.tables.meta}return f}t.Font=In,t.Glyph=we,t.Path=I,t.BoundingBox=j,t._parse=le,t.parse=Xn,t.load=function(e,t){("undefined"==typeof window?zn:qn)(e,function(e,n){if(e)return t(e);var a;try{a=Xn(n)}catch(o){return t(o,null)}return t(null,a)})},t.loadSync=function(t){return Xn(It(e("fs").readFileSync(t)))},Object.defineProperty(t,"__esModule",{value:!0})}("object"==typeof n&&void 0!==t?n:o.opentype={})}).call(this,e("buffer").Buffer)},{buffer:4,fs:3}],11:[function(e,t,n){var a,o,i=t.exports={};function r(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function l(e){if(a===setTimeout)return setTimeout(e,0);if((a===r||!a)&&setTimeout)return a=setTimeout,setTimeout(e,0);try{return a(e,0)}catch(t){try{return a.call(null,e,0)}catch(t){return a.call(this,e,0)}}}!function(){try{a="function"==typeof setTimeout?setTimeout:r}catch(e){a=r}try{o="function"==typeof clearTimeout?clearTimeout:s}catch(e){o=s}}();var p,d=[],c=!1,u=-1;function m(){c&&p&&(c=!1,p.length?d=p.concat(d):u=-1,d.length&&h())}function h(){if(!c){var e=l(m);c=!0;for(var t=d.length;t;){for(p=d,d=[];++u<t;)p&&p[u].run();u=-1,t=d.length}p=null,c=!1,function(e){if(o===clearTimeout)return clearTimeout(e);if((o===s||!o)&&clearTimeout)return o=clearTimeout,clearTimeout(e);try{o(e)}catch(t){try{return o.call(null,e)}catch(t){return o.call(this,e)}}}(e)}}function f(e,t){this.fun=e,this.array=t}function g(){}i.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];d.push(new f(e,t)),1!==d.length||c||l(h)},f.prototype.run=function(){this.fun.apply(null,this.array)},i.title="browser",i.env={},i.argv=[],i.version="",i.versions={},i.on=g,i.addListener=g,i.once=g,i.off=g,i.removeListener=g,i.removeAllListeners=g,i.emit=g,i.prependListener=g,i.prependOnceListener=g,i.listeners=function(e){return[]},i.binding=function(e){throw new Error("process.binding is not supported")},i.cwd=function(){return"/"},i.chdir=function(e){throw new Error("process.chdir is not supported")},i.umask=function(){return 0}},{}],12:[function(e,t,n){!function(e){"use strict";if(!e.fetch){var t={searchParams:"URLSearchParams"in e,iterable:"Symbol"in e&&"iterator"in Symbol,blob:"FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in e,arrayBuffer:"ArrayBuffer"in e};if(t.arrayBuffer)var n=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array
21]"],a=function(e){return e&&DataView.prototype.isPrototypeOf(e)},o=ArrayBuffer.isView||function(e){return e&&n.indexOf(Object.prototype.toString.call(e))>-1};d.prototype.append=function(e,t){e=s(e),t=l(t);var n=this.map[e];this.map[e]=n?n+","+t:t},d.prototype.delete=function(e){delete this.map[s(e)]},d.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},d.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},d.prototype.set=function(e,t){this.map[s(e)]=l(t)},d.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},d.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),p(e)},d.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),p(e)},d.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),p(e)},t.iterable&&(d.prototype[Symbol.iterator]=d.prototype.entries);var i=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},f.call(g.prototype),f.call(v.prototype),v.prototype.clone=function(){return new v(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new d(this.headers),url:this.url})},v.error=function(){var e=new v(null,{status:0,statusText:""});return e.type="error",e};var r=[301,302,303,307,308];v.redirect=function(e,t){if(-1===r.indexOf(t))throw new RangeError("Invalid status code");return new v(null,{status:t,headers:{location:e}})},e.Headers=d,e.Request=g,e.Response=v,e.fetch=function(e,n){return new Promise(function(a,o){var i=new g(e,n),r=new XMLHttpRequest;r.onload=function(){var e,t,n={status:r.status,statusText:r.statusText,headers:(e=r.getAllResponseHeaders()||"",t=new d,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(e){var n=e.split(":"),a=n.shift().trim();if(a){var o=n.join(":").trim();t.append(a,o)}}),t)};n.url="responseURL"in r?r.responseURL:n.headers.get("X-Request-URL");var o="response"in r?r.response:r.responseText;a(new v(o,n))},r.onerror=function(){o(new TypeError("Network request failed"))},r.ontimeout=function(){o(new TypeError("Network request failed"))},r.open(i.method,i.url,!0),"include"===i.credentials?r.withCredentials=!0:"omit"===i.credentials&&(r.withCredentials=!1),"responseType"in r&&t.blob&&(r.responseType="blob"),i.headers.forEach(function(e,t){r.setRequestHeader(t,e)}),r.send(void 0===i._bodyInit?null:i._bodyInit)})},e.fetch.polyfill=!0}function s(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var n={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return t.iterable&&(n[Symbol.iterator]=function(){return n}),n}function d(e){this.map={},e instanceof d?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function c(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function u(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function m(e){var t=new FileReader,n=u(t);return t.readAsArrayBuffer(e),n}function h(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function f(){return this.bodyUsed=!1,this._initBody=function(e){if(this._bodyInit=e,e)if("string"==typeof e)this._bodyText=e;else if(t.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(t.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else if(t.arrayBuffer&&t.blob&&a(e))this._bodyArrayBuffer=h(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!t.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(e)&&!o(e))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=h(e)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):t.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},t.blob&&(this.blob=function(){var e=c(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?c(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(m)}),this.text=function(){var e,t,n,a=c(this);if(a)return a;
vendor: 4,553 bytes, line 21
21if(this._bodyBlob)return e=this._bodyBlob,t=new FileReader,n=u(t),t.readAsText(e),n;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),n=new Array(t.length),a=0;a<t.length;a++)n[a]=String.fromCharCode(t[a]);return n.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},t.formData&&(this.formData=function(){return this.text().then(y)}),this.json=function(){return this.text().then(JSON.parse)},this}function g(e,t){var n,a,o=(t=t||{}).body;if(e instanceof g){if(e.bodyUsed)throw new TypeError("Already read");this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new d(e.headers)),this.method=e.method,this.mode=e.mode,o||null==e._bodyInit||(o=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||"omit",!t.headers&&this.headers||(this.headers=new d(t.headers)),this.method=(n=t.method||this.method||"GET",a=n.toUpperCase(),i.indexOf(a)>-1?a:n),this.mode=t.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function y(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var n=e.split("="),a=n.shift().replace(/\+/g," "),o=n.join("=").replace(/\+/g," ");t.append(decodeURIComponent(a),decodeURIComponent(o))}}),t}function v(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new d(t.headers),this.url=t.url||"",this._initBody(e)}}("undefined"!=typeof self?self:this)},{}],13:[function(e,t,n){"use strict";var a=e("./core/main");e("./core/constants"),e("./core/environment"),e("./core/error_helpers"),e("./core/helpers"),e("./core/legacy"),e("./core/p5.Element"),e("./core/p5.Graphics"),e("./core/p5.Renderer"),e("./core/p5.Renderer2D"),e("./core/rendering"),e("./core/shim"),e("./core/structure"),e("./core/transform"),e("./core/shape/2d_primitives"),e("./core/shape/attributes"),e("./core/shape/curves"),e("./core/shape/vertex"),e("./color/color_conversion"),e("./color/creating_reading"),e("./color/p5.Color"),e("./color/setting"),e("./data/p5.TypedDict"),e("./data/local_storage.js"),e("./events/acceleration"),e("./events/keyboard"),e("./events/mouse"),e("./events/touch"),e("./image/filters"),e("./image/image"),e("./image/loading_displaying"),e("./image/p5.Image"),e("./image/pixels"),e("./io/files"),e("./io/p5.Table"),e("./io/p5.TableRow"),e("./io/p5.XML"),e("./math/calculation"),e("./math/math"),e("./math/noise"),e("./math/p5.Vector"),e("./math/random"),e("./math/trigonometry"),e("./typography/attributes"),e("./typography/loading_displaying"),e("./typography/p5.Font"),e("./utilities/array_functions"),e("./utilities/conversion"),e("./utilities/string_functions"),e("./utilities/time_date"),e("./webgl/3d_primitives"),e("./webgl/interaction"),e("./webgl/light"),e("./webgl/loading"),e("./webgl/material"),e("./webgl/p5.Camera"),e("./webgl/p5.Geometry"),e("./webgl/p5.Matrix"),e("./webgl/p5.RendererGL.Immediate"),e("./webgl/p5.RendererGL"),e("./webgl/p5.RendererGL.Retained"),e("./webgl/p5.Shader"),e("./webgl/p5.Texture"),e("./webgl/text"),e("./core/init"),t.exports=a},{"./color/color_conversion":14,"./color/creating_reading":15,"./color/p5.Color":16,"./color/setting":17,"./core/constants":18,"./core/environment":19,"./core/error_helpers":20,"./core/helpers":21,"./core/init":22,"./core/legacy":23,"./core/main":24,"./core/p5.Element":25,"./core/p5.Graphics":26,"./core/p5.Renderer":27,"./core/p5.Renderer2D":28,"./core/rendering":29,"./core/shape/2d_primitives":30,"./core/shape/attributes":31,"./core/shape/curves":32,"./core/shape/vertex":33,"./core/shim":34,"./core/structure":35,"./core/transform":36,"./data/local_storage.js":37,"./data/p5.TypedDict":38,"./events/acceleration":39,"./events/keyboard":40,"./events/mouse":41,"./events/touch":42,"./image/filters":43,"./image/image":44,"./image/loading_displaying":45,"./image/p5.Image":46,"./image/pixels":47,"./io/files":48,"./io/p5.Table":49,"./io/p5.TableRow":50,"./io/p5.XML":51,"./math/calculation":52,"./math/math":53,"./math/noise":54,"./math/p5.Vector":55,"./math/random":56,"./math/trigonometry":57,"./typography/attributes":58,"./typography/loading_displaying":59,"./typography/p5.Font":60,"./utilities/array_functions":61,"./utilities/conversion":62,"./utilities/string_functions":63,"./ut
21ilities/time_date":64,"./webgl/3d_primitives":65,"./webgl/interaction":66,"./webgl/light":67,"./webgl/loading":68,"./webgl/material":69,"./webgl/p5.Camera":70,"./webgl/p5.Geometry":71,"./webgl/p5.Matrix":72,"./webgl/p5.RendererGL":75,"./webgl/p5.RendererGL.Immediate":73,"./webgl/p5.RendererGL.Retained":74,"./webgl/p5.Shader":76,"./webgl/p5.Texture":77,"./webgl/text":78}],14:[function(e,t,n){"use strict";var a=e("../core/main");a.ColorConversion={},a.ColorConversion._hsbaToHSLA=function(e){var t=e[0],n=e[1],a=e[2],o=(2-n)*a/2;return 0!==o&&(1===o?n=0:o<.5?n/=2-n:n=n*a/(2-2*o)),[t,n,o,e[3]]},a.ColorConversion._hsbaToRGBA=function(e){var t=6*e[0],n=e[1],a=e[2],o=[];if(0===n)o=[a,a,a,e[3]];else{var i,r,s,l=Math.floor(t),p=a*(1-n),d=a*(1-n*(t-l)),c=a*(1-n*(1+l-t));1===l?(i=d,r=a,s=p):2===l?(i=p,r=a,s=c):3===l?(i=p,r=d,s=a):4===l?(i=c,r=p,s=a):5===l?(i=a,r=p,s=d):(i=a,r=c,s=p),o=[i,r,s,e[3]]}return o},a.ColorConversion._hslaToHSBA=function(e){var t,n=e[0],a=e[1],o=e[2];return[n,a=2*((t=o<.5?(1+a)*o:o+a-o*a)-o)/t,t,e[3]]},a.ColorConversion._hslaToRGBA=function(e){var t=6*e[0],n=e[1],a=e[2],o=[];if(0===n)o=[a,a,a,e[3]];else{var i,r=2*a-(i=a<.5?(1+n)*a:a+n-a*n),s=function(e,t,n){return e<0?e+=6:e>=6&&(e-=6),e<1?t+(n-t)*e:e<3?n:e<4?t+(n-t)*(4-e):t};o=[s(t+2,r,i),s(t,r,i),s(t-2,r,i),e[3]]}return o},a.ColorConversion._rgbaToHSBA=function(e){var t,n,a=e[0],o=e[1],i=e[2],r=Math.max(a,o,i),s=r-Math.min(a,o,i);return 0===s?(t=0,n=0):(n=s/r,a===r?t=(o-i)/s:o===r?t=2+(i-a)/s:i===r&&(t=4+(a-o)/s),t<0?t+=6:t>=6&&(t-=6)),[t/6,n,r,e[3]]},a.ColorConversion._rgbaToHSLA=function(e){var t,n,a=e[0],o=e[1],i=e[2],r=Math.max(a,o,i),s=Math.min(a,o,i),l=r+s,p=r-s;return 0===p?(t=0,n=0):(n=l<1?p/l:p/(2-l),a===r?t=(o-i)/p:o===r?t=2+(i-a)/p:i===r&&(t=4+(a-o)/p),t<0?t+=6:t>=6&&(t-=6)),[t/6,n,l/2,e[3]]},t.exports=a.ColorConversion},{"../core/main":24}],15:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("../core/constants");e("./p5.Color"),e("../core/error_helpers"),a.prototype.alpha=function(e){return a._validateParameters("alpha",arguments),this.color(e)._getAlpha()},a.prototype.blue=function(e){return a._validateParameters("blue",arguments),this.color(e)._getBlue()},a.prototype.brightness=function(e){return a._validateParameters("brightness",arguments),this.color(e)._getBrightness()},a.prototype.color=function(){if(a._validateParameters("color",arguments),arguments[0]instanceof a.Color)return arguments[0];var e=arguments[0]instanceof Array?arguments[0]:arguments;return new a.Color(this,e)},a.prototype.green=function(e){return a._validateParameters("green",arguments),this.color(e)._getGreen()},a.prototype.hue=function(e){return a._validateParameters("hue",arguments),this.color(e)._getHue()},a.prototype.lerpColor=function(e,t,n){a._validateParameters("lerpColor",arguments);var i,r,s,l,p,d,c=this._colorMode,u=this._colorMaxes;if(c===o.RGB)p=e.levels.map(function(e){return e/255}),d=t.levels.map(function(e){return e/255});else if(c===o.HSB)e._getBrightness(),t._getBrightness(),p=e.hsba,d=t.hsba;else{if(c!==o.HSL)throw new Error(c+"cannot be used for interpolation.");e._getLightness(),t._getLightness(),p=e.hsla,d=t.hsla}return n=Math.max(Math.min(n,1),0),void 0===this.lerp&&(this.lerp=function(e,t,n){return n*(t-e)+e}),i=this.lerp(p[0],d[0],n),r=this.lerp(p[1],d[1],n),s=this.lerp(p[2],d[2],n),l=this.lerp(p[3],d[3],n),i*=u[c][0],r*=u[c][1],s*=u[c][2],l*=u[c][3],this.color(i,r,s,l)},a.prototype.lightness=function(e){return a._validateParameters("lightness",arguments),this.color(e)._getLightness()},a.prototype.red=function(e){return a._validateParameters("red",arguments),this.color(e)._getRed()},a.prototype.saturation=function(e){return a._validateParameters("saturation",arguments),this.color(e)._getSaturation()},t.exports=a},{"../core/constants":18,"../core/error_helpers":20,"../core/main":24,"./p5.Color":16}],16:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("../core/constants"),i=e("./color_conversion");a.Color=function(e,t){if(this._storeModeAndMaxes(e._colorMode,e._colorMaxes),this.mode!==o.RGB&&this.mode!==o.HSL&&this.mode!==o.HSB)throw new Error(this.mode+" is an invali
21d colorMode.");return this._array=a.Color._parseInputs.apply(this,t),this._calculateLevels(),this},a.Color.prototype.toString=function(e){var t=this.levels,n=this._array,a=n[3];switch(e){case"#rrggbb":return"#".concat(t[0]<16?"0".concat(t[0].toString(16)):t[0].toString(16),t[1]<16?"0".concat(t[1].toString(16)):t[1].toString(16),t[2]<16?"0".concat(t[2].toString(16)):t[2].toString(16));case"#rrggbbaa":return"#".concat(t[0]<16?"0".concat(t[0].toString(16)):t[0].toString(16),t[1]<16?"0".concat(t[1].toString(16)):t[1].toString(16),t[2]<16?"0".concat(t[2].toString(16)):t[2].toString(16),t[3]<16?"0".concat(t[2].toString(16)):t[3].toString(16));case"#rgb":return"#".concat(Math.round(15*n[0]).toString(16),Math.round(15*n[1]).toString(16),Math.round(15*n[2]).toString(16));case"#rgba":return"#".concat(Math.round(15*n[0]).toString(16),Math.round(15*n[1]).toString(16),Math.round(15*n[2]).toString(16),Math.round(15*n[3]).toString(16));case"rgb":return"rgb(".concat(t[0],", ",t[1],", ",t[2],")");case"rgb%":return"rgb(".concat((100*n[0]).toPrecision(3),"%, ",(100*n[1]).toPrecision(3),"%, ",(100*n[2]).toPrecision(3),"%)");case"rgba%":return"rgba(".concat((100*n[0]).toPrecision(3),"%, ",(100*n[1]).toPrecision(3),"%, ",(100*n[2]).toPrecision(3),"%, ",(100*n[3]).toPrecision(3),"%)");case"hsb":case"hsv":return this.hsba||(this.hsba=i._rgbaToHSBA(this._array)),"hsb(".concat(this.hsba[0]*this.maxes[o.HSB][0],", ",this.hsba[1]*this.maxes[o.HSB][1],", ",this.hsba[2]*this.maxes[o.HSB][2],")");case"hsb%":case"hsv%":return this.hsba||(this.hsba=i._rgbaToHSBA(this._array)),"hsb(".concat((100*this.hsba[0]).toPrecision(3),"%, ",(100*this.hsba[1]).toPrecision(3),"%, ",(100*this.hsba[2]).toPrecision(3),"%)");case"hsba":case"hsva":return this.hsba||(this.hsba=i._rgbaToHSBA(this._array)),"hsba(".concat(this.hsba[0]*this.maxes[o.HSB][0],", ",this.hsba[1]*this.maxes[o.HSB][1],", ",this.hsba[2]*this.maxes[o.HSB][2],", ",a,")");case"hsba%":case"hsva%":return this.hsba||(this.hsba=i._rgbaToHSBA(this._array)),"hsba(".concat((100*this.hsba[0]).toPrecision(3),"%, ",(100*this.hsba[1]).toPrecision(3),"%, ",(100*this.hsba[2]).toPrecision(3),"%, ",(100*a).toPrecision(3),"%)");case"hsl":return this.hsla||(this.hsla=i._rgbaToHSLA(this._array)),"hsl(".concat(this.hsla[0]*this.maxes[o.HSL][0],", ",this.hsla[1]*this.maxes[o.HSL][1],", ",this.hsla[2]*this.maxes[o.HSL][2],")");case"hsl%":return this.hsla||(this.hsla=i._rgbaToHSLA(this._array)),"hsl(".concat((100*this.hsla[0]).toPrecision(3),"%, ",(100*this.hsla[1]).toPrecision(3),"%, ",(100*this.hsla[2]).toPrecision(3),"%)");case"hsla":return this.hsla||(this.hsla=i._rgbaToHSLA(this._array)),"hsla(".concat(this.hsla[0]*this.maxes[o.HSL][0],", ",this.hsla[1]*this.maxes[o.HSL][1],", ",this.hsla[2]*this.maxes[o.HSL][2],", ",a,")");case"hsla%":return this.hsla||(this.hsla=i._rgbaToHSLA(this._array)),"hsl(".concat((100*this.hsla[0]).toPrecision(3),"%, ",(100*this.hsla[1]).toPrecision(3),"%, ",(100*this.hsla[2]).toPrecision(3),"%, ",(100*a).toPrecision(3),"%)");case"rgba":default:return"rgba(".concat(t[0],",",t[1],",",t[2],",",a,")")}},a.Color.prototype.setRed=function(e){this._array[0]=e/this.maxes[o.RGB][0],this._calculateLevels()},a.Color.prototype.setGreen=function(e){this._array[1]=e/this.maxes[o.RGB][1],this._calculateLevels()},a.Color.prototype.setBlue=function(e){this._array[2]=e/this.maxes[o.RGB][2],this._calculateLevels()},a.Color.prototype.setAlpha=function(e){this._array[3]=e/this.maxes[this.mode][3],this._calculateLevels()},a.Color.prototype._calculateLevels=function(){for(var e=this._array,t=this.levels=new Array(e.length),n=e.length-1;n>=0;--n)t[n]=Math.round(255*e[n])},a.Color.prototype._getAlpha=function(){return this._array[3]*this.maxes[this.mode][3]},a.Color.prototype._storeModeAndMaxes=function(e,t){this.mode=e,this.maxes=t},a.Color.prototype._getMode=function(){return this.mode},a.Color.prototype._getMaxes=function(){return this.maxes},a.Color.prototype._getBlue=function(){return this._array[2]*this.maxes[o.RGB][2]},a.Color.prototype._getBrightness=function(){return this.hsba||(this.hsba=i._rgbaToHSBA(this._array)),this.hsba[2]*this.maxes[o.HSB][2]},a.Color.prototype._getGreen=function(){return this._array[1]*this.maxes[o.RGB][1]},a.Color.prototype._getHue=function(){return this.mode===o.HSB?(this.hsba||(this.hsba=i._rgbaToHSBA(this._array)),this.hsba[0]*this.maxes[o.HSB][0]):(this.hsla||(this.hsla=i._rgbaToHSLA(this._array)),this.hsla[0]*this.maxes[o.HSL][0])}
vendor: 4,118 bytes, line 21
21,a.Color.prototype._getLightness=function(){return this.hsla||(this.hsla=i._rgbaToHSLA(this._array)),this.hsla[2]*this.maxes[o.HSL][2]},a.Color.prototype._getRed=function(){return this._array[0]*this.maxes[o.RGB][0]},a.Color.prototype._getSaturation=function(){return this.mode===o.HSB?(this.hsba||(this.hsba=i._rgbaToHSBA(this._array)),this.hsba[1]*this.maxes[o.HSB][1]):(this.hsla||(this.hsla=i._rgbaToHSLA(this._array)),this.hsla[1]*this.maxes[o.HSL][1])};var r={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"},s=/\s*/,l=/(\d{1,3})/,p=/((?:\d+(?:\.\d+)?)|(?:\.\d+))/,d=new RegExp(p.source+"%"),c={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\\(",l.source,",",l.source,",",l.source,"\\)$"].join(s.source),"i"),RGB_PERCENT:new RegExp(["^rgb\\(",d.source,",",d.source,",",d.source,"\\)$"].join(s.source),"i"),RGBA:new RegExp(["^rgba\\(",l.source,",",l.source,",",l.source,",",p.source,"\\)$"].join(s.source),"i"),RGBA_PERCENT:new RegExp(["^rgba\\(",d.source,",",d.source,",",d.source,",",p.source,"\\)$"].join(s.source),"i"),HSL:new RegExp(["^hsl\\(",l.
21source,",",d.source,",",d.source,"\\)$"].join(s.source),"i"),HSLA:new RegExp(["^hsla\\(",l.source,",",d.source,",",d.source,",",p.source,"\\)$"].join(s.source),"i"),HSB:new RegExp(["^hsb\\(",l.source,",",d.source,",",d.source,"\\)$"].join(s.source),"i"),HSBA:new RegExp(["^hsba\\(",l.source,",",d.source,",",d.source,",",p.source,"\\)$"].join(s.source),"i")};a.Color._parseInputs=function(e,t,n,s){var l,p=arguments.length,d=this.mode,u=this.maxes[d],m=[];if(p>=3){for(m[0]=e/u[0],m[1]=t/u[1],m[2]=n/u[2],m[3]="number"==typeof s?s/u[3]:1,l=m.length-1;l>=0;--l){var h=m[l];h<0?m[l]=0:h>1&&(m[l]=1)}return d===o.HSL?i._hslaToRGBA(m):d===o.HSB?i._hsbaToRGBA(m):m}if(1===p&&"string"==typeof e){var f=e.trim().toLowerCase();if(r[f])return a.Color._parseInputs.call(this,r[f]);if(c.HEX3.test(f))return(m=c.HEX3.exec(f).slice(1).map(function(e){return parseInt(e+e,16)/255}))[3]=1,m;if(c.HEX6.test(f))return(m=c.HEX6.exec(f).slice(1).map(function(e){return parseInt(e,16)/255}))[3]=1,m;if(c.HEX4.test(f))return m=c.HEX4.exec(f).slice(1).map(function(e){return parseInt(e+e,16)/255});if(c.HEX8.test(f))return m=c.HEX8.exec(f).slice(1).map(function(e){return parseInt(e,16)/255});if(c.RGB.test(f))return(m=c.RGB.exec(f).slice(1).map(function(e){return e/255}))[3]=1,m;if(c.RGB_PERCENT.test(f))return(m=c.RGB_PERCENT.exec(f).slice(1).map(function(e){return parseFloat(e)/100}))[3]=1,m;if(c.RGBA.test(f))return m=c.RGBA.exec(f).slice(1).map(function(e,t){return 3===t?parseFloat(e):e/255});if(c.RGBA_PERCENT.test(f))return m=c.RGBA_PERCENT.exec(f).slice(1).map(function(e,t){return 3===t?parseFloat(e):parseFloat(e)/100});if(c.HSL.test(f)?(m=c.HSL.exec(f).slice(1).map(function(e,t){return 0===t?parseInt(e,10)/360:parseInt(e,10)/100}))[3]=1:c.HSLA.test(f)&&(m=c.HSLA.exec(f).slice(1).map(function(e,t){return 0===t?parseInt(e,10)/360:3===t?parseFloat(e):parseInt(e,10)/100})),(m=m.map(function(e){return Math.max(Math.min(e,1),0)})).length)return i._hslaToRGBA(m);if(c.HSB.test(f)?(m=c.HSB.exec(f).slice(1).map(function(e,t){return 0===t?parseInt(e,10)/360:parseInt(e,10)/100}))[3]=1:c.HSBA.test(f)&&(m=c.HSBA.exec(f).slice(1).map(function(e,t){return 0===t?parseInt(e,10)/360:3===t?parseFloat(e):parseInt(e,10)/100})),m.length){for(l=m.length-1;l>=0;--l)m[l]=Math.max(Math.min(m[l],1),0);return i._hsbaToRGBA(m)}m=[1,1,1,1]}else{if(1!==p&&2!==p||"number"!=typeof e)throw new Error(arguments+"is not a valid color representation.");m[0]=e/u[2],m[1]=e/u[2],m[2]=e/u[2],m[3]="number"==typeof t?t/u[3]:1,m=m.map(function(e){return Math.max(Math.min(e,1),0)})}return m},t.exports=a.Color},{"../core/constants":18,"../core/main":24,"./color_conversion":14}],17:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("../core/constants");e("./p5.Color"),a.prototype.background=function(){return this._renderer.background.apply(this._renderer,arguments),this},a.prototype.clear=function(){return this._renderer.clear(),this},a.prototype.colorMode=function(e,t,n,i,r){if(a._validateParameters("colorMode",arguments),e===o.RGB||e===o.HSB||e===o.HSL){this._colorMode=e;var s=this._colorMaxes[e];2===arguments.length?(s[0]=t,s[1]=t,s[2]=t,s[3]=t):4===arguments.length?(s[0]=t,s[1]=n,s[2]=i):5===arguments.length&&(s[0]=t,s[1]=n,s[2]=i,s[3]=r)}return this},a.prototype.fill=function(){return this._renderer._setProperty("_fillSet",!0),this._renderer._setProperty("_doFill",!0),this._renderer.fill.apply(this._renderer,arguments),this},a.prototype.noFill=function(){return this._renderer._setProperty("_doFill",!1),this},a.prototype.noStroke=function(){return this._renderer._setProperty("_doStroke",!1),this},a.prototype.stroke=function(){return this._renderer._setProperty("_strokeSet",!0),this._renderer._setProperty("_doStroke",!0),this._renderer.stroke.apply(this._renderer,arguments),this},t.exports=a},{"../core/constants":18,"../core/main":24,"./p5.Color":16}],18:[function(e,t,n){"use strict";var a=Math.PI;t.exports={P2D:"p2d",WEBGL:"webgl",ARROW:"default",CROSS:"crosshair",HAND:"pointer",MOVE:"move",TEXT:"text",WAIT:"wait",HALF_PI:a/2,PI:a,QUARTER_PI:a/4,TAU:2*a,TWO_PI:2*a,DEGREES:"degrees",RADIANS:"radians",DEG_TO_RAD:a/180,RAD_TO_DEG:180/a,CORNER:"corner",CORNERS:"corners",RADIUS:"radius",RIGHT:"right",LEFT:"left",CENTER:"center",TOP:"top",BOTTOM:"bottom",BASELINE:"alphabetic",POINTS:0,LINES:1,LINE_STRIP:3,LINE_LOOP:2,TRIANGLES:4,TRIANGLE_FAN:6,TRIANGLE_STRIP:5,QUADS:"quads",QUAD_STRIP:"quad_strip",CLOSE:"close",OPEN:"open",CHORD:"chord",PIE:"pie",PROJECT:"square",SQUARE:"butt",ROUND:"round",BEVEL:"bevel",MITER:"miter",RGB:"rgb",HSB:"hsb",HSL:"hsl",AUTO:"auto",ALT:18,BACKSPACE:8,CONTROL:17,DELETE:46,DOWN_ARROW:40,ENTER:13,ESCAPE:27,LEFT_ARROW:37,OPTION:18,RETURN:13,RIGHT_ARROW:39,SHIFT:16,TAB:9,UP_ARROW:38,BLEND:"source-over",ADD:"lighter",DARKEST:"darken",LIGHTEST:"lighten",DIFFERENCE:"difference",SUBTRACT:"subtract",EXCLUSION:"exclusion",MULTIPLY:"multiply",SCREEN:"screen",REPLACE:"copy",OVERLAY:"overlay",HARD_LIGHT:"hard-light",SOFT_LIGHT:"soft-light",DODGE:"color-dodge",BURN:"color-burn",THRESHOLD:"threshold",GRAY:"gray",OPAQUE:"opaque",INVERT:"invert",POSTERIZE:"posterize",DILATE:"dilate",ERODE:"erode",BLUR:"blur",NORMAL:"normal",ITALIC:"italic",BOLD:"bold",BOLDITALIC:"bold italic",_DEFAULT_TEXT_FILL:"#000000",_DEFAULT_LEADMULT:1.25,_CTX_MIDDLE:"middle",LINEAR:"linear",QUADRATIC:"quadratic",BEZIER:"bezier",CURVE:"curve",STROKE:"stroke",FILL:"fill",TEXTURE:"texture",IMMEDIATE:"immediate",IMAGE:"image",NEAREST:"nearest",REPEAT:"repeat",CLAMP:"clamp",MIRROR:"mirror",LANDSCAPE:"landscape",PORTRAIT:"portrait",_DEFAULT_STROKE:"#000000",_DEFAULT_FILL:"#FFFFFF",GRID:"grid",AXES:"axes"}},{}],19:[function(e,t,n){"use strict";var a=e("./main"),o=e("./constants"),i=[o.ARROW,o.CROSS,o.HAND,o.MOVE,o.TEXT,o.WAIT];a.prototype._frameRate=0,a.prototype._lastFrameTime=window.performance.now(),a.prototype._targetFrameRate=60;var r=window.print;function s(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth||0}function l(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight||0}a.prototype.print=function(){arguments.length?console.log.apply(console,arguments):r()},a.prototype.frameCount=0,a.prototype.deltaTime=0,a.prototype.focu
21sed=document.hasFocus(),a.prototype.cursor=function(e,t,n){var a="auto",o=this._curElement.elt;if(i.indexOf(e)>-1)a=e;else if("string"==typeof e){var r="";t&&n&&"number"==typeof t&&"number"==typeof n&&(r=t+" "+n),a="http://"===e.substring(0,7)||"https://"===e.substring(0,8)?"url("+e+") "+r+", auto":/\.(cur|jpg|jpeg|gif|png|CUR|JPG|JPEG|GIF|PNG)$/.test(e)?"url("+e+") "+r+", auto":e}o.style.cursor=a},a.prototype.frameRate=function(e){return a._validateParameters("frameRate",arguments),"number"!=typeof e||e<0?this._frameRate:(this._setProperty("_targetFrameRate",e),this)},a.prototype.getFrameRate=function(){return this.frameRate()},a.prototype.setFrameRate=function(e){return this.frameRate(e)},a.prototype.noCursor=function(){this._curElement.elt.style.cursor="none"},a.prototype.displayWidth=screen.width,a.prototype.displayHeight=screen.height,a.prototype.windowWidth=s(),a.prototype.windowHeight=l(),a.prototype._onresize=function(e){this._setProperty("windowWidth",s()),this._setProperty("windowHeight",l());var t,n=this._isGlobal?window:this;"function"==typeof n.windowResized&&(void 0===(t=n.windowResized(e))||t||e.preventDefault())},a.prototype.width=0,a.prototype.height=0,a.prototype.fullscreen=function(e){if(a._validateParameters("fullscreen",arguments),void 0===e)return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement;e?function(e){if(!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled))throw new Error("Fullscreen not enabled in this browser.");e.requestFullscreen?e.requestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen()}(document.documentElement):document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()},a.prototype.pixelDensity=function(e){var t;return a._validateParameters("pixelDensity",arguments),"number"==typeof e?(e!==this._pixelDensity&&(this._pixelDensity=e,this._pixelsDirty=!0),t=this,this.resizeCanvas(this.width,this.height,!0)):t=this._pixelDensity,t},a.prototype.displayDensity=function(){return window.devicePixelRatio},a.prototype.getURL=function(){return location.href},a.prototype.getURLPath=function(){return location.pathname.split("/").filter(function(e){return""!==e})},a.prototype.getURLParams=function(){for(var e,t=/[?&]([^&=]+)(?:[&=])([^&=]+)/gim,n={};null!=(e=t.exec(location.search));)e.index===t.lastIndex&&t.lastIndex++,n[e[1]]=e[2];return n},t.exports=a},{"./constants":18,"./main":24}],20:[function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o,i=e("./main"),r=e("./constants"),s=["#2D7BB6","#EE9900","#4DB200","#C83C00"];if("undefined"!=typeof IS_MINIFIED)i._validateParameters=i._friendlyFileLoadError=i._friendlyError=function(){};else{for(var l=!1,p=e("../../docs/reference/data.json"),d=JSON.parse(JSON.stringify(p)),c={},u=c.toString,m=["Boolean","Number","String","Function","Array","Date","RegExp","Object","Error"],h=0;h<m.length;h++)c["[object "+m[h]+"]"]=m[h].toLowerCase();var f=function(e){return null==e?e+"":"object"===a(e)||"function"==typeof e?c[u.call(e)]||"object":a(e)},g=function(e,t,n){l&&(console.log("    _ \n /\\| |/\\ \n \\ ` ' /  \n / , . \\  \n \\/|_|\\/ \n\n> p5.js says: Welcome! This is your friendly debugger. To turn me off switch to using “p5.min.js”."),l=!1),"undefined"===f(n)?n="#B40033":"number"===f(n)&&(n=s[n]),"loadX"===t?console.log("> p5.js says: "+e):"load"===t.substring(0,4)?console.log("> p5.js says: "+e+"[https://github.com/processing/p5.js/wiki/Local-server]"):console.log("> p5.js says: "+e+" [http://p5js.org/reference/#p5/"+t+"]")},y={0:{fileType:"image",method:"loadImage",message:" hosting the image online,"},1:{fileType:"XML file",method:"loadXML"},2:{fileType:"table file",method:"loadTable"},3:{fileType:"text file",method:"loadStrings"},4:{fileType:"font",method:"loadFont",message:" hosting the font online,"},5:{fileType:"json",method:"loadJSON"},6:{fileType:"file",method:"loadBytes"},7:{method:"loadX",message:"In case your large file isn't fetched successfully,we recommend splitting the file into smaller segments and fetching those."}};i._friendlyFileLoadError=function(e,t){var n,a=y[e];n=7===e?a.message:"It looks like there was a problem loading your "+a.fileType+". Try checking if the file path ["+t+"] is correct,"+(a.message||"")+" or running a local server.",g(n,a.method,3)},i._friendlyError=function(e,t){g(e,t)};var v={},b=["null","number","string","boolean","constant","function","any","integer"],w=function(e){switch(a(e)){case"number":return!0;case"string":return!isNaN(e);default:return!1}},x=function e(t,n){var o=t instanceof Array,i=!0;if(n.array&&o)for(var r=0;r<t.length;r++){var s=e(t[r],n.array);if(s)return s/2}else if(n.prototype)i=t instanceof n.prototype;else if(n.builtin)switch(n.builtin){case"number":i=w(t);break;case"integer":i=w(t)&&Number(t)===Math.floor(t);break;case"boolean":case"any":i=!0;break;case"array":i=o;break;case"string":i="string"==typeof t;break;case"constant":i=n.values.hasOwnProperty(t);break;case"function":i=t instanceof Function;break;case"null":i=null===t}else i=a(t)===n.t;return i?0:1},S=function(e,t){for(var n=9999,a=0;n>0&&a<t.length;a++){var o=x(e,t[a]);n>o&&(n=o)}return n},k=function(e,t,n,a){var o=0,i=n.formats,r=n.minParams;t<r?o=2*(r-t):t>i.length&&(o=2*(t-i.length));for(var s=0;o<=a&&s<i.length;s++){var l=e[s],p=i[s];null==l?(!p.optional||s<r||s<t)&&(o+=1):o+=S(l,p.types)}return o};i.ValidationError=(((o=function e(t,n){this.message=t,this.func=n,"captureStackTrace"in Error?Error.captureStackTrace(this,e):this.stack=(new Error).stack}).prototype=Object.create(Error.prototype)).name="ValidationError",o.prototype.constructor=o,o),i._friendlyParamError=function(e,t){var n;function r(){return e.format.types.map(function(e){return e.names?e.names.join("|"):e.name}).join("|")}switch(e.type){case"EMPTY_VAR":n=t+"() was expecting "+r()+" for parameter #"+e.position+" (zero-based index), received an empty variable instead. If not intentional, this is often a problem with scope: [https://p5js.org/examples/data-variable-scope.html]";break;case"WRONG_TYPE":var s=e.arg,l=s instanceof Array?"array":null===s?"null":s.name||a(s);n=t+"() was expecting "+r()+" for parameter #"+e.position+" (zero-based index), received "+l+" instead";break;case"TOO_FEW_ARGUMENTS":n=t+"() was expecting at least "+e.minParams+" arguments, but received only "+e.argCount;break;case"TOO_MANY_ARGUMENTS":n=t+"() was expecting no more than "+e.maxParams+" arguments, but received "+e.argCount}if(n){if(i._throwValidationErrors)throw new i.ValidationError(n);try{var p=/Function\.validateParameters.*[\r\n].*[\r\n].*\(([^)]*)
21/.exec((new Error).stack)[1];p&&(n+=" at "+p)}catch(o){}g(n+".",t,3)}},i._validateParameters=function(e,t){if(!i.disableFriendlyErrors){for(var n=(v[e]||(v[e]=function(e){for(var t,n=e.lastIndexOf("."),a=e.substr(n+1),o=e.substr(0,n)||"p5",s=d.classitems,l=0;l<s.length;l++){var p=s[l];if(p.name===a&&p.class===o){t=p;break}}var c=[];if(t.hasOwnProperty("overloads"))for(var u=0;u<t.overloads.length;u++)c.push({formats:t.overloads[u].params});else c.push({formats:t.params||[]});var m={},h=0;return c.forEach(function(t){var n=t.formats;h<n.length&&(h=n.length);for(var a=n.length;a>0&&n[a-1].optional;)a--;t.minParams=a,n.forEach(function(t){t.types=t.type.split("|").map(function n(a){if("[]"===a.substr(a.length-2,2))return{name:a,array:n(a.substr(0,a.length-2))};var o=a.toLowerCase();if("constant"===o){var s;if(m.hasOwnProperty(t.name))s=m[t.name];else{var l={},p=[];s=m[t.name]={values:l,names:p};var d=/either\s+(?:[A-Z0-9_]+\s*,?\s*(?:or)?\s*)+/g.exec(t.description);if("endShape"===e&&"mode"===t.name)l[r.CLOSE]=!0,p.push("CLOSE");else for(var c,u=d[0],h=/[A-Z0-9_]+/g;null!==(c=h.exec(u));){var f=c[0];r.hasOwnProperty(f)&&(l[r[f]]=!0,p.push(f))}}return{name:a,builtin:o,names:s.names,values:s.values}}if("function"===o.substr(0,"function".length)&&(o="function"),b.indexOf(o)>=0)return{name:a,builtin:o};var g=window,y=a.split(".");return"p5"===y[0]&&(g=i,y.shift()),y.forEach(function(e){g=g&&g[e]}),g?{name:a,prototype:g}:{name:a,type:o}})})}),{overloads:c,maxParams:h}}(e))).overloads,a=t.length;a>0&&null==t[a-1];)a--;for(var o,s=99999,l=0;l<n.length;l++){var p=k(t,a,n[l],s);if(0===p)return;s>p&&(s=p,o=l)}if(s>0)for(var c=function(e,t,n){var a=n.formats,o=n.minParams;if(t<o)return[{type:"TOO_FEW_ARGUMENTS",argCount:t,minParams:o}];if(t>a.length)return[{type:"TOO_MANY_ARGUMENTS",argCount:t,maxParams:a.length}];for(var i=[],r=0;r<a.length;r++){var s=e[r],l=a[r];null==s?(!l.optional||r<o||r<t)&&i.push({type:"EMPTY_VAR",position:r,format:l}):S(s,l.types)>0&&i.push({type:"WRONG_TYPE",position:r,format:l,arg:s})}return i}(t,a,n[o]),u=0;u<c.length;u++)i._friendlyParamError(c[u],e)}},i.prototype._validateParameters=i.validateParameters}var T=null,C=function(t,n){var a,o;n||(n=console.log.bind(console)),T||(a={},(T=[].concat((o=function(e){return Object.getOwnPropertyNames(e).filter(function(e){return!("_"===e[0]||e in a||(a[e]=!0,0))}).map(function(t){var n;return n="function"==typeof e[t]?"function":t===t.toUpperCase()?"constant":"variable",{name:t,type:n}})})(i.prototype),o(e("./constants")))).sort(function(e,t){return t.name.length-e.name.length})),T.some(function(e){if(t.message&&null!==t.message.match("\\W?"+e.name+"\\W"))return n("Did you just try to use p5.js's "+e.name+("function"===e.type?"() ":" ")+e.type+"? If so, you may want to move it into your sketch's setup() function.\n\nFor more details, see: https://github.com/processing/p5.js/wiki/p5.js-overview#why-cant-i-assign-variables-using-p5-functions-and-variables-before-setup"),!0})};i.prototype._helpForMisusedAtTopLevelCode=C,"complete"!==document.readyState&&(window.addEventListener("error",C,!1),window.addEventListener("load",function(){window.removeEventListener("error",C,!1)})),t.exports=i},{"../../docs/reference/data.json":1,"./constants":18,"./main":24}],21:[function(e,t,n){"use strict";var a=e("./constants");t.exports={modeAdjust:function(e,t,n,o,i){return i===a.CORNER?{x:e,y:t,w:n,h:o}:i===a.CORNERS?{x:e,y:t,w:n-e,h:o-t}:i===a.RADIUS?{x:e-n,y:t-o,w:2*n,h:2*o}:i===a.CENTER?{x:e-.5*n,y:t-.5*o,w:n,h:o}:void 0}}},{"./constants":18}],22:[function(e,t,n){"use strict";var a=e("../core/main"),o=function(){window.mocha||(window.setup&&"function"==typeof window.setup||window.draw&&"function"==typeof window.draw)&&!a.instance&&new a};"complete"===document.readyState?o():window.addEventListener("load",o,!1)},{"../core/main":24}],23:[function(e,t,n){"use strict";var a=e("./main");a.prototype.pushStyle=function(){throw new Error("pushStyle() not used, see push()")},a.prototype.popStyle=function(){throw new Error("popStyle() not used, see pop()")},a.prototype.popMatrix=function(){throw new Error("popMatrix() not used, see pop()")}
vendor: 7,314 bytes, line 21
21,a.prototype.printMatrix=function(){throw new Error("printMatrix() is not implemented in p5.js, refer to [https://simonsarris.com/a-transformation-class-for-canvas-to-keep-track-of-the-transformation-matrix/] to add your own implementation.")},a.prototype.pushMatrix=function(){throw new Error("pushMatrix() not used, see push()")},t.exports=a},{"./main":24}],24:[function(e,t,n){"use strict";e("./shim");var a=e("./constants"),o=function e(t,n,a){this._setupDone=!1,this._pixelDensity=Math.ceil(window.devicePixelRatio)||1,this._userNode=n,this._curElement=null,this._elements=[],this._glAttributes=null,this._requestAnimId=0,this._preloadCount=0,this._isGlobal=!1,this._loop=!0,this._initializeInstanceVariables(),this._defaultCanvasSize={width:100,height:100},this._events={mousemove:null,mousedown:null,mouseup:null,dragend:null,dragover:null,click:null,dblclick:null,mouseover:null,mouseout:null,keydown:null,keyup:null,keypress:null,touchstart:null,touchmove:null,touchend:null,resize:null,blur:null},this._events.wheel=null,this._loadingScreenId="p5_loading",this._registeredMethods={};for(var o=Object.getOwnPropertyNames(e.prototype._registeredMethods),i=0;i<o.length;i++){var r=o[i];this._registeredMethods[r]=e.prototype._registeredMethods[r].slice()}window.DeviceOrientationEvent&&(this._events.deviceorientation=null),window.DeviceMotionEvent&&!window._isNodeWebkit&&(this._events.devicemotion=null),this._start=function(){this._userNode&&"string"==typeof this._userNode&&(this._userNode=document.getElementById(this._userNode));var t=(this._isGlobal?window:this).preload;if(t){var n=document.getElementById(this._loadingScreenId);if(!n)(n=document.createElement("div")).innerHTML="Loading...",n.style.position="absolute",n.id=this._loadingScreenId,(this._userNode||document.body).appendChild(n);var a=this._preloadMethods;for(var o in a){a[o]=a[o]||e;var i=a[o];i!==e.prototype&&i!==e||(this._isGlobal&&(window[o]=this._wrapPreload(this,o)),i=this),this._registeredPreloadMethods[o]=i[o],i[o]=this._wrapPreload(i,o)}t(),this._runIfPreloadsAreDone()}else this._setup(),this._draw()}.bind(this),this._runIfPreloadsAreDone=function(){var e=this._isGlobal?window:this;if(0===e._preloadCount){var t=document.getElementById(e._loadingScreenId);t&&t.parentNode.removeChild(t),e._setup(),e._draw()}},this._decrementPreload=function(){var e=this._isGlobal?window:this;"function"==typeof e.preload&&(e._setProperty("_preloadCount",e._preloadCount-1),e._runIfPreloadsAreDone())},this._wrapPreload=function(e,t){return function(){return this._incrementPreload(),this._registeredPreloadMethods[t].apply(e,arguments)}.bind(this)},this._incrementPreload=function(){var e=this._isGlobal?window:this;e._setProperty("_preloadCount",e._preloadCount+1)},this._setup=function(){this.createCanvas(this._defaultCanvasSize.width,this._defaultCanvasSize.height,"p2d");var e=this._isGlobal?window:this;if("function"==typeof e.preload)for(var t in this._preloadMethods)e[t]=this._preloadMethods[t][t],e[t]&&this&&(e[t]=e[t].bind(this));"function"==typeof e.setup&&e.setup();for(var n=document.getElementsByTagName("canvas"),a=0;a<n.length;a++){var o=n[a];"true"===o.dataset.hidden&&(o.style.visibility="",delete o.dataset.hidden)}this._setupDone=!0}.bind(this),this._draw=function(){var e=window.performance.now(),t=e-this._lastFrameTime,n=1e3/this._targetFrameRate;(!this._loop||t>=n-5)&&(this.redraw(),this._frameRate=1e3/(e-this._lastFrameTime),this.deltaTime=e-this._lastFrameTime,this._setProperty("deltaTime",this.deltaTime),this._lastFrameTime=e,void 0!==this._updateMouseCoords&&this._updateMouseCoords()),this._loop&&(this._requestAnimId=window.requestAnimationFrame(this._draw))}.bind(this),this._setProperty=function(e,t){this[e]=t,this._isGlobal&&(window[e]=t)}.bind(this),this.remove=function(){var t=document.getElementById(this._loadingScreenId);if(t&&(t.parentNode.removeChild(t),this._incrementPreload()),this._curElement){for(var n in this._loop=!1,this._requestAnimId&&window.cancelAnimationFrame(this._requestAnimId),this._events)window.removeEventListener(n,this._events[n]);for(var a=0;a<this._elements.length;a++){var o=this._elements[a];for(var i in o.elt.parentNode&&o.elt.parentNode.removeChild(o.elt),o._events)o.elt.removeEventListener(i,o._events[i])}var r=this;this._registeredMethods.remove.forEach(function(e){void 0!==e&&e.call(r)})}if(this._isGlobal){for(var s in e.prototype)try{delete window[s]}catch(p){window[s]=void 0}for(var l in this)if(this.hasOwnProperty(l))try{delete window[l]}catch(p){window[l]=void 0}e.instance=null}}.bind(this),this._registeredMethods.init.forEach(function(e){void 0!==e&&e.call(this)},this);var s=this._createFriendlyGlobalFunctionBinder();if(t)t(this);else{for(var l in this._isGlobal=!0,e.instance=this,e.prototype)if("function"==typeof e.prototype[l]){var p=l.substring(2);this._events.hasOwnProperty(p)||(Math.hasOwnProperty(l)&&Math[l]===e.prototype[l]?s(l,e.prototype[l]):s(l,e.prototype[l].bind(this)))}else s(l,e.prototype[l]);for(var d in this)this.hasOwnProperty(d)&&s(d,this[d])}for(var c in this._events){var u=this["_on"+c];if(u){var m=u.bind(this);window.addEventListener(c,m,{passive:!1}),this._events[c]=m}}var h=function(){this._setProperty("focused",!0)}.bind(this),f=function(){this._setProperty("focused",!1)}.bind(this);window.addEventListener("focus",h),window.addEventListener("blur",f),this.registerMethod("remove",function(){window.removeEventListener("focus",h),window.removeEventListener("blur",f)}),"complete"===document.readyState?this._start():window.addEventListener("load",this._start.bind(this),!1)};for(var i in o.prototype._initializeInstanceVariables=function(){this._styles=[],this._bezierDetail=20,this._curveDetail=20,this._colorMode=a.RGB,this._colorMaxes={rgb:[255,255,255,255],hsb:[360,100,100,1],hsl:[360,100,100,1]},this._pixelsDirty=!0,this._downKeys={}},o.instance=null,o.disableFriendlyErrors=!1,a)o.prototype[i]=a[i];o.prototype._preloadMethods={loadJSON:o.prototype,loadImage:o.prototype,loadStrings:o.prototype,loadXML:o.prototype,loadBytes:o.prototype,loadTable:o.prototype,loadFont:o.prototype,loadModel:o.prototype,loadShader:o.prototype},o.prototype._registeredMethods={init:[],pre:[],post:[],remove:[]},o.prototype._registeredPreloadMethods={},o.prototype.registerPreloadMethod=function(e,t){o.prototype._preloadMethods.hasOwnProperty(e)||(o.prototype._preloadMethods[e]=t)},o.prototype.registerMethod=function(e,t){var n=this||o.prototype;n._registeredMethods.hasOwnProperty(e)||(n._registeredMethods[e]=[]),n._registeredMethods[e].push(t)},o.prototype._createFriendlyGlobalFunctionBinder=function(e){var t=(e=e||{}).globalObject||window,n=e.log||console.log.bind(console),a={print:!0};return function(e,i){if(o.disableFriendlyErrors||"undefined"!=typeof IS_MINIFIED||"function"!=typeof i||e in o.prototype._preloadMethods)t[e]=i;else try{if(e in t&&!(e in a))throw new Error('global "'+e+'" already exists');Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){return i},set:function(a){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:a,writable:!0}),n('You just changed the value of "'+e+"\", which was a p5 function. This could cause problems later if you're not careful.")}})}catch(r){n('p5 had problems creating the global function "'+e+'", possibly because your co
21de is already using that name as a variable. You may want to rename your variable to something else.'),t[e]=i}}},t.exports=o},{"./constants":18,"./shim":34}],25:[function(e,t,n){"use strict";var a=e("./main");a.Element=function(e,t){this.elt=e,this._pInst=this._pixelsState=t,this._events={},this.width=this.elt.offsetWidth,this.height=this.elt.offsetHeight},a.Element.prototype.parent=function(e){return void 0===e?this.elt.parentNode:("string"==typeof e?("#"===e[0]&&(e=e.substring(1)),e=document.getElementById(e)):e instanceof a.Element&&(e=e.elt),e.appendChild(this.elt),this)},a.Element.prototype.id=function(e){return void 0===e?this.elt.id:(this.elt.id=e,this.width=this.elt.offsetWidth,this.height=this.elt.offsetHeight,this)},a.Element.prototype.class=function(e){return void 0===e?this.elt.className:(this.elt.className=e,this)},a.Element.prototype.mousePressed=function(e){return a.Element._adjustListener("mousedown",function(t){return this._pInst._setProperty("mouseIsPressed",!0),this._pInst._setMouseButton(t),e.call(this)},this),this},a.Element.prototype.doubleClicked=function(e){return a.Element._adjustListener("dblclick",e,this),this},a.Element.prototype.mouseWheel=function(e){return a.Element._adjustListener("wheel",e,this),this},a.Element.prototype.mouseReleased=function(e){return a.Element._adjustListener("mouseup",e,this),this},a.Element.prototype.mouseClicked=function(e){return a.Element._adjustListener("click",e,this),this},a.Element.prototype.mouseMoved=function(e){return a.Element._adjustListener("mousemove",e,this),this},a.Element.prototype.mouseOver=function(e){return a.Element._adjustListener("mouseover",e,this),this},a.Element.prototype.mouseOut=function(e){return a.Element._adjustListener("mouseout",e,this),this},a.Element.prototype.touchStarted=function(e){return a.Element._adjustListener("touchstart",e,this),this},a.Element.prototype.touchMoved=function(e){return a.Element._adjustListener("touchmove",e,this),this},a.Element.prototype.touchEnded=function(e){return a.Element._adjustListener("touchend",e,this),this},a.Element.prototype.dragOver=function(e){return a.Element._adjustListener("dragover",e,this),this},a.Element.prototype.dragLeave=function(e){return a.Element._adjustListener("dragleave",e,this),this},a.Element._adjustListener=function(e,t,n){return!1===t?a.Element._detachListener(e,n):a.Element._attachListener(e,t,n),this},a.Element._attachListener=function(e,t,n){n._events[e]&&a.Element._detachListener(e,n);var o=t.bind(n);n.elt.addEventListener(e,o,!1),n._events[e]=o},a.Element._detachListener=function(e,t){var n=t._events[e];t.elt.removeEventListener(e,n,!1),t._events[e]=null},a.Element.prototype._setProperty=function(e,t){this[e]=t},t.exports=a.Element},{"./main":24}],26:[function(e,t,n){"use strict";var a=e("./main"),o=e("./constants");a.Graphics=function(e,t,n,i){var r=n||o.P2D;this.canvas=document.createElement("canvas");var s=i._userNode||document.body;for(var l in s.appendChild(this.canvas),a.Element.call(this,this.canvas,i),a.prototype)this[l]||("function"==typeof a.prototype[l]?this[l]=a.prototype[l].bind(this):this[l]=a.prototype[l]);return a.prototype._initializeInstanceVariables.apply(this),this.width=e,this.height=t,this._pixelDensity=i._pixelDensity,r===o.WEBGL?this._renderer=new a.RendererGL(this.canvas,this,!1):this._renderer=new a.Renderer2D(this.canvas,this,!1),i._elements.push(this),this._renderer.resize(e,t),this._renderer._applyDefaults(),this},a.Graphics.prototype=Object.create(a.Element.prototype),a.Graphics.prototype.reset=function(){this._renderer.resetMatrix(),this._renderer.isP3D&&this._renderer._update()},a.Graphics.prototype.remove=function(){this.elt.parentNode&&this.elt.parentNode.removeChild(this.elt);var e=this._pInst._elements.indexOf(this);for(var t in-1!==e&&this._pInst._elements.splice(e,1),this._events)this.elt.removeEventListener(t,this._events[t])},t.exports=a.Graphics},{"./constants":18,"./main":24}],27:[function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=e("./main"),i=e("../core/constants");function r(e){var t=0,n=0;if(e.offsetParent)do{t+=e.offsetLeft,n+=e.offsetTop}while(e=e.offsetParent);else t+=e.offsetLeft,n+=e.offsetTop;return[t,n]}o.Renderer=function(e,t,n){o.Element.call(this,e,t),this.canvas=e,this._pixelsState=t,n?(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=i.NORMAL,this._textAscent=null,this._textDescent=null,this._textAlign=i.LEFT,this._textBaseline=i.BASELINE,this._rectMode=i.CORNER,this._ellipseMode=i.CENTER,this._curveTightness=0,this._imageMode=i.CORNER,this._tint=null,this._doStroke=!0,this._doFill=!0,this._strokeSet=!1,this._fillSet=!1},o.Renderer.prototype=Object.create(o.Element.prototype),o.Renderer.prototype.push=function(){return{properties:{_doStroke:this._doStroke,_strokeSet:this._strokeSet,_doFill:this._doFill,_fillSet:this._fillSet,_tint:this._tint,_imageMode:this._imageMode,_rectMode:this._rectMode,_ellipseMode:this._ellipseMode,_textFont:this._textFont,_textLeading:this._textLeading,_textSize:this._textSize,_textAlign:this._textAlign,_textBaseline:this._textBaseline,_textStyle:this._textStyle}}},o.Renderer.prototype.pop=function(e){e.properties&&Object.assign(this,e.properties)},o.Renderer.prototype.resize=function(e,t){this.width=e,this.height=t,this.elt.width=e*this._pInst._pixelDensity,this.elt.height=t*this._pInst._pixelDensity,this.elt.style.width=e+"px",this.elt.style.height=t+"px",this._isMainCanvas&&(this._pInst._setProperty("width",this.width),this._pInst._setProperty("height",this.height))},o.Renderer.prototype.get=function(e,t,n,a){var i=this._pixelsState,r=i._pixelDensity,s=this.canvas;if(void 0===e&&void 0===t)e=t=0,n=i.width,a=i.height;else if(e*=r,t*=r,void 0===n&&void 0===a)return e<0||t<0||e>=s.width||t>=s.height?[0,0,0,0]:this._getPixel(e,t);var l=new o.Image(n,a);return l.canvas.getContext("2d").drawImage(s,e,t,n*r,a*r,0,0,n,a),l},o.Renderer.prototype.textLeading=function(e){return"number"==typeof e?(this._setProperty("_textLeading",e),this._pInst):this._textLeading},o.Renderer.prototype.textSize=function(e){return"number"==typeof e?(this._setProperty("_textSize",e),this._setProperty("_textLeading",e*i._DEFAULT_LEADMULT),this._applyTextProperties()):this._textSize},o.Renderer.prototype.textStyle=function(e){return e?(e!==i.NORMAL&&e!==i.ITALIC&&e!==i.BOLD&&e!==i.BOLDITALIC||this._setProperty("_textStyle",e),this._applyTextProperties()):this._textStyle},o.Renderer.prototype.textAscent=function(){return null===this._textAscent&&this._updateTextMetrics(),this._textAscent},o.Renderer.prototype.textDescent=function(){return null===this._textDescent&&this._updateTextMetrics(),this._textDescent},o.Renderer.prototype.textAlign=function(e,t){return void 0!==e?(this._setProperty("_textAlign",e),void 0!==t&&this._setProperty("_textBaseline",t),this._applyTextProperties()):{horizontal:this._textAlign,vertical:this._textBaseline}},o.Renderer.prototype.text=function(e,t,n,a,o){var r,s,l,p,d,c,u,m,h=this._pInst,f=Number.MAX_VALUE;if((this._doFill||this._doStroke)&&void 0!==e){if("string"!=typeof e&&(e=e.toString()),r=(e=e.replace(/(\t)/g,"  ")).split("\n"),void 0!==a){for(m=0,l=0;l<r.length;l++)for(d="",u=r[l].split(" "),s=0;s<u.length;s++)c=d+u[s]+" ",this.textWidth(c)>a?(d=u[s]+" ",m+=h.textLeading()):d=c;switch(this._rectMode===i.CENTER&&(t-=a/2,n-=o/2),this._textAlign){case i.CENTER:t+=a/2;break;case i.RIGHT:t+=a}var g=!1;if(void 0!==o){switch(this._textBaseline){case i.BOTTOM:n+=o-m;break;case i.CENTER:n+=(o-m)/2;break;case i.BASELINE:g=!0,this._textBaseline=i.TOP}f=n+o-h.textAscent()}for(l=0;l<r.length;l++){for(d="",u=r[l].split(" "),s=0;s<u.length;s++)c=d+u[s]+" ",this.textWidth(c)>a&&d.length>0?(this._renderText(h,d,t,n,f),d=u[s]+" ",n+=h.textLeading()):d=c;this._renderText(h,d,t,n,f),n+=h.textLeading(),g&&(this._textBaseline=i.BASELINE)}}else{var y=0,v=h.textAlign().vertical;for(v===i.CENTER?y=(r.length-1)*h.textLeading()/2:v===i.BOTTOM&&(y=(r.length-1)*h.textLeading()),p=0;p<r.length;p++)this._renderText(h,r[p],t,n-y,f),n+=h.textLeading()}return h}},o.Renderer.prototype._applyDefaults=function(){return this},o.Renderer.prototype._isOpenType=function(e){return"object"===a(e=e||this._textFont)&&e.font&&e.font.supported},o.Renderer.prototype._updateTextMetrics=function(){if(this._isOpenType())return this._setProperty("_textAscent",this._textFont._textAscent()),this._setProperty("_textDescent",this._textFont._textDescent()),this;var e=document.createElement("span");e.style.fontFamily=this._textFont,e.style.fontSize=this._textSize+"px",e.innerHTML="ABCjgq|";var t=document.createElement("div");t.style.display="inline-block",t.style.width="1px",t.style.height="0px";var n=document.createElement("div");n.appendChild(e),n.appendChild(t),n.style.height="0px",n.style.overflow="hidden",document.body.appendChild(n),t.style.verticalAlign="baseline";var a=r(t),o=r(e),i=a[1]-o[1];t.style.verticalAlign="bottom",a=r(t),o=r(e);var s=a[1]-o[1]-i;return document.body.removeChild(n),this._setProperty("_textAscent",i),this._setProperty("_textDescent",s),this},t.exports=o.Renderer},{"../core/constants":18,"./main":24}],28:[function(e,t,n){"use strict";var a=e("./main"),o=e("./constants"),i=e("../image/filters");
21e("./p5.Renderer");var r="rgba(0,0,0,0)";a.Renderer2D=function(e,t,n){return a.Renderer.call(this,e,t,n),this.drawingContext=this.canvas.getContext("2d"),this._pInst._setProperty("drawingContext",this.drawingContext),this},a.Renderer2D.prototype=Object.create(a.Renderer.prototype),a.Renderer2D.prototype._applyDefaults=function(){this._cachedFillStyle=this._cachedStrokeStyle=void 0,this._setFill(o._DEFAULT_FILL),this._setStroke(o._DEFAULT_STROKE),this.drawingContext.lineCap=o.ROUND,this.drawingContext.font="normal 12px sans-serif"},a.Renderer2D.prototype.resize=function(e,t){a.Renderer.prototype.resize.call(this,e,t),this.drawingContext.scale(this._pInst._pixelDensity,this._pInst._pixelDensity)},a.Renderer2D.prototype.background=function(){if(this.drawingContext.save(),this.resetMatrix(),arguments[0]instanceof a.Image)this._pInst.image(arguments[0],0,0,this.width,this.height);else{var e=this._getFill(),t=this._pInst.color.apply(this._pInst,arguments).toString();this._setFill(t),this.drawingContext.fillRect(0,0,this.width,this.height),this._setFill(e)}this.drawingContext.restore(),this._pixelsState._pixelsDirty=!0},a.Renderer2D.prototype.clear=function(){this.drawingContext.save(),this.resetMatrix(),this.drawingContext.clearRect(0,0,this.width,this.height),this.drawingContext.restore(),this._pixelsState._pixelsDirty=!0},a.Renderer2D.prototype.fill=function(){var e=this._pInst.color.apply(this._pInst,arguments);this._setFill(e.toString())},a.Renderer2D.prototype.stroke=function(){var e=this._pInst.color.apply(this._pInst,arguments);this._setStroke(e.toString())},a.Renderer2D.prototype.image=function(e,t,n,o,i,r,s,l,p){var d;try{this._tint&&(a.MediaElement&&e instanceof a.MediaElement&&e.loadPixels(),e.canvas&&(d=this._getTintedImageCanvas(e))),d||(d=e.canvas||e.elt);var c=1;e.width&&e.width>0&&(c=d.width/e.width),this.drawingContext.drawImage(d,c*t,c*n,c*o,c*i,r,s,l,p)}catch(u){if("NS_ERROR_NOT_AVAILABLE"!==u.name)throw u}this._pixelsState._pixelsDirty=!0},a.Renderer2D.prototype._getTintedImageCanvas=function(e){if(!e.canvas)return e;var t=i._toPixels(e.canvas),n=document.createElement("canvas");n.width=e.canvas.width,n.height=e.canvas.height;for(var a=n.getContext("2d"),o=a.createImageData(e.canvas.width,e.canvas.height),r=o.data,s=0;s<t.length;s+=4){var l=t[s],p=t[s+1],d=t[s+2],c=t[s+3];r[s]=l*this._tint[0]/255,r[s+1]=p*this._tint[1]/255,r[s+2]=d*this._tint[2]/255,r[s+3]=c*this._tint[3]/255}return a.putImageData(o,0,0),n},a.Renderer2D.prototype.blendMode=function(e){if(e===o.SUBTRACT)console.warn("blendMode(SUBTRACT) only works in WEBGL mode.");else{if(e!==o.BLEND&&e!==o.DARKEST&&e!==o.LIGHTEST&&e!==o.DIFFERENCE&&e!==o.MULTIPLY&&e!==o.EXCLUSION&&e!==o.SCREEN&&e!==o.REPLACE&&e!==o.OVERLAY&&e!==o.HARD_LIGHT&&e!==o.SOFT_LIGHT&&e!==o.DODGE&&e!==o.BURN&&e!==o.ADD)throw new Error("Mode "+e+" not recognized.");this.drawingContext.globalCompositeOperation=e}},a.Renderer2D.prototype.blend=function(){var e=this.drawingContext.globalCompositeOperation,t=arguments[arguments.length-1],n=Array.prototype.slice.call(arguments,0,arguments.length-1);this.drawingContext.globalCompositeOperation=t,this._pInst?this._pInst.copy.apply(this._pInst,n):this.copy.apply(this,n),this.drawingContext.globalCompositeOperation=e},a.Renderer2D.prototype.copy=function(){var e,t,n,o,i,r,s,l,p;if(9===arguments.length)e=arguments[0],t=arguments[1],n=arguments[2],o=arguments[3],i=arguments[4],r=arguments[5],s=arguments[6],l=arguments[7],p=arguments[8];else{if(8!==arguments.length)throw new Error("Signature not supported");e=this._pInst,t=arguments[0],n=arguments[1],o=arguments[2],i=arguments[3],r=arguments[4],s=arguments[5],l=arguments[6],p=arguments[7]}a.Renderer2D._copyHelper(this,e,t,n,o,i,r,s,l,p),this._pixelsState._pixelsDirty=!0},a.Renderer2D._copyHelper=function(e,t,n,a,o,i,r,s,l,p){t.loadPixels();var d=t.canvas.width/t.width;e.drawingContext.drawImage(t.canvas,d*n,d*a,d*o,d*i,r,s,l,p)},a.Renderer2D.prototype._getPixel=function(e,t){var n,a,o=this._pixelsState;return o._pixelsDirty?(n=this.drawingContext.getImageData(e,t,1,1).data,a=0):(n=o.pixels,a=4*(Math.floor(e)+Math.floor(t)*this.canvas.width)),[n[a+0],n[a+1],n[a+2],n[a+3]]},a.Renderer2D.prototype.loadPixels=function(){var e=this._pixelsState;if(e._pixelsDirty){e._pixelsDirty=!1;var t=e._pixelDensity,n=this.width*t,a=this.height*t,o=this.drawingContext.getImageData(0,0,n,a);e._setProperty("imageData",o),e._setProperty("pixels",o.data)}},a.Renderer2D.prototype.set=function(e,t,n){e=Math.floor(e),t=Math.floor(t);var o=this._pixelsState;if(n instanceof a.Image)this.drawingContext.save(),this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(o._pixelDensity,o._pixelDensity),this.drawingContext.drawImage(n.canvas,e,t),this.drawingContext.restore(
21),o._pixelsDirty=!0;else{var i=0,r=0,s=0,l=0,p=4*(t*o._pixelDensity*(this.width*o._pixelDensity)+e*o._pixelDensity);if(o.imageData&&!o._pixelsDirty||o.loadPixels.call(o),"number"==typeof n)p<o.pixels.length&&(i=n,r=n,s=n,l=255);else if(n instanceof Array){if(n.length<4)throw new Error("pixel array must be of the form [R, G, B, A]");p<o.pixels.length&&(i=n[0],r=n[1],s=n[2],l=n[3])}else n instanceof a.Color&&p<o.pixels.length&&(i=n.levels[0],r=n.levels[1],s=n.levels[2],l=n.levels[3]);for(var d=0;d<o._pixelDensity;d++)for(var c=0;c<o._pixelDensity;c++)p=4*((t*o._pixelDensity+c)*this.width*o._pixelDensity+(e*o._pixelDensity+d)),o.pixels[p]=i,o.pixels[p+1]=r,o.pixels[p+2]=s,o.pixels[p+3]=l}},a.Renderer2D.prototype.updatePixels=function(e,t,n,a){var o=this._pixelsState,i=o._pixelDensity;void 0===e&&void 0===t&&void 0===n&&void 0===a&&(e=0,t=0,n=this.width,a=this.height),e*=i,t*=i,n*=i,a*=i,this.drawingContext.putImageData(o.imageData,e,t,0,0,n,a),0===e&&0===t&&n===this.width&&a===this.height||(o._pixelsDirty=!0)},a.Renderer2D.prototype._acuteArcToBezier=function(e,t){var n=t/2,a=Math.cos(n),o=Math.sin(n),i=1/Math.tan(n),r=e+n,s=Math.cos(r),l=Math.sin(r),p=(4-a)/3,d=o+(a-p)*i;return{ax:Math.cos(e).toFixed(7),ay:Math.sin(e).toFixed(7),bx:(p*s+d*l).toFixed(7),by:(p*l-d*s).toFixed(7),cx:(p*s-d*l).toFixed(7),cy:(p*l+d*s).toFixed(7),dx:Math.cos(e+t).toFixed(7),dy:Math.sin(e+t).toFixed(7)}},a.Renderer2D.prototype.arc=function(e,t,n,a,i,r,s){var l=this.drawingContext,p=n/2,d=a/2,c=0,u=[];for(e+=p,t+=d;r-i>=1e-5;)c=Math.min(r-i,o.HALF_PI),u.push(this._acuteArcToBezier(i,c)),i+=c;return this._doFill&&(l.beginPath(),u.forEach(function(n,a){0===a&&l.moveTo(e+n.ax*p,t+n.ay*d),l.bezierCurveTo(e+n.bx*p,t+n.by*d,e+n.cx*p,t+n.cy*d,e+n.dx*p,t+n.dy*d)}),s!==o.PIE&&null!=s||l.lineTo(e,t),l.closePath(),l.fill(),this._pixelsState._pixelsDirty=!0),this._doStroke&&(l.beginPath(),u.forEach(function(n,a){0===a&&l.moveTo(e+n.ax*p,t+n.ay*d),l.bezierCurveTo(e+n.bx*p,t+n.by*d,e+n.cx*p,t+n.cy*d,e+n.dx*p,t+n.dy*d)}),s===o.PIE?(l.lineTo(e,t),l.closePath()):s===o.CHORD&&l.closePath(),l.stroke(),this._pixelsState._pixelsDirty=!0),this},a.Renderer2D.prototype.ellipse=function(e){var t=this.drawingContext,n=this._doFill,a=this._doStroke,o=e[0],i=e[1],s=e[2],l=e[3];if(n&&!a){if(this._getFill()===r)return this}else if(!n&&a&&this._getStroke()===r)return this;var p=s/2*.5522847498,d=l/2*.5522847498,c=o+s,u=i+l,m=o+s/2,h=i+l/2;t.beginPath(),t.moveTo(o,h),t.bezierCurveTo(o,h-d,m-p,i,m,i),t.bezierCurveTo(m+p,i,c,h-d,c,h),t.bezierCurveTo(c,h+d,m+p,u,m,u),t.bezierCurveTo(m-p,u,o,h+d,o,h),t.closePath(),n&&(t.fill(),this._pixelsState._pixelsDirty=!0),a&&(t.stroke(),this._pixelsState._pixelsDirty=!0)},a.Renderer2D.prototype.line=function(e,t,n,a){var o=this.drawingContext;return this._doStroke?this._getStroke()===r?this:(o.beginPath(),o.moveTo(e,t),o.lineTo(n,a),o.stroke(),this._pixelsState._pixelsDirty=!0,this):this},a.Renderer2D.prototype.point=function(e,t){var n=this.drawingContext;if(!this._doStroke)return this;if(this._getStroke()===r)return this;var a=this._getStroke(),i=this._getFill();e=Math.round(e),t=Math.round(t),this._setFill(a),n.lineWidth>1?(n.beginPath(),n.arc(e,t,n.lineWidth/2,0,o.TWO_PI,!1),n.fill()):n.fillRect(e,t,1,1),this._setFill(i),this._pixelsState._pixelsDirty=!0},a.Renderer2D.prototype.quad=function(e,t,n,a,o,i,s,l){var p=this.drawingContext,d=this._doFill,c=this._doStroke;if(d&&!c){if(this._getFill()===r)return this}else if(!d&&c&&this._getStroke()===r)return this;return p.beginPath(),p.moveTo(e,t),p.lineTo(n,a),p.lineTo(o,i),p.lineTo(s,l),p.closePath(),d&&p.fill(),c&&p.stroke(),this._pixelsState._pixelsDirty=!0,this},a.Renderer2D.prototype.rect=function(e){var t=e[0],n=e[1],a=e[2],o=e[3],i=e[4],s=e[5],l=e[6],p=e[7],d=this.drawingContext,c=this._doFill,u=this._doStroke;if(c&&!u){if(this._getFill()===r)return this}else if(!c&&u&&this._getStroke()===r)return this;if(d.beginPath(),void 0===i)d.rect(t,n,a,o);else{void 0===s&&(s=i),void 0===l&&(l=s),void 0===p&&(p=l);var m=a/2,h=o/2;a<2*i&&(i=m),o<2*i&&(i=h),a<2*s&&(s=m),o<2*s&&(s=h),a<2*l&&(l=m),o<2*l&&(l=h),a<2*p&&(p=m),o<2*p&&(p=h),d.beginPath(),d.moveTo(t+i,n),d.arcTo(t+a,n,t+a,n+o,s),d.arcTo(t+a,n+o,t,n+o,l),d.arcTo(t,n+o,t,n,p),d.arcTo(t,n,t+a,n,i),d.closePath()}return this._doFill&&d.fill(),this._doStroke&&d.stroke(),this._pixelsState._pixelsDirty=!0,this},a.Renderer2D.prototype.triangle=function(e){var t=this.drawingContext,n=this._doFill,a=this._doStroke,o=e[0],i=e[1],s=e[2],l=e[3],p=e[4],d=e[5];if(n&&!a){if(this._getFill()===r)return this}else if(!n&&a&&this._getStroke()===r)return this;t.beginPath(),t.moveTo(o,i),t.lineTo(s,l),t.lineTo(p,d),t.closePath(),n&&(t.fill(),this._pixelsState._pixelsDirty=!0),a&&(t.stroke(),this._pixelsState._pixelsDirty=!0)},a.Renderer2D.prototype.endShape=function(e,t,n,a,i,r,s){if(0===t.length)return this;if(!this._doStroke&&!this._doFill)return this;var l,p,d,c=e===o.CLOSE;c&&!r&&t.push(t[0]);var u=t.length;if(!n||s!==o.POLYGON&&null!==s)if(!a||s!==o.POLYGON&&null!==s)if(!i||s!==o.POLYGON&&null!==s)if(s===o.POINTS)for(p=0;p<u;p++)l=t[p],this._doStroke&&this._pInst.stroke(l[6]),this._pInst.point(l[0],l[1]);else if(s===o.LINES)for(p=0;p+1<u;p+=2)l=t[p],this._doStroke&&this._pInst.stroke(t[p+1][6]),this._pInst.line(l[0],l[1],t[p+1][0],t[p+1][1]);else if(s===o.TRIANGLES)for(p=0;p+2<u;p+=3)l=t[p],this.drawingContext.beginPath(),this.drawingContext.moveTo(l[0],l[1]),this.drawingContext.lineTo(t[p+1][0],t[p+1][1]),this.drawingContext.lineTo(t[p+2][0],t[p+2][1]),this.drawingContext.closePath(),this._doFill&&(this._pInst.fill(t[p+2][5]),this.drawingContext.fill()),this._doStroke&&(this._pInst.stroke(t[p+2][6]),this.drawingContext.stroke());else if(s===o.TRIANGLE_STRIP)for(p=0;p+1<u;p++)l=t[p],this.drawingContext.beginPath(),this.drawingContext.moveTo(t[p+1][0],t[p+1][1]),this.drawingContext.lineTo(l[0],l[1]),this._doStroke&&this._pInst.stroke(t[p+1][6]),this._doFill&&this._pInst.fill(t[p+1][5]),p+2<u&&(this.drawingContext.lineTo(t[p+2][0],t[p+2][1]),this._doStroke&&this._pInst.stroke(t[p+2][6]),this._doFill&&this._pInst.fill(t[p+2][5])),this._doFillStrokeClose(c);else if(s===o.TRIANGLE_FAN){if(u>2){for(this.drawingContext.beginPath(),p=2;p<u;p++)l=t[p],this.drawingContext.moveTo(t[0][0],t[0][1]),this.drawingContext.lineTo(t[p-1][0],t[p-1][
vendor: 4,194 bytes, line 21
211]),this.drawingContext.lineTo(l[0],l[1]),this.drawingContext.lineTo(t[0][0],t[0][1]),p<u-1&&(this._doFill&&l[5]!==t[p+1][5]||this._doStroke&&l[6]!==t[p+1][6])&&(this._doFill&&(this._pInst.fill(l[5]),this.drawingContext.fill(),this._pInst.fill(t[p+1][5])),this._doStroke&&(this._pInst.stroke(l[6]),this.drawingContext.stroke(),this._pInst.stroke(t[p+1][6])),this.drawingContext.closePath(),this.drawingContext.beginPath());this._doFillStrokeClose(c)}}else if(s===o.QUADS)for(p=0;p+3<u;p+=4){for(l=t[p],this.drawingContext.beginPath(),this.drawingContext.moveTo(l[0],l[1]),d=1;d<4;d++)this.drawingContext.lineTo(t[p+d][0],t[p+d][1]);this.drawingContext.lineTo(l[0],l[1]),this._doFill&&this._pInst.fill(t[p+3][5]),this._doStroke&&this._pInst.stroke(t[p+3][6]),this._doFillStrokeClose(c)}else if(s===o.QUAD_STRIP){if(u>3)for(p=0;p+1<u;p+=2)l=t[p],this.drawingContext.beginPath(),p+3<u?(this.drawingContext.moveTo(t[p+2][0],t[p+2][1]),this.drawingContext.lineTo(l[0],l[1]),this.drawingContext.lineTo(t[p+1][0],t[p+1][1]),this.drawingContext.lineTo(t[p+3][0],t[p+3][1]),this._doFill&&this._pInst.fill(t[p+3][5]),this._doStroke&&this._pInst.stroke(t[p+3][6])):(this.drawingContext.moveTo(l[0],l[1]),this.drawingContext.lineTo(t[p+1][0],t[p+1][1])),this._doFillStrokeClose(c)}else{for(this.drawingContext.beginPath(),this.drawingContext.moveTo(t[0][0],t[0][1]),p=1;p<u;p++)(l=t[p]).isVert&&(l.moveTo?this.drawingContext.moveTo(l[0],l[1]):this.drawingContext.lineTo(l[0],l[1]));this._doFillStrokeClose(c)}else{for(this.drawingContext.beginPath(),p=0;p<u;p++)t[p].isVert?t[p].moveTo?this.drawingContext.moveTo(t[p][0],t[p][1]):this.drawingContext.lineTo(t[p][0],t[p][1]):this.drawingContext.quadraticCurveTo(t[p][0],t[p][1],t[p][2],t[p][3]);this._doFillStrokeClose(c)}else{for(this.drawingContext.beginPath(),p=0;p<u;p++)t[p].isVert?t[p].moveTo?this.drawingContext.moveTo(t[p][0],t[p][1]):this.drawingContext.lineTo(t[p][0],t[p][1]):this.drawingContext.bezierCurveTo(t[p][0],t[p][1],t[p][2],t[p][3],t[p][4],t[p][5]);this._doFillStrokeClose(c)}else if(u>3){var m=[],h=1-this._curveTightness;for(this.drawingContext.beginPath(),this.drawingContext.moveTo(t[1][0],t[1][1]),p=1;p+2<u;p++)l=t[p],m[0]=[l[0],l[1]],m[1]=[l[0]+(h*t[p+1][0]-h*t[p-1][0])/6,l[1]+(h*t[p+1][1]-h*t[p-1][1])/6],m[2]=[t[p+1][0]+(h*t[p][0]-h*t[p+2][0])/6,t[p+1][1]+(h*t[p][1]-h*t[p+2][1])/6],m[3]=[t[p+1][0],t[p+1][1]],this.drawingContext.bezierCurveTo(m[1][0],m[1][1],m[2][0],m[2][1],m[3][0],m[3][1]);c&&this.drawingContext.lineTo(t[p+1][0],t[p+1][1]),this._doFillStrokeClose(c)}return n=!1,a=!1,i=!1,r=!1,c&&t.pop(),this._pixelsState._pixelsDirty=!0,this},a.Renderer2D.prototype.strokeCap=function(e){return e!==o.ROUND&&e!==o.SQUARE&&e!==o.PROJECT||(this.drawingContext.lineCap=e),this},a.Renderer2D.prototype.strokeJoin=function(e){return e!==o.ROUND&&e!==o.BEVEL&&e!==o.MITER||(this.drawingContext.lineJoin=e),this},a.Renderer2D.prototype.strokeWeight=function(e){return this.drawingContext.lineWidth=void 0===e||0===e?1e-4:e,this},a.Renderer2D.prototype._getFill=function(){return this._cachedFillStyle||(this._cachedFillStyle=this.drawingContext.fillStyle),this._cachedFillStyle},a.Renderer2D.prototype._setFill=function(e){e!==this._cachedFillStyle&&(this.drawingContext.fillStyle=e,this._cachedFillStyle=e)},a.Renderer2D.prototype._getStroke=function(){return this._cachedStrokeStyle||(this._cachedStrokeStyle=this.drawingContext.strokeStyle),this._cachedStrokeStyle},a.Renderer2D.prototype._setStroke=function(e){e!==this._cachedStrokeStyle&&(this.drawingContext.strokeStyle=e,this._cachedStrokeStyle=e)},a.Renderer2D.prototype.bezier=function(e,t,n,a,o,i,r,s){return this._pInst.beginShape(),this._pInst.vertex(e,t),this._pInst.bezierVertex(n,a,o,i,r,s),this._pInst.endShape(),this},a.Renderer2D.prototype.curve=function(e,t,n,a,o,i,r,s){return this._pInst.beginShape(),this._pInst.curveVertex(e,t),this._pInst.curveVertex(n,a),this._pInst.curveVertex(o,i),this._pInst.curveVertex(r,s),this._pInst.endShape(),this},a.Renderer2D.prototype._doFillStrokeClose=function(e){e&&this.drawingContext.closePath(),this._doFill&&this.drawingContext.fill(),this._doStroke&&this.drawingContext.stroke(),this._pixelsState._pixelsDirty=!0}
21,a.Renderer2D.prototype.applyMatrix=function(e,t,n,a,o,i){this.drawingContext.transform(e,t,n,a,o,i)},a.Renderer2D.prototype.resetMatrix=function(){return this.drawingContext.setTransform(1,0,0,1,0,0),this.drawingContext.scale(this._pInst._pixelDensity,this._pInst._pixelDensity),this},a.Renderer2D.prototype.rotate=function(e){this.drawingContext.rotate(e)},a.Renderer2D.prototype.scale=function(e,t){return this.drawingContext.scale(e,t),this},a.Renderer2D.prototype.translate=function(e,t){return e instanceof a.Vector&&(t=e.y,e=e.x),this.drawingContext.translate(e,t),this},a.Renderer2D.prototype.text=function(e,t,n,i,r){var s;void 0!==i&&this.drawingContext.textBaseline===o.BASELINE&&(s=!0,this.drawingContext.textBaseline=o.TOP);var l=a.Renderer.prototype.text.apply(this,arguments);return s&&(this.drawingContext.textBaseline=o.BASELINE),l},a.Renderer2D.prototype._renderText=function(e,t,n,a,i){if(!(a>=i))return e.push(),this._isOpenType()?this._textFont._renderPath(t,n,a,{renderer:this}):(this._doStroke&&this._strokeSet&&this.drawingContext.strokeText(t,n,a),this._doFill&&(this._fillSet||this._setFill(o._DEFAULT_TEXT_FILL),this.drawingContext.fillText(t,n,a))),e.pop(),this._pixelsState._pixelsDirty=!0,e},a.Renderer2D.prototype.textWidth=function(e){return this._isOpenType()?this._textFont._textWidth(e,this._textSize):this.drawingContext.measureText(e).width},a.Renderer2D.prototype._applyTextProperties=function(){var e,t=this._pInst;return this._setProperty("_textAscent",null),this._setProperty("_textDescent",null),e=this._textFont,this._isOpenType()&&(e=this._textFont.font.familyName,this._setProperty("_textStyle",this._textFont.font.styleName)),this.drawingContext.font=(this._textStyle||"normal")+" "+(this._textSize||12)+"px "+(e||"sans-serif"),this.drawingContext.textAlign=this._textAlign,this._textBaseline===o.CENTER?this.drawingContext.textBaseline=o._CTX_MIDDLE:this.drawingContext.textBaseline=this._textBaseline,t},a.Renderer2D.prototype.push=function(){return this.drawingContext.save(),a.Renderer.prototype.push.apply(this)},a.Renderer2D.prototype.pop=function(e){this.drawingContext.restore(),this._cachedFillStyle=this.drawingContext.fillStyle,this._cachedStrokeStyle=this.drawingContext.strokeStyle,a.Renderer.prototype.pop.call(this,e)},t.exports=a.Renderer2D},{"../image/filters":43,"./constants":18,"./main":24,"./p5.Renderer":27}],29:[function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=e("./main"),i=e("./constants");e("./p5.Graphics"),e("./p5.Renderer2D"),e("../webgl/p5.RendererGL");var r="defaultCanvas0";o.prototype.createCanvas=function(e,t,n){o._validateParameters("createCanvas",arguments);var a,s=n||i.P2D;if(s===i.WEBGL){if(a=document.getElementById(r)){a.parentNode.removeChild(a);var l=this._renderer;this._elements=this._elements.filter(function(e){return e!==l})}(a=document.createElement("canvas")).id=r,a.classList.add("p5Canvas")}else if(this._defaultGraphicsCreated)a=this.canvas;else{a=document.createElement("canvas");for(var p=0;document.getElementById("defaultCanvas"+p);)p++;r="defaultCanvas"+p,a.id=r,a.classList.add("p5Canvas")}return this._setupDone||(a.dataset.hidden=!0,a.style.visibility="hidden"),this._userNode?this._userNode.appendChild(a):document.body.appendChild(a),s===i.WEBGL?(this._setProperty("_renderer",new o.RendererGL(a,this,!0)),this._elements.push(this._renderer)):this._defaultGraphicsCreated||(this._setProperty("_renderer",new o.Renderer2D(a,this,!0)),this._defaultGraphicsCreated=!0,this._elements.push(this._renderer)),this._renderer.resize(e,t),this._renderer._applyDefaults(),this._renderer},o.prototype.resizeCanvas=function(e,t,n){if(o._validateParameters("resizeCanvas",arguments),this._renderer){var i={};for(var r in this.drawingContext){var s=this.drawingContext[r];"object"!==a(s)&&"function"!=typeof s&&(i[r]=s)}for(var l in this._renderer.resize(e,t),this.width=e,this.height=t,i)try{this.drawingContext[l]=i[l]}catch(p){}n||this.redraw()}},o.prototype.noCanvas=function(){this.canvas&&this.canvas.parentNode.removeChild(this.canvas)},o.prototype.createGraphics=function(e,t,n){return o._validateParameters("createGraphics",arguments),new o.Graphics(e,t,n,this)},o.prototype.blendMode=function(e){o._validateParameters("blendMode",arguments),e===i.NORMAL&&(console.warn("NORMAL has been deprecated for use in blendMode. defaulting to BLEND instead."),e=i.BLEND),this._renderer.blendMode(e)},t.exports=o},{"../webgl/p5.RendererGL":75,"./constants":18,"./main":24,"./p5.Graphics":26,"./p5.Renderer2D":28}],30:[function(e,t,n){"use strict";var a=e("../main"),o=e("../constants"),i=e("../helpers");e("../error_helpers"),a.prototype._normalizeArcAngles=function(e,t,n,a,i){var r;return e-=o.TWO_PI*Math.floor(e/o.TWO_PI),t-=o.TWO_PI*Math.floor(t/o.TWO_PI),r=Math.min(Math.abs(e-t),o.TWO_PI-Math.abs(e-t)),i&&(e=e<=o.HALF_PI?Math.atan(n/a*Math.tan(e)):e>o.HALF_PI&&e<=3*o.HALF_PI?Math.atan(n/a*Math.tan(e))+o.PI:Math.atan(n/a*Math.tan(e))+o.TWO_PI,t=t<=o.HALF_PI?Math.atan(n/a*Math.tan(t)):t>o.HALF_PI&&t<=3*o.HALF_PI?Math.atan(n/a*Math.tan(t))+o.PI:Math.atan(n/a*Math.tan(t))+o.TWO_PI),e>t&&(t+=o.TWO_PI),{start:e,stop:t,correspondToSamePoint:r<1e-5}},a.prototype.arc=function(e,t,n,o,r,s,l,p){if(a._validateParameters("arc",arguments),!this._renderer._doStroke&&!this._renderer._doFill)return this;r=this._toRadians(r),s=this._toRadians(s),n=Math.abs(n),o=Math.abs(o);var d=i.modeAdjust(e,t,n,o,this._renderer._ellipseMode),c=this._normalizeArcAngles(r,s,d.w,d.h,!0);return c.correspondToSamePoint?this._renderer.ellipse([d.x,d.y,d.w,d.h,p]):this._renderer.arc(d.x,d.y,d.w,d.h,c.start,c.stop,l,p),this},a.prototype.ellipse=function(e,t,n,o,r){if(a._validateParameters("ellipse",arguments),!this._renderer._doStroke&&!this._renderer._doFill)return this;n<0&&(n=Math.abs(n)),void 0===o?o=n:o<0&&(o=Math.abs(o));var s=i.modeAdjust(e,t,n,o,this._renderer._ellipseMode);return this._renderer.ellipse([s.x,s.y,s.w,s.h,r]),this},a.prototype.circle=function(){var e=Array.prototype.slice.call(arguments,0,2);return e.push(arguments[2]),e.push(arguments[2]),this.ellipse.apply(this,e)},a.prototype.line=function(){return a._validateParameters("line",arguments),this._renderer._doStroke&&this._renderer.line.apply(this._renderer,arguments),this},a.prototype.point=function(){return a._validateParameters("point",arguments),this._renderer._doStroke&&this._renderer.point.a
21pply(this._renderer,arguments),this},a.prototype.quad=function(){return a._validateParameters("quad",arguments),(this._renderer._doStroke||this._renderer._doFill)&&(this._renderer.isP3D&&12!==arguments.length?this._renderer.quad.call(this._renderer,arguments[0],arguments[1],0,arguments[2],arguments[3],0,arguments[4],arguments[5],0,arguments[6],arguments[7],0):this._renderer.quad.apply(this._renderer,arguments)),this},a.prototype.rect=function(){if(a._validateParameters("rect",arguments),this._renderer._doStroke||this._renderer._doFill){for(var e=i.modeAdjust(arguments[0],arguments[1],arguments[2],arguments[3],this._renderer._rectMode),t=[e.x,e.y,e.w,e.h],n=4;n<arguments.length;n++)t[n]=arguments[n];this._renderer.rect(t)}return this},a.prototype.square=function(e,t,n,a,o,i,r){return this.rect(e,t,n,n,a,o,i,r)},a.prototype.triangle=function(){return a._validateParameters("triangle",arguments),(this._renderer._doStroke||this._renderer._doFill)&&this._renderer.triangle(arguments),this},t.exports=a},{"../constants":18,"../error_helpers":20,"../helpers":21,"../main":24}],31:[function(e,t,n){"use strict";var a=e("../main"),o=e("../constants");a.prototype.ellipseMode=function(e){return a._validateParameters("ellipseMode",arguments),e!==o.CORNER&&e!==o.CORNERS&&e!==o.RADIUS&&e!==o.CENTER||(this._renderer._ellipseMode=e),this},a.prototype.noSmooth=function(){return this.setAttributes("antialias",!1),"imageSmoothingEnabled"in this.drawingContext&&(this.drawingContext.imageSmoothingEnabled=!1),this},a.prototype.rectMode=function(e){return a._validateParameters("rectMode",arguments),e!==o.CORNER&&e!==o.CORNERS&&e!==o.RADIUS&&e!==o.CENTER||(this._renderer._rectMode=e),this},a.prototype.smooth=function(){return this.setAttributes("antialias",!0),"imageSmoothingEnabled"in this.drawingContext&&(this.drawingContext.imageSmoothingEnabled=!0),this},a.prototype.strokeCap=function(e){return a._validateParameters("strokeCap",arguments),e!==o.ROUND&&e!==o.SQUARE&&e!==o.PROJECT||this._renderer.strokeCap(e),this},a.prototype.strokeJoin=function(e){return a._validateParameters("strokeJoin",arguments),e!==o.ROUND&&e!==o.BEVEL&&e!==o.MITER||this._renderer.strokeJoin(e),this},a.prototype.strokeWeight=function(e){return a._validateParameters("strokeWeight",arguments),this._renderer.strokeWeight(e),this},t.exports=a},{"../constants":18,"../main":24}],32:[function(e,t,n){"use strict";var a=e("../main");e("../error_helpers"),a.prototype.bezier=function(){return a._validateParameters("bezier",arguments),this._renderer._doStroke||this._renderer._doFill?(this._renderer.bezier.apply(this._renderer,arguments),this):this},a.prototype.bezierDetail=function(e){return a._validateParameters("bezierDetail",arguments),this._bezierDetail=e,this},a.prototype.bezierPoint=function(e,t,n,o,i){a._validateParameters("bezierPoint",arguments);var r=1-i;return Math.pow(r,3)*e+3*Math.pow(r,2)*i*t+3*r*Math.pow(i,2)*n+Math.pow(i,3)*o},a.prototype.bezierTangent=function(e,t,n,o,i){a._validateParameters("bezierTangent",arguments);var r=1-i;return 3*o*Math.pow(i,2)-3*n*Math.pow(i,2)+6*n*r*i-6*t*r*i+3*t*Math.pow(r,2)-3*e*Math.pow(r,2)},a.prototype.curve=function(){return a._validateParameters("curve",arguments),this._renderer._doStroke&&this._renderer.curve.apply(this._renderer,arguments),this},a.prototype.curveDetail=function(e){return a._validateParameters("curveDetail",arguments),this._curveDetail=e<3?3:e,this},a.prototype.curveTightness=function(e){return a._validateParameters("curveTightness",arguments),this._renderer._curveTightness=e,this},a.prototype.curvePoint=function(e,t,n,o,i){a._validateParameters("curvePoint",arguments);var r=i*i*i,s=i*i;return e*(-.5*r+s-.5*i)+t*(1.5*r-2.5*s+1)+n*(-1.5*r+2*s+.5*i)+o*(.5*r-.5*s)},a.prototype.curveTangent=function(e,t,n,o,i){a._validateParameters("curveTangent",arguments);var r=i*i;return e*(-3*r/2+2*i-.5)+t*(9*r/2-5*i)+n*(-9*r/2+4*i+.5)+o*(3*r/2-i)},t.exports=a},{"../error_helpers":20,"../main":24}],33:[function(e,t,n){"use strict";var a=e("../main"),o=e("../constants"),i=null,r=[],s=[],l=!1,p=!1,d=!1,c=!1,u=!0;a.prototype.beginContour=function(){return s=[],c=!0,this},a.prototype.beginShape=function(e){return a._validateParameters("beginShape",arguments),this._renderer.isP3D?this._renderer.beginShape.apply(this._renderer,arguments):(i=e===o.POINTS||e===o.LINES||e===o.TRIANGLES||e===o.TRIANGLE_FAN||e===o.TRIANGLE_STRIP||e===o.QUADS||e===o.QUAD_STRIP?e:null,r=[],s=[]),this},a.prototype.bezierVertex=function(){if(a._validateParameters("bezierVertex",arguments),this._renderer.isP3D)this._renderer.bezierVertex.apply(this._renderer,arguments);else if(0===r.length)a._friendlyError("vertex() must be used once before calling bezierVertex()","bezierVertex");else{l=!0;for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];e.isVert=!1,c?s.push(e):r.push(e)}return this},a.prototype.curveVertex=function(){return a._validateParameters("curveVertex",arguments),this._renderer.isP3D?this._renderer.curveVertex.apply(this._renderer,arguments):(p=!0,this.vertex(arguments[0],arguments[1])),this},a.prototype.endContour=function(){var e=s[0].slice();e.isVert=s[0].isVert,e.moveTo=!1,s.push(e),u&&(r.push(r[0]),u=!1);for(var t=0;t<s.length;t++)r.push(s[t]);return this},a.prototype.endShape=function(e){if(a._validateParameters("endShape",arguments),this._renderer.isP3D)this._renderer.endShape(e,p,l,d,c,i);else{if(0===r.length)return this;if(!this._renderer._doStroke&&!this._renderer._doFill)return this;var t=e===o.CLOSE;t&&!c&&r.push(r[0]),this._renderer.endShape(e,r,p,l,d,c,i),p=!1,l=!1,d=!1,c=!1,u=!0,t&&r.pop()}return this},a.prototype.quadraticVertex=function(){if(a._validateParameters("quadraticVertex",arguments),this._renderer.isP3D)this._renderer.quadraticVertex.apply(this._renderer,arguments);else{if(this._contourInited){var e={};return e.x=arguments[0],e.y=arguments[1],e.x3=arguments[2],e.y3=arguments[3],e.type=o.QUADRATIC,this._contourVertices.push(e),this}if(r.length>0){d=!0;for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.isVert=!1,c?s.push(t):r.push(t)}else a._friendlyError("vertex() must be used once before calling quadraticVertex()","quadraticVertex")}return this},a.prototype.vertex=function(e,t,n,a,o){if(this._renderer.isP3D)this._renderer.vertex.apply(this._renderer,arguments);else{var i=[];i.isVert=!0,i[0]=e,i[1]=t,i[2]=0,i[3]=0,i[4]=0,i[5]=this._renderer._getFill(),i[6]=this._renderer._getStroke(),n&&(i.moveTo=n),c?(0===s.length&&(i.moveTo=!0),s.push(i)):r.push(i)}return this},t.exports=a},{"../constants":18,"../main":24}],34:[function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e,t){window.setTimeout(e,1e3/60)},"undefined"==typeof Uint8ClampedArray||Uint8ClampedArray.prototype.slice||Object.defineProperty(Uint8ClampedArray.prototype,"slice",{value:Array.prototype.slice,writable:!0,configurable:!0,enumerable:!1}),function(){if(!Object.assign){var e=Object.keys,t=Object.defineProperty,n="function"==typeof Symbol&&"symbol"===a(Symbol()),o=Object.prototype.propertyIsEnumerable,i=function(e){return function(t){return o.call(e,t)}};t(Object,"assign",{value:function(t,a){if(null==t)throw new TypeError("target must be an object");var o,r,s,l,p=Object(t);for(o=1;o<arguments.length;++o)for(r=Object(arguments[o]),l=e(r),n&&Object.getOwnPropertySymbols&&l.push.apply(l,Object.getOwnPropertySymbols(r).filter(i(r))),s=0;s<l.length;++s)p[l[s]]=r[l[s]];return p},configurable:!0,enumerable:!1,writable:!0})}}()},{}],35:[function(e,t,n){"use strict";var a=e("./main");a.prototype.noLoop=function(){this._loop=!1},a.prototype.loop=function(){this._loop||(this._loop=!0,this._setupDone&&this._draw())},a.prototype.push=function(){this._styles.push({props:{_colorMode:this._colorMode},renderer:this._renderer.push()})},a.prototype.pop=function(){var e=this._styles.pop();e?(this._renderer.pop(e.renderer),Object.assign(this,e.props)):console.warn("pop() was called without matching push()")},a.prototype.redraw=function(e){if(!this._inUserDraw&&this._setupDone){var t=parseInt(e);(isNaN(t)||t<1)&&(t=1);var n=this._isGlobal?window:this,a=n.setup,o=n.draw;if("function"==typeof o){void 0===a&&n.scale(n._pixelDensity,n._pixelDensity);for(var i=function(e){e.call(n)},r=0;r<t;r++){n.resetMatrix(),n._renderer.isP3D&&n._renderer._update(),n._setProperty("frameCount",n.frameCount+1),n._registeredMethods.pre.forEach(i),this._inUserDraw=!0;try{o()}finally{this._inUserDraw=!1}n._registeredMethods.post.forEach(i)}}}},t.exports=a},{"./main":24}],36:[function(e,t,n){"use strict";var a=e("./main");
vendor: 9,139 bytes, line 21
21a.prototype.applyMatrix=function(e,t,n,a,o,i){return this._renderer.applyMatrix.apply(this._renderer,arguments),this},a.prototype.resetMatrix=function(){return this._renderer.resetMatrix(),this},a.prototype.rotate=function(e,t){return a._validateParameters("rotate",arguments),this._renderer.rotate(this._toRadians(e),t),this},a.prototype.rotateX=function(e){return this._assert3d("rotateX"),a._validateParameters("rotateX",arguments),this._renderer.rotateX(this._toRadians(e)),this},a.prototype.rotateY=function(e){return this._assert3d("rotateY"),a._validateParameters("rotateY",arguments),this._renderer.rotateY(this._toRadians(e)),this},a.prototype.rotateZ=function(e){return this._assert3d("rotateZ"),a._validateParameters("rotateZ",arguments),this._renderer.rotateZ(this._toRadians(e)),this},a.prototype.scale=function(e,t,n){if(a._validateParameters("scale",arguments),e instanceof a.Vector){var o=e;e=o.x,t=o.y,n=o.z}else if(e instanceof Array){var i=e;e=i[0],t=i[1],n=i[2]||1}return isNaN(t)?t=n=e:isNaN(n)&&(n=1),this._renderer.scale.call(this._renderer,e,t,n),this},a.prototype.shearX=function(e){a._validateParameters("shearX",arguments);var t=this._toRadians(e);return this._renderer.applyMatrix(1,0,Math.tan(t),1,0,0),this},a.prototype.shearY=function(e){a._validateParameters("shearY",arguments);var t=this._toRadians(e);return this._renderer.applyMatrix(1,Math.tan(t),0,1,0,0),this},a.prototype.translate=function(e,t,n){return a._validateParameters("translate",arguments),this._renderer.isP3D?this._renderer.translate(e,t,n):this._renderer.translate(e,t),this},t.exports=a},{"./main":24}],37:[function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=e("../core/main");o.prototype.storeItem=function(e,t){void 0===t&&console.log("You cannot store undefined variables using storeItem()");var n=a(t);switch(n){case"number":case"boolean":t=t.toString();break;case"object":t instanceof o.Color&&(n="p5.Color"),t=JSON.stringify(t)}localStorage.setItem(e,t);var i=e+"p5TypeID";localStorage.setItem(i,n)},o.prototype.getItem=function(e){var t=localStorage.getItem(e),n=localStorage.getItem(e+"p5TypeID");if(void 0===n)console.log("Unable to determine type of item stored under "+e+"in local storage. Did you save the item with something other than setItem()?");else if(null!==t)switch(n){case"number":t=parseInt(t);break;case"boolean":t="true"===t;break;case"object":t=JSON.parse(t);break;case"p5.Color":t=JSON.parse(t),t=this.color.apply(this,t.levels)}return t},o.prototype.clearStorage=function(){localStorage.clear()},o.prototype.removeItem=function(e){"string"!=typeof e&&console.log("The argument that you passed to removeItem() - "+e+" is not a string."),localStorage.removeItem(e),localStorage.removeItem(e+"p5TypeID")}},{"../core/main":24}],38:[function(e,t,n){"use strict";var a=e("../core/main");a.prototype.createStringDict=function(e,t){return a._validateParameters("createStringDict",arguments),new a.StringDict(e,t)},a.prototype.createNumberDict=function(e,t){return a._validateParameters("createNumberDict",arguments),new a.NumberDict(e,t)},a.TypedDict=function(e,t){return e instanceof Object?this.data=e:(this.data={},this.data[e]=t),this},a.TypedDict.prototype.size=function(){return Object.keys(this.data).length},a.TypedDict.prototype.hasKey=function(e){return this.data.hasOwnProperty(e)},a.TypedDict.prototype.get=function(e){if(this.data.hasOwnProperty(e))return this.data[e];console.log(e+" does not exist in this Dictionary")},a.TypedDict.prototype.set=function(e,t){this._validate(t)?this.data[e]=t:console.log("Those values dont work for this dictionary type.")},a.TypedDict.prototype._addObj=function(e){for(var t in e)this.set(t,e[t])},a.TypedDict.prototype.create=function(e,t){e instanceof Object&&void 0===t?this._addObj(e):void 0!==e?this.set(e,t):console.log("In order to create a new Dictionary entry you must pass an object or a key, value pair")},a.TypedDict.prototype.clear=function(){this.data={}},a.TypedDict.prototype.remove=function(e){if(!this.data.hasOwnProperty(e))throw new Error(e+" does not exist in this Dictionary");delete this.data[e]},a.TypedDict.prototype.print=function(){for(var e in this.data)console.log("key:"+e+" value:"+this.data[e])},a.TypedDict.prototype.saveTable=function(e){var t="";for(var n in this.data)t+=n+","+this.data[n]+"\n";var o=new Blob([t],{type:"text/csv"});a.prototype.downloadFile(o,e||"mycsv","csv")},a.TypedDict.prototype.saveJSON=function(e,t){a.prototype.saveJSON(this.data,e,t)},a.TypedDict.prototype._validate=function(e){return!0},a.StringDict=function(){a.TypedDict.apply(this,arguments)},a.StringDict.prototype=Object.create(a.TypedDict.prototype),a.StringDict.prototype._validate=function(e){return"string"==typeof e},a.NumberDict=function(){a.TypedDict.apply(this,arguments)},a.NumberDict.prototype=Object.create(a.TypedDict.prototype),a.NumberDict.prototype._validate=function(e){return"number"==typeof e},a.NumberDict.prototype.add=function(e,t){this.data.hasOwnProperty(e)?this.data[e]+=t:console.log("The key - "+e+" does not exist in this dictionary.")},a.NumberDict.prototype.sub=function(e,t){this.add(e,-t)},a.NumberDict.prototype.mult=function(e,t){this.data.hasOwnProperty(e)?this.data[e]*=t:console.log("The key - "+e+" does not exist in this dictionary.")},a.NumberDict.prototype.div=function(e,t){this.data.hasOwnProperty(e)?this.data[e]/=t:console.log("The key - "+e+" does not exist in this dictionary.")},a.NumberDict.prototype._valueTest=function(e){if(0===Object.keys(this.data).length)throw new Error("Unable to search for a minimum or maximum value on an empty NumberDict");if(1===Object.keys(this.data).length)return this.data[Object.keys(this.data)[0]];var t=this.data[Object.keys(this.data)[0]];for(var n in this.data)this.data[n]*e<t*e&&(t=this.data[n]);return t},a.NumberDict.prototype.minValue=function(){return this._valueTest(1)},a.NumberDict.prototype.maxValue=function(){return this._valueTest(-1)},a.NumberDict.prototype._keyTest=function(e){if(0===Object.keys(this.data).length)throw new Error("Unable to use minValue on an empty NumberDict");if(1===Object.keys(this.data).length)return Object.keys(this.data)[0];for(var t=Object.keys(this.data)[0],n=1;n<Object.keys(this.data).length;n++)Object.keys(this.data)[n]*e<t*e&&(t=Object.keys(this.data)[n]);return t},a.NumberDict.prototype.minKey=function(){return this._keyTest(1)},a.NumberDict.prototype.maxKey=function(){return this._keyTest(-1)},t.exports=a.TypedDict},{"../core/main":24}],39:[function(e,t,n){"use strict";var a=e("../core/main");a.prototype.deviceOrientation=void 0,a.prototype.accelerationX=0,a.prototype.accelerationY=0,a.prototype.accelerationZ=0,a.prototype.pAccelerationX=0,a.prototype.pAccelerationY=0,a.prototype.pAccelerationZ=0,a.prototype._updatePAccelerations=function(){this._setProperty("pAccelerationX",this.accelerationX),this._setProperty("pAccelerationY",this.accelerationY),this._setProperty("pAccelerationZ",this.accelerationZ)},a.prototype.rotationX=0,a.prototype.rotationY=0,a.prototype.rotationZ=0,a.prototype.pRotationX=0,a.prototype.pRotationY=0,a.prototype.pRotationZ=0;var o,i,r,s=0,l=0,p=0,d="clockwise",c="clockwise",u="clockwise";a.prototype._updatePRotations=function(){this._setProperty("pRotationX",this.rotationX),this._setProperty("pRotationY",this.rotationY),this._setProperty("pRotationZ",this.rotationZ)},a.prototype.turnAxis=void 0;var m=.5,h=30;a.prototype.setMoveThreshold=function(e){a._validateParameters("setMoveThreshold",arguments),m=e},a.prototype.setShakeThreshold=function(e){a._validateParameters("setShakeThreshold",arguments),h=e},a.prototype._ondeviceorientation=function(e){this._updatePRotations(),this._setProperty("rotationX",e.beta),this._setProperty("rotationY",e.gamma),this._setProperty("rotationZ",e.alpha),this._handleMotion()},a.prototype._ondevicemotion=function(e){this._updatePAccelerations(),this._setProperty("accelerationX",2*e.acceleration.x),this._setProperty("accelerationY",2*e.acceleration.y),this._setProperty("accelerationZ",2*e.acceleration.z),this._handleMotion()},a.prototype._handleMotion=function(){90===window.orientation||-90===window.orientation?this._setProperty("deviceOrientation","landscape"):0===window.orientation?this._setProperty("deviceOrientation","portrait"):void 0===window.orientation&&this._setProperty("deviceOrientation","undefined");var e=this.deviceMoved||window.deviceMoved;"function"==typeof e&&(Math.abs(this.accelerationX-this.pAccelerationX)>m||Math.abs(this.accelerationY-this.pAccelerationY)>m||Math.abs(this.accelerationZ-this.pAccelerationZ)>m)&&e();var t=this.deviceTurned||window.deviceTurned;if("function"==typeof t){var n=this.rotationX+180,a=this.pRotationX+180,f=s+180;n-a>0&&n-a<270||n-a<-270?d="clockwise":(n-a<0||n-a>270)&&(d="counter-clockwise"),d!==o&&(f=n),Math.abs(n-f)>90&&Math.abs(n-f)<270&&(f=n,this._setProperty("turnAxis","X"),t()),o=d,s=f-180;var g=this.rotationY+180,y=this.pRotationY+180,v=l+180;g-y>
210&&g-y<270||g-y<-270?c="clockwise":(g-y<0||g-this.pRotationY>270)&&(c="counter-clockwise"),c!==i&&(v=g),Math.abs(g-v)>90&&Math.abs(g-v)<270&&(v=g,this._setProperty("turnAxis","Y"),t()),i=c,l=v-180,this.rotationZ-this.pRotationZ>0&&this.rotationZ-this.pRotationZ<270||this.rotationZ-this.pRotationZ<-270?u="clockwise":(this.rotationZ-this.pRotationZ<0||this.rotationZ-this.pRotationZ>270)&&(u="counter-clockwise"),u!==r&&(p=this.rotationZ),Math.abs(this.rotationZ-p)>90&&Math.abs(this.rotationZ-p)<270&&(p=this.rotationZ,this._setProperty("turnAxis","Z"),t()),r=u,this._setProperty("turnAxis",void 0)}var b,w,x=this.deviceShaken||window.deviceShaken;"function"==typeof x&&(null!==this.pAccelerationX&&(b=Math.abs(this.accelerationX-this.pAccelerationX),w=Math.abs(this.accelerationY-this.pAccelerationY)),b+w>h&&x())},t.exports=a},{"../core/main":24}],40:[function(e,t,n){"use strict";var a=e("../core/main");a.prototype.isKeyPressed=!1,a.prototype.keyIsPressed=!1,a.prototype.key="",a.prototype.keyCode=0,a.prototype._onkeydown=function(e){if(!this._downKeys[e.which]){this._setProperty("isKeyPressed",!0),this._setProperty("keyIsPressed",!0),this._setProperty("keyCode",e.which),this._downKeys[e.which]=!0,this._setProperty("key",e.key||String.fromCharCode(e.which)||e.which);var t=this.keyPressed||window.keyPressed;if("function"==typeof t&&!e.charCode)!1===t(e)&&e.preventDefault()}},a.prototype._onkeyup=function(e){var t=this.keyReleased||window.keyReleased;(this._downKeys[e.which]=!1,this._areDownKeys()||(this._setProperty("isKeyPressed",!1),this._setProperty("keyIsPressed",!1)),this._setProperty("_lastKeyCodeTyped",null),this._setProperty("key",e.key||String.fromCharCode(e.which)||e.which),this._setProperty("keyCode",e.which),"function"==typeof t)&&(!1===t(e)&&e.preventDefault())},a.prototype._onkeypress=function(e){if(e.which!==this._lastKeyCodeTyped){this._setProperty("_lastKeyCodeTyped",e.which),this._setProperty("key",String.fromCharCode(e.which));var t=this.keyTyped||window.keyTyped;if("function"==typeof t)!1===t(e)&&e.preventDefault()}},a.prototype._onblur=function(e){this._downKeys={}},a.prototype.keyIsDown=function(e){return a._validateParameters("keyIsDown",arguments),this._downKeys[e]||!1},a.prototype._areDownKeys=function(){for(var e in this._downKeys)if(this._downKeys.hasOwnProperty(e)&&!0===this._downKeys[e])return!0;return!1},t.exports=a},{"../core/main":24}],41:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("../core/constants");a.prototype._hasMouseInteracted=!1,a.prototype.mouseX=0,a.prototype.mouseY=0,a.prototype.pmouseX=0,a.prototype.pmouseY=0,a.prototype.winMouseX=0,a.prototype.winMouseY=0,a.prototype.pwinMouseX=0,a.prototype.pwinMouseY=0,a.prototype.mouseButton=0,a.prototype.mouseIsPressed=!1,a.prototype._updateNextMouseCoords=function(e){if(null!==this._curElement&&(!e.touches||e.touches.length>0)){var t=function(e,t,n,a){a&&!a.clientX&&(a.touches?a=a.touches[0]:a.changedTouches&&(a=a.changedTouches[0]));var o=e.getBoundingClientRect(),i=e.scrollWidth/t||1,r=e.scrollHeight/n||1;return{x:(a.clientX-o.left)/i,y:(a.clientY-o.top)/r,winX:a.clientX,winY:a.clientY,id:a.identifier}}(this._curElement.elt,this.width,this.height,e);this._setProperty("mouseX",t.x),this._setProperty("mouseY",t.y),this._setProperty("winMouseX",t.winX),this._setProperty("winMouseY",t.winY)}this._hasMouseInteracted||(this._updateMouseCoords(),this._setProperty("_hasMouseInteracted",!0))},a.prototype._updateMouseCoords=function(){this._setProperty("pmouseX",this.mouseX),this._setProperty("pmouseY",this.mouseY),this._setProperty("pwinMouseX",this.winMouseX),this._setProperty("pwinMouseY",this.winMouseY),this._setProperty("_pmouseWheelDeltaY",this._mouseWheelDeltaY)},a.prototype._setMouseButton=function(e){1===e.button?this._setProperty("mouseButton",o.CENTER):2===e.button?this._setProperty("mouseButton",o.RIGHT):this._setProperty("mouseButton",o.LEFT)},a.prototype._onmousemove=function(e){var t=this._isGlobal?window:this;this._updateNextMouseCoords(e),this.mouseIsPressed?"function"==typeof t.mouseDragged?!1===t.mouseDragged(e)&&e.preventDefault():"function"==typeof t.touchMoved&&!1===t.touchMoved(e)&&e.preventDefault():"function"==typeof t.mouseMoved&&!1===t.mouseMoved(e)&&e.preventDefault()},a.prototype._onmousedown=function(e){var t=this._isGlobal?window:this;this._setProperty("mouseIsPressed",!0),this._setMouseButton(e),this._updateNextMouseCoords(e),"function"==typeof t.mousePressed?!1===t.mousePressed(e)&&e.preventDefault():navigator.userAgent.toLowerCase().includes("safari")&&"function"==typeof t.touchStarted&&!1===t.touchStarted(e)&&e.preventDefault()},a.prototype._onmouseup=function(e){var t=this._isGlobal?window:this;this._setProperty("mouseIsPressed",!1),"function"==typeof t.mouseReleased?!1===t.mouseReleased(e)&&e.preventDefault():"function"==typeof t.touchEnded&&!1===t.touchEnded(e)&&e.preventDefault()},a.prototype._ondragend=a.prototype._onmouseup,a.prototype._ondragover=a.prototype._onmousemove,a.prototype._onclick=function(e){var t=this._isGlobal?window:this;"function"==typeof t.mouseClicked&&(!1===t.mouseClicked(e)&&e.preventDefault())},a.prototype._ondblclick=function(e){var t=this._isGlobal?window:this;"function"==typeof t.doubleClicked&&(!1===t.doubleClicked(e)&&e.preventDefault())},a.prototype._mouseWheelDeltaY=0,a.prototype._pmouseWheelDeltaY=0,a.prototype._onw
21heel=function(e){var t=this._isGlobal?window:this;(this._setProperty("_mouseWheelDeltaY",e.deltaY),"function"==typeof t.mouseWheel)&&(e.delta=e.deltaY,!1===t.mouseWheel(e)&&e.preventDefault())},t.exports=a},{"../core/constants":18,"../core/main":24}],42:[function(e,t,n){"use strict";var a=e("../core/main");function o(e,t,n,a,o){o=o||0;var i=e.getBoundingClientRect(),r=e.scrollWidth/t||1,s=e.scrollHeight/n||1,l=a.touches[o]||a.changedTouches[o];return{x:(l.clientX-i.left)/r,y:(l.clientY-i.top)/s,winX:l.clientX,winY:l.clientY,id:l.identifier}}a.prototype.touches=[],a.prototype._updateTouchCoords=function(e){if(null!==this._curElement){for(var t=[],n=0;n<e.touches.length;n++)t[n]=o(this._curElement.elt,this.width,this.height,e,n);this._setProperty("touches",t)}},a.prototype._ontouchstart=function(e){var t=this._isGlobal?window:this;this._setProperty("mouseIsPressed",!0),this._updateTouchCoords(e),this._updateNextMouseCoords(e),this._updateMouseCoords(),"function"==typeof t.touchStarted?!1===t.touchStarted(e)&&e.preventDefault():navigator.userAgent.toLowerCase().includes("safari")&&"function"==typeof t.touchStarted&&!1===t.mousePressed(e)&&e.preventDefault()},a.prototype._ontouchmove=function(e){var t=this._isGlobal?window:this;this._updateTouchCoords(e),this._updateNextMouseCoords(e),"function"==typeof t.touchMoved?!1===t.touchMoved(e)&&e.preventDefault():"function"==typeof t.mouseDragged&&!1===t.mouseDragged(e)&&e.preventDefault()},a.prototype._ontouchend=function(e){this._setProperty("mouseIsPressed",!1),this._updateTouchCoords(e),this._updateNextMouseCoords(e);var t=this._isGlobal?window:this;"function"==typeof t.touchEnded?!1===t.touchEnded(e)&&e.preventDefault():"function"==typeof t.mouseReleased&&!1===t.mouseReleased(e)&&e.preventDefault()},t.exports=a},{"../core/main":24}],43:[function(e,t,n){"use strict";var a,o,i,r,s={};function l(e,t){for(var n,l,p,d,c,u,m,h,f,g,y=s._toPixels(e),v=e.width,b=e.height,w=v*b,x=new Int32Array(w),S=0;S<w;S++)x[S]=s._getARGB(y,S);var k,T,C,_,E=new Int32Array(w),M=new Int32Array(w),j=new Int32Array(w),I=new Int32Array(w),R=0;for(function(e){var t=3.5*e|0;if(a!==(t=t<1?1:t<248?t:248)){o=1+(a=t)<<1,i=new Int32Array(o),r=new Array(o);for(var n=0;n<o;n++)r[n]=new Int32Array(256);for(var s,l,p,d,c=1,u=t-1;c<t;c++){i[t+c]=i[u]=l=u*u,p=r[t+c],d=r[u--];for(var m=0;m<256;m++)p[m]=d[m]=l*m}s=i[t]=t*t,p=r[t];for(var h=0;h<256;h++)p[h]=s*h}}(t),T=0;T<b;T++){for(k=0;k<v;k++){if(d=p=l=c=n=0,(u=k-a)<0)g=-u,u=0;else{if(u>=v)break;g=0}for(C=g;C<o&&!(u>=v);C++){var N=x[u+R];c+=(_=r[C])[(-16777216&N)>>>24],l+=_[(16711680&N)>>16],p+=_[(65280&N)>>8],d+=_[255&N],n+=i[C],u++}E[m=R+k]=c/n,M[m]=l/n,j[m]=p/n,I[m]=d/n}R+=v}for(R=0,f=(h=-a)*v,T=0;T<b;T++){for(k=0;k<v;k++){if(d=p=l=c=n=0,h<0)g=m=-h,u=k;else{if(h>=b)break;g=0,m=h,u=k+f}for(C=g;C<o&&!(m>=b);C++)c+=(_=r[C])[E[u]],l+=_[M[u]],p+=_[j[u]],d+=_[I[u]],n+=i[C],m++,u+=v;x[k+R]=c/n<<24|l/n<<16|p/n<<8|d/n}R+=v,f+=v,h++}s._setPixels(y,x)}s._toPixels=function(e){return e instanceof ImageData?e.data:e.getContext("2d").getImageData(0,0,e.width,e.height).data},s._getARGB=function(e,t){var n=4*t;return e[n+3]<<24&4278190080|e[n]<<16&16711680|e[n+1]<<8&65280|255&e[n+2]},s._setPixels=function(e,t){for(var n=0,a=0,o=e.length;a<o;a++)e[(n=4*a)+0]=(16711680&t[a])>>>16,e[n+1]=(65280&t[a])>>>8,e[n+2]=255&t[a],e[n+3]=(4278190080&t[a])>>>24},s._toImageData=function(e){return e instanceof ImageData?e:e.getContext("2d").getImageData(0,0,e.width,e.height)},s._createImageData=function(e,t){return s._tmpCanvas=document.createElement("canvas"),s._tmpCtx=s._tmpCanvas.getContext("2d"),this._tmpCtx.createImageData(e,t)},s.apply=function(e,t,n){var a=e.getContext("2d"),o=a.getImageData(0,0,e.width,e.height),i=t(o,n);i instanceof ImageData?a.putImageData(i,0,0,0,0,e.width,e.height):a.putImageData(o,0,0,0,0,e.width,e.height)},s.threshold=function(e,t){var n=s._toPixels(e);void 0===t&&(t=.5);for(var a=Math.floor(255*t),o=0;o<n.length;o+=4){var i;i=.2126*n[o]+.7152*n[o+1]+.0722*n[o+2]>=a?255:0,n[o]=n[o+1]=n[o+2]=i}},s.gray=function(e){for(var t=s._toPixels(e),n=0;n<t.length;n+=4){var a=.2126*t[n]+.7152*t[n+1]+.0722*t[n+2];t[n]=t[n+1]=t[n+2]=a}},s.opaque=function(e){for(var t=s._toPixels(e),n=0;n<t.length;n+=4)t[n+3]=255;return t},s.invert=function(e){for(var t=s._toPixels(e),n=0;n<t.length;n+=4)t[n]=255-t[n],t[n+1]=255-t[n+1],t[n+2]=255-t[n+2]},s.posterize=function(e,t){var n=s._toPixels(e);if(t<2||t>255)throw new Error("Level must be greater than 2 and less than 255 for posterize");for(var a=t-1,o=0;o<n.length;o+=4){var i=n[o],r=n[o+1],l=n[o+2];n[o]=255*(i*t>>8)/a,n[o+1]=255*(r*t>>8)/a,n[o+2]=255*(l*t>>8)/a}},s.dilate=function(e){for(var t,n,a,o,i,r,l,p,d,c,u,m,h,f,g,y,v,b=s._toPixels(e),w=0,x=b.length?b.length/4:0,S=new Int32Array(x);w<x;)for(t=w,n=w+e.width;w<n;)a=o=s._getARGB(b,w),(l=w-1)<t&&(l=w),(r=w+1)>=n&&(r=w),(p=w-e.width)<0&&(p=0),(d=w+e.width)>=x&&(d=w),m=s._getARGB(b,p),u=s._getARGB(b,l),h=s._getARGB(b,d),(g=77*(u>>16&255)+151*(u>>8&255)+28*(255&u))>(i=77*(a>>16&255)+151*(a>>8&255)+28*(255&a))&&(o=u,i=g),(f=77*((c=s._getARGB(b,r))>>16&255)+151*(c>>8&255)+28*(255&c))>i&&(o=c,i=f),(y=77*(m>>16&255)+151*(m>>8&255)+28*(255&m))>i&&(o=m,i=y),(v=77*(h>>16&255)+151*(h>>8&255)+28*(255&h))>i&&(o=h,i=v),S[w++]=o;s._setPixels(b,S)},s.erode=function(e){for(var t,n,a,o,i,r,l,p,d,c,u,m,h,f,g,y,v,b=s._toPixels(e),w=0,x=b.length?b.length/4:0,S=new Int32Array(x);w<x;)for(t=w,n=w+e.width;w<n;)a=o=s._getARGB(b,w),(l=w-1)<t&&(l=w),(r=w+1)>=n&&(r=w),(p=w-e.width)<0&&(p=0),(d=w+e.width)>=x&&(d=w),m=s._getARGB(b,p),u=s._getARGB(b,l),h=s._getARGB(b,d),(g=77*(u>>16&255)+151*(u>>8&255)+28*(255&u))<(i=77*(a>>16&255)+151*(a>>8&255)+28*(255&a))&&(o=u,i=g),(f=77*((c=s._getARGB(b,r))>>16&255)+151*(c>>8&255)+28*(255&c))<i&&(o=c,i=f),(y=77*(m>>16&255)+151*(m>>8&255)+28*(255&m))<i&&(o=m,i=y),(v=77*(h>>16&255)+151*(h>>8&255)+28*(255&h))<i&&(o=h,i=v),S[w++]=o;s._setPixels(b,S)},s.blur=function(e,t){l(e,t)},t.exports=s},{}],44:[function(e,t,n){"use strict";var a=e("../core/main"),o=[];a.prototype.createImage=function(e,t){return a._validateParameters("createImage",arguments),new a.Image(e,t)}
vendor: 6,560 bytes, line 21
21,a.prototype.saveCanvas=function(){a._validateParameters("saveCanvas",arguments);var e,t,n,o,i=[].slice.call(arguments);switch(arguments[0]instanceof HTMLCanvasElement?(e=arguments[0],i.shift()):arguments[0]instanceof a.Element?(e=arguments[0].elt,i.shift()):e=this._curElement&&this._curElement.elt,i.length>=1&&(t=i[0]),i.length>=2&&(n=i[1]),n=n||a.prototype._checkFileExtension(t,n)[1]||"png"){default:o="image/png";break;case"jpeg":case"jpg":o="image/jpeg"}e.toBlob(function(e){a.prototype.downloadFile(e,t,n)},o)},a.prototype.saveFrames=function(e,t,n,i,r){a._validateParameters("saveFrames",arguments);var s=n||3;s=a.prototype.constrain(s,0,15),s*=1e3;var l=i||15;l=a.prototype.constrain(l,0,22);var p=0,d=a.prototype._makeFrame,c=this._curElement.elt,u=setInterval(function(){d(e+p,t,c),p++},1e3/l);setTimeout(function(){if(clearInterval(u),r)r(o);else for(var e=0;e<o.length;e++){var t=o[e];a.prototype.downloadFile(t.imageData,t.filename,t.ext)}o=[]},s+.01)},a.prototype._makeFrame=function(e,t,n){var a,i;if(a=this?this._curElement.elt:n,t)switch(t.toLowerCase()){case"png":i="image/png";break;case"jpeg":case"jpg":i="image/jpeg";break;default:i="image/png"}else t="png",i="image/png";var r=a.toDataURL(i);r=r.replace(i,"image/octet-stream");var s={};s.imageData=r,s.filename=e,s.ext=t,o.push(s)},t.exports=a},{"../core/main":24}],45:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("./filters"),i=e("../core/helpers"),r=e("../core/constants");function s(e,t){return e>0&&e<t?e:t}e("../core/error_helpers"),a.prototype.loadImage=function(e,t,n){a._validateParameters("loadImage",arguments);var o=new Image,i=new a.Image(1,1,this),r=this;return o.onload=function(){i.width=i.canvas.width=o.width,i.height=i.canvas.height=o.height,i.drawingContext.drawImage(o,0,0),i.modified=!0,"function"==typeof t&&t(i),r._decrementPreload()},o.onerror=function(e){a._friendlyFileLoadError(0,o.src),"function"==typeof n?n(e):console.error(e)},0!==e.indexOf("data:image/")&&(o.crossOrigin="Anonymous"),o.src=e,i},a.prototype.image=function(e,t,n,o,r,l,p,d,c){a._validateParameters("image",arguments);var u=e.width,m=e.height;e.elt&&e.elt.videoWidth&&!e.canvas&&(u=e.elt.videoWidth,m=e.elt.videoHeight);var h=t,f=n,g=o||u,y=r||m,v=l||0,b=p||0,w=d||u,x=c||m;w=s(w,u),x=s(x,m);var S=1;e.elt&&!e.canvas&&e.elt.style.width&&(S=e.elt.videoWidth&&!o?e.elt.videoWidth:e.elt.width,S/=parseInt(e.elt.style.width,10)),v*=S,b*=S,x*=S,w*=S;var k=i.modeAdjust(h,f,g,y,this._renderer._imageMode);this._renderer.image(e,v,b,w,x,k.x,k.y,k.w,k.h)},a.prototype.tint=function(){a._validateParameters("tint",arguments);var e=this.color.apply(this,arguments);this._renderer._tint=e.levels},a.prototype.noTint=function(){this._renderer._tint=null},a.prototype._getTintedImageCanvas=function(e){if(!e.canvas)return e;var t=o._toPixels(e.canvas),n=document.createElement("canvas");n.width=e.canvas.width,n.height=e.canvas.height;for(var a=n.getContext("2d"),i=a.createImageData(e.canvas.width,e.canvas.height),r=i.data,s=0;s<t.length;s+=4){var l=t[s],p=t[s+1],d=t[s+2],c=t[s+3];r[s]=l*this._renderer._tint[0]/255,r[s+1]=p*this._renderer._tint[1]/255,r[s+2]=d*this._renderer._tint[2]/255,r[s+3]=c*this._renderer._tint[3]/255}return a.putImageData(i,0,0),n},a.prototype.imageMode=function(e){a._validateParameters("imageMode",arguments),e!==r.CORNER&&e!==r.CORNERS&&e!==r.CENTER||(this._renderer._imageMode=e)},t.exports=a},{"../core/constants":18,"../core/error_helpers":20,"../core/helpers":21,"../core/main":24,"./filters":43}],46:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("./filters");a.Image=function(e,t){this.width=e,this.height=t,this.canvas=document.createElement("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,this.drawingContext=this.canvas.getContext("2d"),this._pixelsState=this,this._pixelDensity=1,this._pixelsDirty=!0,this._modified=!1,this.pixels=[]},a.Image.prototype._setProperty=function(e,t){this[e]=t,this.setModified(!0)},a.Image.prototype.loadPixels=function(){a.Renderer2D.prototype.loadPixels.call(this),this.setModified(!0)},a.Image.prototype.updatePixels=function(e,t,n,o){a.Renderer2D.prototype.updatePixels.call(this,e,t,n,o),this.setModified(!0)},a.Image.prototype.get=function(e,t,n,o){return a._validateParameters("p5.Image.get",arguments),a.Renderer2D.prototype.get.apply(this,arguments)},a.Image.prototype._getPixel=a.Renderer2D.prototype._getPixel,a.Image.prototype.set=function(e,t,n){a.Renderer2D.prototype.set.call(this,e,t,n),this.setModified(!0)},a.Image.prototype.resize=function(e,t){0===e&&0===t?(e=this.canvas.width,t=this.canvas.height):0===e?e=this.canvas.width*t/this.canvas.height:0===t&&(t=this.canvas.height*e/this.canvas.width),e=Math.floor(e),t=Math.floor(t);var n=document.createElement("canvas");n.width=e,n.height=t,n.getContext("2d").drawImage(this.canvas,0,0,this.canvas.width,this.canvas.height,0,0,n.width,n.height),this.canvas.width=this.width=e,this.canvas.height=this.height=t,this.drawingContext.drawImage(n,0,0,e,t,0,0,e,t),this.pixels.length>0&&this.loadPixels(),this.setModified(!0),this._pixelsDirty=!0},a.Image.prototype.copy=function(){var e,t,n,o,i,r,s,l,p;if(9===arguments.length)e=arguments[0],t=arguments[1],n=arguments[2],o=arguments[3],i=arguments[4],r=arguments[5],s=arguments[6],l=arguments[7],p=arguments[8];else{if(8!==arguments.length)throw new Error("Signature not supported");e=this,t=arguments[0],n=arguments[1],o=arguments[2],i=arguments[3],r=arguments[4],s=arguments[5],l=arguments[6],p=arguments[7]}a.Renderer2D._copyHelper(this,e,t,n,o,i,r,s,l,p),this._pixelsDirty=!0},a.Image.prototype.mask=function(e){void 0===e&&(e=this);var t=this.drawingContext.globalCompositeOperation,n=1;e instanceof a.Renderer&&(n=e._pInst._pixelDensity);var o=[e,0,0,n*e.width,n*e.height,0,0,this.width,this.height];this.drawingContext.globalCompositeOperation="destination-in",a.Image.prototype.copy.apply(this,o),this.drawingContext.globalCompositeOperation=t,this.setModified(!0)},a.Image.prototype.filter=function(e,t){o.apply(this.canvas,o[e],t),this.setModified(!0)},a.Image.prototype.blend=function(){a.prototype.blend.apply(this,arguments),this.setModified(!0)},a.Image.prototype.setModified=function(e){this._modified=e},a.Image.prototype.isModified=function(){return this._modified},a.Image.prototype.save=function(e,t){a.prototype.saveCanvas(this.canvas,e,t)},t.exports=a.Image},{"../core/main":24,"./filters":43}],47:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("./filters");e("../color/p5.Color"),a.prototype.pixels=[],a.prototype.blend=function(){a._val
21idateParameters("blend",arguments),this._renderer?this._renderer.blend.apply(this._renderer,arguments):a.Renderer2D.prototype.blend.apply(this,arguments)},a.prototype.copy=function(){a._validateParameters("copy",arguments),a.Renderer2D.prototype.copy.apply(this._renderer,arguments)},a.prototype.filter=function(e,t){a._validateParameters("filter",arguments),void 0!==this.canvas?o.apply(this.canvas,o[e],t):o.apply(this.elt,o[e],t)},a.prototype.get=function(e,t,n,o){return a._validateParameters("get",arguments),this._renderer.get.apply(this._renderer,arguments)},a.prototype.loadPixels=function(){a._validateParameters("loadPixels",arguments),this._renderer.loadPixels()},a.prototype.set=function(e,t,n){this._renderer.set(e,t,n)},a.prototype.updatePixels=function(e,t,n,o){a._validateParameters("updatePixels",arguments),0!==this.pixels.length&&this._renderer.updatePixels(e,t,n,o)},t.exports=a},{"../color/p5.Color":16,"../core/main":24,"./filters":43}],48:[function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=e("../core/main");e("whatwg-fetch"),e("es6-promise").polyfill();var i=e("fetch-jsonp");function r(e,t){var n={};if(void 0===(t=t||[]))for(var a=0;a<e.length;a++)t[a.toString()]=a;for(var o=0;o<t.length;o++){var i=t[o],r=e[o];n[i]=r}return n}function s(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function l(e,t){t&&!0!==t&&"true"!==t||(t=""),e||(e="untitled");var n="";return e&&e.indexOf(".")>-1&&(n=e.split(".").pop()),t&&n!==t&&(e=e+"."+(n=t)),[e,n]}e("../core/error_helpers"),o.prototype.loadJSON=function(){o._validateParameters("loadJSON",arguments);for(var e,t,n,i=arguments[0],r={},s="json",l=1;l<arguments.length;l++){var p=arguments[l];"string"==typeof p?"jsonp"!==p&&"json"!==p||(s=p):"function"==typeof p?e?t=p:e=p:"object"===a(p)&&(p.hasOwnProperty("jsonpCallback")||p.hasOwnProperty("jsonpCallbackFunction"))&&(s="jsonp",n=p)}var d=this;return this.httpDo(i,"GET",n,s,function(t){for(var n in t)r[n]=t[n];void 0!==e&&e(t),d._decrementPreload()},function(e){if(o._friendlyFileLoadError(5,i),!t)throw e;t(e)}),r},o.prototype.loadStrings=function(){o._validateParameters("loadStrings",arguments);for(var e,t,n=[],a=1;a<arguments.length;a++){var i=arguments[a];"function"==typeof i&&(void 0===e?e=i:void 0===t&&(t=i))}var r=this;return o.prototype.httpDo.call(this,arguments[0],"GET","text",function(t){var a=t.replace(/\r\n/g,"\r").replace(/\n/g,"\r").split(/\r/);Array.prototype.push.apply(n,a),void 0!==e&&e(n),r._decrementPreload()},function(e){if(o._friendlyFileLoadError(3,arguments[0]),!t)throw e;t(e)}),n},o.prototype.loadTable=function(e){var t,n,a=[],i=!1,s=e.substring(e.lastIndexOf(".")+1,e.length),l=",",p=!1;"tsv"===s&&(l="\t");for(var d=1;d<arguments.length;d++)if("function"==typeof arguments[d])void 0===t?t=arguments[d]:void 0===n&&(n=arguments[d]);else if("string"==typeof arguments[d])if(a.push(arguments[d]),"header"===arguments[d]&&(i=!0),"csv"===arguments[d]){if(p)throw new Error("Cannot set multiple separator types.");l=",",p=!0}else if("tsv"===arguments[d]){if(p)throw new Error("Cannot set multiple separator types.");l="\t",p=!0}var c=new o.Table,u=this;return this.httpDo(e,"GET","table",function(e){for(var n,a,s={},p=[],m=0,h=null,f=function(){s.currentState=0,s.token=""},g=function(){h.push(s.token),f()},y=function(){s.currentState=4,p.push(h),h=null};;){if(null==(n=e[m++])){if(s.escaped)throw new Error("Unclosed quote in file.");if(h){g(),y();break}}if(null===h&&(s.escaped=!1,h=[],f()),0===s.currentState){if('"'===n){s.escaped=!0,s.currentState=1;continue}s.currentState=1}if(1===s.currentState&&s.escaped)if('"'===n)'"'===e[m]?(s.token+='"',m++):(s.escaped=!1,s.currentState=2);else{if("\r"===n)continue;s.token+=n}else"\r"===n?("\n"===e[m]&&m++,g(),y()):"\n"===n?(g(),y()):n===l?g():1===s.currentState&&(s.token+=n)}if(i)c.columns=p.shift();else for(d=0;d<p[0].length;d++)c.columns[d]="null";for(d=0;d<p.length;d++)(1!==p[d].length||"undefined"!==p[d][0]&&""!==p[d][0])&&((a=new o.TableRow).arr=p[d],a.obj=r(p[d],c.columns),c.addRow(a));"function"==typeof t&&t(c),u._decrementPreload()},function(t){o._friendlyFileLoadError(2,e),n?n(t):console.error(t)}),c},o.prototype.loadXML=function(){for(var e,t,n=new o.XML,a=1;a<arguments.length;a++){var i=arguments[a];"function"==typeof i&&(void 0===e?e=i:void 0===t&&(t=i))}var r=this;return this.httpDo(arguments[0],"GET","xml",function(t){for(var a in t)n[a]=t[a];void 0!==e&&e(n),r._decrementPreload()},function(e){if(o._friendlyFileLoadError(1,arguments[0]),!t)throw e;t(e)}),n},o.prototype.loadBytes=function(e,t,n){var a={},i=this;return this.httpDo(e,"GET","arrayBuffer",function(e){a.bytes=new Uint8Array(e),"function"==typeof t&&t(a),i._decrementPreload()},function(t){if(o._friendlyFileLoadError(6,e),!n)throw t;n(t)}),a}
21,o.prototype.httpGet=function(){o._validateParameters("httpGet",arguments);var e=Array.prototype.slice.call(arguments);return e.splice(1,0,"GET"),o.prototype.httpDo.apply(this,e)},o.prototype.httpPost=function(){o._validateParameters("httpPost",arguments);var e=Array.prototype.slice.call(arguments);return e.splice(1,0,"POST"),o.prototype.httpDo.apply(this,e)},o.prototype.httpDo=function(){for(var e,t,n,r,s,l={},p=0,d="text/plain",c=arguments.length-1;c>0&&"function"==typeof arguments[c];c--)p++;var u=arguments.length-p,m=arguments[0];if(2===u&&"string"==typeof m&&"object"===a(arguments[1]))r=new Request(m,arguments[1]),t=arguments[2],n=arguments[3];else{for(var h,f="GET",g=1;g<arguments.length;g++){var y=arguments[g];if("string"==typeof y)"GET"===y||"POST"===y||"PUT"===y||"DELETE"===y?f=y:"json"===y||"jsonp"===y||"binary"===y||"arrayBuffer"===y||"xml"===y||"text"===y||"table"===y?e=y:h=y;else if("number"==typeof y)h=y.toString();else if("object"===a(y))if(y.hasOwnProperty("jsonpCallback")||y.hasOwnProperty("jsonpCallbackFunction"))for(var v in y)l[v]=y[v];else y instanceof o.XML?(h=y.serialize(),d="application/xml"):(h=JSON.stringify(y),d="application/json");else"function"==typeof y&&(t?n=y:t=y)}r=new Request(m,{method:f,mode:"cors",body:h,headers:new Headers({"Content-Type":d})})}return e||(e=-1!==m.indexOf("json")?"json":-1!==m.indexOf("xml")?"xml":"text"),(s=(s="jsonp"===e?i(m,l):fetch(r)).then(function(t){if(!t.ok){var n=new Error(t.body);throw n.status=t.status,n.ok=!1,n}var a=0;switch("jsonp"!==e&&(a=t.headers.get("content-length")),a&&a>64e6&&o._friendlyFileLoadError(7,m),e){case"json":case"jsonp":return t.json();case"binary":return t.blob();case"arrayBuffer":return t.arrayBuffer();case"xml":return t.text().then(function(e){var t=(new DOMParser).parseFromString(e,"text/xml");return new o.XML(t.documentElement)});default:return t.text()}})).then(t||function(){}),s.catch(n||console.error),s},window.URL=window.URL||window.webkitURL,o.prototype._pWriters=[],o.prototype.createWriter=function(e,t){var n;for(var a in o.prototype._pWriters)if(o.prototype._pWriters[a].name===e)return n=new o.PrintWriter(e+this.millis(),t),o.prototype._pWriters.push(n),n;return n=new o.PrintWriter(e,t),o.prototype._pWriters.push(n),n},o.PrintWriter=function(e,t){var n=this;this.name=e,this.content="",this.write=function(e){this.content+=e},this.print=function(e){this.content+=e+"\n"},this.clear=function(){this.content=""},this.close=function(){var a=[];for(var i in a.push(this.content),o.prototype.writeFile(a,e,t),o.prototype._pWriters)o.prototype._pWriters[i].name===this.name&&o.prototype._pWriters.splice(i,1);n.clear(),n={}}},o.prototype.save=function(e,t,n){var a=arguments,i=this._curElement?this._curElement.elt:this.elt;if(0!==a.length)if(a[0]instanceof o.Renderer||a[0]instanceof o.Graphics)o.prototype.saveCanvas(a[0].elt,a[1],a[2]);else if(1===a.length&&"string"==typeof a[0])o.prototype.saveCanvas(i,a[0]);else switch(l(a[1],a[2])[1]){case"json":return void o.prototype.saveJSON(a[0],a[1],a[2]);case"txt":return void o.prototype.saveStrings(a[0],a[1],a[2]);default:a[0]instanceof Array?o.prototype.saveStrings(a[0],a[1],a[2]):a[0]instanceof o.Table?o.prototype.saveTable(a[0],a[1],a[2]):a[0]instanceof o.Image?o.prototype.saveCanvas(a[0].canvas,a[1]):a[0]instanceof o.SoundFile&&o.prototype.saveSound(a[0],a[1],a[2],a[3])}else o.prototype.saveCanvas(i)},o.prototype.saveJSON=function(e,t,n){var a;
vendor: 6,695 bytes, line 21
21o._validateParameters("saveJSON",arguments),a=n?JSON.stringify(e):JSON.stringify(e,void 0,2),this.saveStrings(a.split("\n"),t,"json")},o.prototype.saveJSONObject=o.prototype.saveJSON,o.prototype.saveJSONArray=o.prototype.saveJSON,o.prototype.saveStrings=function(e,t,n){o._validateParameters("saveStrings",arguments);for(var a=n||"txt",i=this.createWriter(t,a),r=0;r<e.length;r++)e.length,i.print(e[r]);i.close(),i.clear()},o.prototype.saveTable=function(e,t,n){var a;o._validateParameters("saveTable",arguments),a=void 0===n?t.substring(t.lastIndexOf(".")+1,t.length):n;var i=this.createWriter(t,a),r=e.columns,l=",";if("tsv"===a&&(l="\t"),"html"!==a){if("0"!==r[0]){for(var p=0;p<r.length;p++)p<r.length-1?i.write(r[p]+l):i.write(r[p]);i.write("\n")}for(var d=0;d<e.rows.length;d++){var c;for(c=0;c<e.rows[d].arr.length;c++)c<e.rows[d].arr.length-1?i.write(e.rows[d].arr[c]+l):(e.rows.length,i.write(e.rows[d].arr[c]));i.write("\n")}}else{i.print("<html>"),i.print("<head>");if('="text/html;charset=utf-8" />',i.print('  <meta http-equiv="content-type" content="text/html;charset=utf-8" />'),i.print("</head>"),i.print("<body>"),i.print("  <table>"),"0"!==r[0]){i.print("    <tr>");for(var u=0;u<r.length;u++){var m=s(r[u]);i.print("      <td>"+m),i.print("      </td>")}i.print("    </tr>")}for(var h=0;h<e.rows.length;h++){i.print("    <tr>");for(var f=0;f<e.columns.length;f++){var g=s(e.rows[h].getString(f));i.print("      <td>"+g),i.print("      </td>")}i.print("    </tr>")}i.print("  </table>"),i.print("</body>"),i.print("</html>")}i.close(),i.clear()},o.prototype.writeFile=function(e,t,n){var a="application/octet-stream";o.prototype._isSafari()&&(a="text/plain");var i=new Blob(e,{type:a});o.prototype.downloadFile(i,t,n)},o.prototype.downloadFile=function(t,n,a){var i=l(n,a),r=i[0];if(t instanceof Blob){e("file-saver").saveAs(t,r)}else{var s=document.createElement("a");if(s.href=t,s.download=r,s.onclick=function(e){var t;t=e,document.body.removeChild(t.target),e.stopPropagation()},s.style.display="none",document.body.appendChild(s),o.prototype._isSafari()){var p="Hello, Safari user! To download this file...\n";p+="1. Go to File --\x3e Save As.\n",p+='2. Choose "Page Source" as the Format.\n',p+='3. Name it with this extension: ."'+i[1]+'"',alert(p)}s.click()}},o.prototype._checkFileExtension=l,o.prototype._isSafari=function(){return Object.prototype.toString.call(window.HTMLElement).indexOf("Constructor")>0},t.exports=o},{"../core/error_helpers":20,"../core/main":24,"es6-promise":5,"fetch-jsonp":6,"file-saver":7,"whatwg-fetch":12}],49:[function(e,t,n){"use strict";var a=e("../core/main");a.Table=function(e){this.columns=[],this.rows=[]},a.Table.prototype.addRow=function(e){var t=e||new a.TableRow;if(void 0===t.arr||void 0===t.obj)throw new Error("invalid TableRow: "+t);return t.table=this,this.rows.push(t),t},a.Table.prototype.removeRow=function(e){this.rows[e].table=null;var t=this.rows.splice(e+1,this.rows.length);this.rows.pop(),this.rows=this.rows.concat(t)},a.Table.prototype.getRow=function(e){return this.rows[e]},a.Table.prototype.getRows=function(){return this.rows},a.Table.prototype.findRow=function(e,t){if("string"==typeof t){for(var n=0;n<this.rows.length;n++)if(this.rows[n].obj[t]===e)return this.rows[n]}else for(var a=0;a<this.rows.length;a++)if(this.rows[a].arr[t]===e)return this.rows[a];return null},a.Table.prototype.findRows=function(e,t){var n=[];if("string"==typeof t)for(var a=0;a<this.rows.length;a++)this.rows[a].obj[t]===e&&n.push(this.rows[a]);else for(var o=0;o<this.rows.length;o++)this.rows[o].arr[t]===e&&n.push(this.rows[o]);return n},a.Table.prototype.matchRow=function(e,t){if("number"==typeof t){for(var n=0;n<this.rows.length;n++)if(this.rows[n].arr[t].match(e))return this.rows[n]}else for(var a=0;a<this.rows.length;a++)if(this.rows[a].obj[t].match(e))return this.rows[a];return null},a.Table.prototype.matchRows=function(e,t){var n=[];if("number"==typeof t)for(var a=0;a<this.rows.length;a++)this.rows[a].arr[t].match(e)&&n.push(this.rows[a]);else for(var o=0;o<this.rows.length;o++)this.rows[o].obj[t].match(e)&&n.push(this.rows[o]);return n},a.Table.prototype.getColumn=function(e){var t=[];if("string"==typeof e)for(var n=0;n<this.rows.length;n++)t.push(this.rows[n].obj[e]);else for(var a=0;a<this.rows.length;a++)t.push(this.rows[a].arr[e]);return t},a.Table.prototype.clearRows=function(){delete this.rows,this.rows=[]},a.Table.prototype.addColumn=function(e){var t=e||null;this.columns.push(t)},a.Table.prototype.getColumnCount=function(){return this.columns.length},a.Table.prototype.getRowCount=function(){return this.rows.length},a.Table.prototype.removeTokens=function(e,t){for(var n=function(e){return e.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")},a=[],o=0;o<e.length;o++)a.push(n(e.charAt(o)));var i=new RegExp(a.join("|"),"g");if(void 0===t)for(var r=0;r<this.columns.length;r++)for(var s=0;s<this.rows.length;s++){var l=this.rows[s].arr[r];l=l.replace(i,""),this.rows[s].arr[r]=l,this.rows[s].obj[this.columns[r]]=l}else if("string"==typeof t)for(var p=0;p<this.rows.length;p++){var d=this.rows[p].obj[t];d=d.replace(i,""),this.rows[p].obj[t]=d;var c=this.columns.indexOf(t);this.rows[p].arr[c]=d}else for(var u=0;u<this.rows.length;u++){var m=this.rows[u].arr[t];m=m.replace(i,""),this.rows[u].arr[t]=m,this.rows[u].obj[this.columns[t]]=m}},a.Table.prototype.trim=function(e){var t=new RegExp(" ","g");if(void 0===e)for(var n=0;n<this.columns.length;n++)for(var a=0;a<this.rows.length;a++){var o=this.rows[a].arr[n];o=o.replace(t,""),this.rows[a].arr[n]=o,this.rows[a].obj[this.columns[n]]=o}else if("string"==typeof e)for(var i=0;i<this.rows.length;i++){var r=this.rows[i].obj[e];r=r.replace(t,""),this.rows[i].obj[e]=r;var s=this.columns.indexOf(e);this.rows[i].arr[s]=r}else for(var l=0;l<this.rows.length;l++){var p=this.rows[l].arr[e];p=p.replace(t,""),this.rows[l].arr[e]=p,this.rows[l].obj[this.columns[e]]=p}},a.Table.prototype.removeColumn=function(e){var t,n;"string"==typeof e?(t=e,n=this.columns.indexOf(e)):(n=e,t=this.columns[e]);var a=this.columns.splice(n+1,this.columns.length);this.columns.pop(),this.columns=this.columns.concat(a);for(var o=0;o<this.rows.length;o++){var i=this.rows[o].arr,r=i.splice(n+1,i.length);i.pop(),this.rows[o].arr=i.concat(r),delete this.rows[o].obj[t]}},a.Table.prototype.set=function(e,t,n){this.rows[e].set(t,n)},a.Table.prototype.setNum=function(e,t,n){this.rows[e].setNum(t,n)},a.Table.prototype.setString=function(e,t,n){this.rows[e].setString(t,n)},a.Table.prototype.get=function(e,t){return this.rows[e].get(t)},a.Table.prototype.getNum=function(e,t){return this.rows[e].getNum(t)},a.Table.prototype.getString=function(e,t){return this.rows[e].get
21String(t)},a.Table.prototype.getObject=function(e){for(var t,n={},a=0;a<this.rows.length;a++)if(t=this.rows[a].obj,"string"==typeof e){if(!(this.columns.indexOf(e)>=0))throw new Error('This table has no column named "'+e+'"');n[t[e]]=t}else n[a]=this.rows[a].obj;return n},a.Table.prototype.getArray=function(){for(var e=[],t=0;t<this.rows.length;t++)e.push(this.rows[t].arr);return e},t.exports=a},{"../core/main":24}],50:[function(e,t,n){"use strict";var a=e("../core/main");a.TableRow=function(e,t){var n=[],a={};e&&(t=t||",",n=e.split(t));for(var o=0;o<n.length;o++){var i=o,r=n[o];a[i]=r}this.arr=n,this.obj=a,this.table=null},a.TableRow.prototype.set=function(e,t){if("string"==typeof e){var n=this.table.columns.indexOf(e);if(!(n>=0))throw new Error('This table has no column named "'+e+'"');this.obj[e]=t,this.arr[n]=t}else{if(!(e<this.table.columns.length))throw new Error("Column #"+e+" is out of the range of this table");this.arr[e]=t;var a=this.table.columns[e];this.obj[a]=t}},a.TableRow.prototype.setNum=function(e,t){var n=parseFloat(t);this.set(e,n)},a.TableRow.prototype.setString=function(e,t){var n=t.toString();this.set(e,n)},a.TableRow.prototype.get=function(e){return"string"==typeof e?this.obj[e]:this.arr[e]},a.TableRow.prototype.getNum=function(e){var t;if("NaN"===(t="string"==typeof e?parseFloat(this.obj[e]):parseFloat(this.arr[e])).toString())throw"Error: "+this.obj[e]+" is NaN (Not a Number)";return t},a.TableRow.prototype.getString=function(e){return"string"==typeof e?this.obj[e].toString():this.arr[e].toString()},t.exports=a},{"../core/main":24}],51:[function(e,t,n){"use strict";var a=e("../core/main");function o(e){for(var t=[],n=0;n<e.length;n++)t.push(new a.XML(e[n]));return t}a.XML=function(e){if(e)this.DOM=e;else{var t=document.implementation.createDocument(null,"doc");this.DOM=t.createElement("root")}},a.XML.prototype.getParent=function(){return new a.XML(this.DOM.parentElement)},a.XML.prototype.getName=function(){return this.DOM.tagName},a.XML.prototype.setName=function(e){var t=this.DOM.innerHTML,n=this.DOM.attributes,a=document.implementation.createDocument(null,"default").createElement(e);a.innerHTML=t;for(var o=0;o<n.length;o++)a.setAttribute(n[o].nodeName,n.nodeValue);this.DOM=a},a.XML.prototype.hasChildren=function(){return this.DOM.children.length>0},a.XML.prototype.listChildren=function(){for(var e=[],t=0;t<this.DOM.childNodes.length;t++)e.push(this.DOM.childNodes[t].nodeName);return e},a.XML.prototype.getChildren=function(e){return o(e?this.DOM.getElementsByTagName(e):this.DOM.children)},a.XML.prototype.getChild=function(e){if("string"!=typeof e)return new a.XML(this.DOM.children[e]);for(var t=0;t<this.DOM.children.length;t++){var n=this.DOM.children[t];if(n.tagName===e)return new a.XML(n)}},a.XML.prototype.addChild=function(e){e instanceof a.XML&&this.DOM.appendChild(e.DOM)},a.XML.prototype.removeChild=function(e){var t=-1;if("string"==typeof e){for(var n=0;n<this.DOM.children.length;
21n++)if(this.DOM.children[n].tagName===e){t=n;break}}else t=e;-1!==t&&this.DOM.removeChild(this.DOM.children[t])},a.XML.prototype.getAttributeCount=function(){return this.DOM.attributes.length},a.XML.prototype.listAttributes=function(){for(var e=[],t=0;t<this.DOM.attributes.length;t++){var n=this.DOM.attributes[t];e.push(n.nodeName)}return e},a.XML.prototype.hasAttribute=function(e){for(var t={},n=0;n<this.DOM.attributes.length;n++){var a=this.DOM.attributes[n];t[a.nodeName]=a.nodeValue}return!!t[e]},a.XML.prototype.getNum=function(e,t){for(var n={},a=0;a<this.DOM.attributes.length;a++){var o=this.DOM.attributes[a];n[o.nodeName]=o.nodeValue}return Number(n[e])||t||0},a.XML.prototype.getString=function(e,t){for(var n={},a=0;a<this.DOM.attributes.length;a++){var o=this.DOM.attributes[a];n[o.nodeName]=o.nodeValue}return n[e]?String(n[e]):t||null},a.XML.prototype.setAttribute=function(e,t){this.DOM.setAttribute(e,t)},a.XML.prototype.getContent=function(e){return this.DOM.textContent.replace(/\s\s+/g,",")||e||null},a.XML.prototype.setContent=function(e){this.DOM.children.length||(this.DOM.textContent=e)},a.XML.prototype.serialize=function(){return(new XMLSerializer).serializeToString(this.DOM)},t.exports=a},{"../core/main":24}],52:[function(e,t,n){"use strict";var a=e("../core/main");function o(e,t,n){if("function"==typeof Math.hypot)return Math.hypot.apply(null,arguments);for(var a=arguments.length,o=[],i=0,r=0;r<a;r++){var s=arguments[r];if((s=+s)===1/0||s===-1/0)return 1/0;(s=Math.abs(s))>i&&(i=s),o[r]=s}0===i&&(i=1);for(var l=0,p=0,d=0;d<a;d++){var c=o[d]/i,u=c*c-p,m=l+u;p=m-l-u,l=m}return Math.sqrt(l)*i}a.prototype.abs=Math.abs,a.prototype.ceil=Math.ceil,a.prototype.constrain=function(e,t,n){return a._validateParameters("constrain",arguments),Math.max(Math.min(e,n),t)},a.prototype.dist=function(){return a._validateParameters("dist",arguments),4===arguments.length?o(arguments[2]-arguments[0],arguments[3]-arguments[1]):6===arguments.length?o(arguments[3]-arguments[0],arguments[4]-arguments[1],arguments[5]-arguments[2]):void 0},a.prototype.exp=Math.exp,a.prototype.floor=Math.floor,a.prototype.lerp=function(e,t,n){return a._validateParameters("lerp",arguments),n*(t-e)+e},a.prototype.log=Math.log,a.prototype.mag=function(e,t){return a._validateParameters("mag",arguments),o(e,t)},a.prototype.map=function(e,t,n,o,i,r){a._validateParameters("map",arguments);var s=(e-t)/(n-t)*(i-o)+o;return r?o<i?this.constrain(s,o,i):this.constrain(s,i,o):s},a.prototype.max=function(){return a._validateParameters("max",arguments),arguments[0]instanceof Array?Math.max.apply(null,arguments[0]):Math.max.apply(null,arguments)},a.prototype.min=function(){return a._validateParameters("min",arguments),arguments[0]instanceof Array?Math.min.apply(null,arguments[0]):Math.min.apply(null,arguments)},a.prototype.norm=function(e,t,n){return a._validateParameters("norm",arguments),this.map(e,t,n,0,1)},a.prototype.pow=Math.pow,a.prototype.round=Math.round,a.prototype.sq=function(e){return e*e},a.prototype.sqrt=Math.sqrt,t.exports=a},{"../core/main":24}],53:[function(e,t,n){"use strict";var a=e("../core/main");a.prototype.createVector=function(e,t,n){return this instanceof a?new a.Vector(this,arguments):new a.Vector(e,t,n)},t.exports=a},{"../core/main":24}],54:[function(e,t,n){"use strict";var a,o=e("../core/main"),i=4,r=.5,s=function(e){return.5*(1-Math.cos(e*Math.PI))};o.prototype.noise=function(e,t,n){if(t=t||0,n=n||0,null==a){a=new Array(4096);for(var o=0;o<4096;o++)a[o]=Math.random()}e<0&&(e=-e),t<0&&(t=-t),n<0&&(n=-n);for(var l,p,d,c,u,m=Math.floor(e),h=Math.floor(t),f=Math.floor(n),g=e-m,y=t-h,v=n-f,b=0,w=.5,x=0;x<i;x++){var S=m+(h<<4)+(f<<8);l=s(g),p=s(y),d=a[4095&S],d+=l*(a[S+1&4095]-d),c=a[S+16&4095],d+=p*((c+=l*(a[S+16+1&4095]-c))-d),c=a[4095&(S+=256)],c+=l*(a[S+1&4095]-c),u=a[S+16&4095],c+=p*((u+=l*(a[S+16+1&4095]-u))-c),b+=(d+=s(v)*(c-d))*w,w*=r,m<<=1,h<<=1,f<<=1,(g*=2)>=1&&(m++,g--),(y*=2)>=1&&(h++,y--),(v*=2)>=1&&(f++,v--)}return b},o.prototype.noiseDetail=function(e,t){e>0&&(i=e),t>0&&(r=t)},o.prototype.noiseSeed=function(e){var t=function(){var e,t,n=4294967296;return{setSeed:function(a){t=e=(null==a?Math.random()*n:a)>>>0},getSeed:function(){return e},rand:function(){return(t=(1664525*t+1013904223)%n)/n}}}();t.setSeed(e),a=new Array(4096);for(var n=0;n<4096;n++)a[n]=t.rand()},t.exports=o},{"../core/main":24}],55:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("../core/constants");a.Vector=function(){var e,t,n;arguments[0]instanceof a?(this.p5=arguments[0],e=arguments[1][0]||0,t=arguments[1][1]||0,n=arguments[1][2]||0):(e=arguments[0]||0,t=arguments[1]||0,n=arguments[2]||0),this.x=e,this.y=t,this.z=n},a.Vector.prototype.toString=function(){return"p5.Vector Object : ["+this.x+", "+this.y+", "+this.z+"]"},a.Vector.prototype.set=function(e,t,n){return e instanceof a.Vector?(this.x=e.x||
vendor: 5,869 bytes, line 21
210,this.y=e.y||0,this.z=e.z||0,this):e instanceof Array?(this.x=e[0]||0,this.y=e[1]||0,this.z=e[2]||0,this):(this.x=e||0,this.y=t||0,this.z=n||0,this)},a.Vector.prototype.copy=function(){return this.p5?new a.Vector(this.p5,[this.x,this.y,this.z]):new a.Vector(this.x,this.y,this.z)},a.Vector.prototype.add=function(e,t,n){return e instanceof a.Vector?(this.x+=e.x||0,this.y+=e.y||0,this.z+=e.z||0,this):e instanceof Array?(this.x+=e[0]||0,this.y+=e[1]||0,this.z+=e[2]||0,this):(this.x+=e||0,this.y+=t||0,this.z+=n||0,this)},a.Vector.prototype.sub=function(e,t,n){return e instanceof a.Vector?(this.x-=e.x||0,this.y-=e.y||0,this.z-=e.z||0,this):e instanceof Array?(this.x-=e[0]||0,this.y-=e[1]||0,this.z-=e[2]||0,this):(this.x-=e||0,this.y-=t||0,this.z-=n||0,this)},a.Vector.prototype.mult=function(e){return"number"==typeof e&&isFinite(e)?(this.x*=e,this.y*=e,this.z*=e,this):(console.warn("p5.Vector.prototype.mult:","n is undefined or not a finite number"),this)},a.Vector.prototype.div=function(e){return"number"==typeof e&&isFinite(e)?0===e?(console.warn("p5.Vector.prototype.div:","divide by 0"),this):(this.x/=e,this.y/=e,this.z/=e,this):(console.warn("p5.Vector.prototype.div:","n is undefined or not a finite number"),this)},a.Vector.prototype.mag=function(){return Math.sqrt(this.magSq())},a.Vector.prototype.magSq=function(){var e=this.x,t=this.y,n=this.z;return e*e+t*t+n*n},a.Vector.prototype.dot=function(e,t,n){return e instanceof a.Vector?this.dot(e.x,e.y,e.z):this.x*(e||0)+this.y*(t||0)+this.z*(n||0)},a.Vector.prototype.cross=function(e){var t=this.y*e.z-this.z*e.y,n=this.z*e.x-this.x*e.z,o=this.x*e.y-this.y*e.x;return this.p5?new a.Vector(this.p5,[t,n,o]):new a.Vector(t,n,o)},a.Vector.prototype.dist=function(e){return e.copy().sub(this).mag()},a.Vector.prototype.normalize=function(){var e=this.mag();return 0!==e&&this.mult(1/e),this},a.Vector.prototype.limit=function(e){var t=this.magSq();return t>e*e&&this.div(Math.sqrt(t)).mult(e),this},a.Vector.prototype.setMag=function(e){return this.normalize().mult(e)},a.Vector.prototype.heading=function(){var e=Math.atan2(this.y,this.x);return this.p5?this.p5._fromRadians(e):e},a.Vector.prototype.rotate=function(e){var t=this.heading()+e;this.p5&&(t=this.p5._toRadians(t));var n=this.mag();return this.x=Math.cos(t)*n,this.y=Math.sin(t)*n,this},a.Vector.prototype.angleBetween=function(e){var t=this.dot(e)/(this.mag()*e.mag()),n=Math.acos(Math.min(1,Math.max(-1,t)));return this.p5?this.p5._fromRadians(n):n},a.Vector.prototype.lerp=function(e,t,n,o){return e instanceof a.Vector?this.lerp(e.x,e.y,e.z,t):(this.x+=(e-this.x)*o||0,this.y+=(t-this.y)*o||0,this.z+=(n-this.z)*o||0,this)},a.Vector.prototype.array=function(){return[this.x||0,this.y||0,this.z||0]},a.Vector.prototype.equals=function(e,t,n){var o,i,r;return e instanceof a.Vector?(o=e.x||0,i=e.y||0,r=e.z||0):e instanceof Array?(o=e[0]||0,i=e[1]||0,r=e[2]||0):(o=e||0,i=t||0,r=n||0),this.x===o&&this.y===i&&this.z===r},a.Vector.fromAngle=function(e,t){return void 0===t&&(t=1),new a.Vector(t*Math.cos(e),t*Math.sin(e),0)},a.Vector.fromAngles=function(e,t,n){void 0===n&&(n=1);var o=Math.cos(t),i=Math.sin(t),r=Math.cos(e),s=Math.sin(e);return new a.Vector(n*s*i,-n*r,n*s*o)},a.Vector.random2D=function(){return this.fromAngle(Math.random()*o.TWO_PI)},a.Vector.random3D=function(){var e=Math.random()*o.TWO_PI,t=2*Math.random()-1,n=Math.sqrt(1-t*t),i=n*Math.cos(e),r=n*Math.sin(e);return new a.Vector(i,r,t)},a.Vector.add=function(e,t,n){return n?n.set(e):n=e.copy(),n.add(t),n},a.Vector.sub=function(e,t,n){return n?n.set(e):n=e.copy(),n.sub(t),n},a.Vector.mult=function(e,t,n){return n?n.set(e):n=e.copy(),n.mult(t),n},a.Vector.div=function(e,t,n){return n?n.set(e):n=e.copy(),n.div(t),n},a.Vector.dot=function(e,t){return e.dot(t)},a.Vector.cross=function(e,t){return e.cross(t)},a.Vector.dist=function(e,t){return e.dist(t)},a.Vector.lerp=function(e,t,n,a){return a?a.set(e):a=e.copy(),a.lerp(t,n),a},a.Vector.mag=function(e){var t=e.x,n=e.y,a=e.z,o=t*t+n*n+a*a;return Math.sqrt(o)},t.exports=a.Vector},{"../core/constants":18,"../core/main":24}],56:[function(e,t,n){"use strict";var a,o,i,r=e("../core/main"),s=!1,l=!1,p=0,d=(i=2147483647,{setSeed:function(e){o=a=(null==e?Math.random()*i:e)>>>0},getSeed:function(){return a},rand:function(){return(o=(1103515245*o+12345)%i)/i}});r.prototype.randomSeed=function(e){d.setSeed(e),s=!0,l=!1},r.prototype.random=function(e,t){var n;if(n=s?d.rand():Math.random(),void 0===e)return n;if(void 0===t)return e instanceof Array?e[Math.floor(n*e.length)]:n*e;if(e>t){var a=e;e=t,t=a}return n*(t-e)+e},r.prototype.randomGaussian=function(e,t){var n,a,o,i;if(l)n=p,l=!1;else{do{i=(a=this.random(2)-1)*a+(o=this.random(2)-1)*o}while(i>=1);n=a*(i=Math.sqrt(-2*Math.log(i)/i)),p=o*i,l=!0}return n*(t||1)+(e||0)},t.exports=r},{"../core/main":24}],57:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("../core/constants");a.prototype._angleMode=o.RADIANS,a.prototype.acos=function(e){return this._fromRadians(Math.acos(e))},a.prototype.asin=function(e){return this._fromRadians(Math.asin(e))},a.prototype.atan=function(e){return this._fromRadians(Math.atan(e))},a.prototype.atan2=function(e,t){return this._fromRadians(Math.atan2(e,t))},a.prototype.cos=function(e){return Math.cos(this._toRadians(e))},a.prototype.sin=function(e){return Math.sin(this._toRadians(e))},a.prototype.tan=function(e){return Math.tan(this._toRadians(e))},a.prototype.degrees=function(e){return e*o.RAD_TO_DEG},a.prototype.radians=function(e){return e*o.DEG_TO_RAD},a.prototype.angleMode=function(e){e!==o.DEGREES&&e!==o.RADIANS||(this._angleMode=e)},a.prototype._toRadians=function(e){return this._angleMode===o.DEGREES?e*o.DEG_TO_RAD:e},a.prototype._toDegrees=function(e){return this._angleMode===o.RADIANS?e*o.RAD_TO_DEG:e},a.prototype._fromRadians=function(e){return this._angleMode===o.DEGREES?e*o.RAD_TO_DEG:e}
21,t.exports=a},{"../core/constants":18,"../core/main":24}],58:[function(e,t,n){"use strict";var a=e("../core/main");a.prototype.textAlign=function(e,t){return a._validateParameters("textAlign",arguments),this._renderer.textAlign.apply(this._renderer,arguments)},a.prototype.textLeading=function(e){return a._validateParameters("textLeading",arguments),this._renderer.textLeading.apply(this._renderer,arguments)},a.prototype.textSize=function(e){return a._validateParameters("textSize",arguments),this._renderer.textSize.apply(this._renderer,arguments)},a.prototype.textStyle=function(e){return a._validateParameters("textStyle",arguments),this._renderer.textStyle.apply(this._renderer,arguments)},a.prototype.textWidth=function(e){return a._validateParameters("textWidth",arguments),0===e.length?0:this._renderer.textWidth.apply(this._renderer,arguments)},a.prototype.textAscent=function(){return a._validateParameters("textAscent",arguments),this._renderer.textAscent()},a.prototype.textDescent=function(){return a._validateParameters("textDescent",arguments),this._renderer.textDescent()},a.prototype._updateTextMetrics=function(){return this._renderer._updateTextMetrics()},t.exports=a},{"../core/main":24}],59:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("../core/constants"),i=e("opentype.js");e("../core/error_helpers"),a.prototype.loadFont=function(e,t,n){a._validateParameters("loadFont",arguments);var o=new a.Font(this),r=this;return i.load(e,function(i,s){if(i)return a._friendlyFileLoadError(4,e),void 0!==n?n(i):void console.error(i,e);o.font=s,void 0!==t&&t(o),r._decrementPreload();var l,p,d=e.split("\\").pop().split("/").pop(),c=d.lastIndexOf("."),u=c<1?null:d.substr(c+1);["ttf","otf","woff","woff2"].indexOf(u)>-1&&(l=d.substr(0,c),(p=document.createElement("style")).appendChild(document.createTextNode("\n@font-face {\nfont-family: "+l+";\nsrc: url("+e+");\n}\n")),document.head.appendChild(p))}),o},a.prototype.text=function(e,t,n,o,i){return a._validateParameters("text",arguments),this._renderer._doFill||this._renderer._doStroke?this._renderer.text.apply(this._renderer,arguments):this},a.prototype.textFont=function(e,t){if(a._validateParameters("textFont",arguments),arguments.length){if(!e)throw new Error("null font passed to textFont");return this._renderer._setProperty("_textFont",e),t&&(this._renderer._setProperty("_textSize",t),this._renderer._setProperty("_textLeading",t*o._DEFAULT_LEADMULT)),this._renderer._applyTextProperties()}return this._renderer._textFont},t.exports=a},{"../core/constants":18,"../core/error_helpers":20,"../core/main":24,"opentype.js":10}],60:[function(e,t,n){"use strict";function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var o=e("../core/main"),i=e("../core/constants");function r(e,t){for(var n=function(e,t){if("object"!==a(e))e=t;else for(var n in t)void 0===e[n]&&(e[n]=t[n]);return e}(t,{sampleFactor:.1,simplifyThreshold:0}),o=m(e,0,1),i=o/(o*n.sampleFactor),r=[],s=0;s<o;s+=i)r.push(m(e,s));return n.simplifyThreshold&&function(e,t){t=void 0===t?0:t;for(var n=0,a=e.length-1;e.length>3&&a>=0;--a)d(p(e,a-1),p(e,a),p(e,a+1),t)&&(e.splice(a%e.length,1),n++)}(r,n.simplifyThreshold),r}function s(e){for(var t,n=[],a=0;a<e.length;a++)"M"===e[a].type&&(t&&n.push(t),t=[]),t.push(l(e[a]));return n.push(t),n}function l(e){var t=[e.type];return"M"===e.type||"L"===e.type?t.push(e.x,e.y):"C"===e.type?t.push(e.x1,e.y1,e.x2,e.y2,e.x,e.y):"Q"===e.type&&t.push(e.x1,e.y1,e.x,e.y),t}function p(e,t){var n=e.length;return e[t<0?t%n+n:t%n]}function d(e,t,n,a){if(!a)return 0===function(e,t,n){return(t[0]-e[0])*(n[1]-e[1])-(n[0]-e[0])*(t[1]-e[1])}(e,t,n);void 0===d.tmpPoint1&&(d.tmpPoint1=[],d.tmpPoint2=[]);var o=d.tmpPoint1,i=d.tmpPoint2;o.x=t.x-e.x,o.y=t.y-e.y,i.x=n.x-t.x,i.y=n.y-t.y;var r=o.x*i.x+o.y*i.y,s=Math.sqrt(o.x*o.x+o.y*o.y),l=Math.sqrt(i.x*i.x+i.y*i.y);return Math.acos(r/(s*l))<a}function c(e,t,n,a,o,i,r,s,l){var p=1-l,d=Math.pow(p,3),c=Math.pow(p,2),u=l*l,m=u*l,h=d*e+3*c*l*n+3*p*l*l*o+m*r,f=d*t+3*c*l*a+3*p*l*l*i+m*s,g=e+2*l*(n-e)+u*(o-2*n+e),y=t+2*l*(a-t)+u*(i-2*a+t),v=n+2*l*(o-n)+u*(r-2*o+n),b=a+2*l*(i-a)+u*(s-2*i+a),w=p*e+l*n,x=p*t+l*a,S=p*o+l*r,k=p*i+l*s,T=90-180*Math.atan2(g-v,y-b)/Math.PI;return(g>v||y<b)&&(T+=180),{x:h,y:f,m:{x:g,y:y},n:{x:v,y:b},start:{x:w,y:x},end:{x:S,y:k},alpha:T}}function u(e,t,n,a,o,i,r,s,l){return null==l?v(e,t,n,a,o,i,r,s):c(e,t,n,a,o,i,r,s,function(e,t,n,a,o,i,r,s,l){if(l<0||v(e,t,n,a,o,i,r,s)<l)return;var p,d=.5,c=1-d;p=v(e,t,n,a,o,i,r,s,c);for(;Math.abs(p-l)>.01;)p=v(e,t,n,a,o,i,r,s,c+=(p<l?1:-1)*(d/=2));return c}(e,t,n,a,o,i,r,s,l))}function m(e,t,n){e=function(e,t){var n,a=h(e),o=t&&h(t),i={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},r={x:0,y:0,bx:0,by:0,X:0,Y:0,qx:null,qy:null},s=[],l=[],p=function(e,t,n){var a,o;if(!e)return["C",t.x,t.y,t.x,t.y,t.x,t.y];switch(e[0]in{T:1,Q:1}||(t.qx=t.qy=null),e[0]){case"M":t.X=e[1],t.Y=e[2];break;case"A":e=["C"].concat(function e(t,n,a,o,i,r,s,l,p,d){var c,u,m,h,f,g=Math.PI,y=120*g/180,v=g/180*(+i||0),b=[],w=function(e,t,n){var a=e*Math.cos(n)-t*Math.sin(n),o=e*Math.sin(n)+t*Math.cos(n);return{x:a,y:o}};if(d)c=d[0],u=d[1],m=d[2],h=d[3];else{f=w(t,n,-v),t=f.x,n=f.y,f=w(l,p,-v),l=f.x,p=f.y;var x=(t-l)/2,S=(n-p)/2,k=x*x/(a*a)+S*S/(o*o);k>1&&(k=Math.sqrt(k),a*=k,o*=k);
21var T=a*a,C=o*o,_=(r===s?-1:1)*Math.sqrt(Math.abs((T*C-T*S*S-C*x*x)/(T*S*S+C*x*x)));m=_*a*S/o+(t+l)/2,h=_*-o*x/a+(n+p)/2,c=Math.asin(((n-h)/o).toFixed(9)),u=Math.asin(((p-h)/o).toFixed(9)),(c=t<m?g-c:c)<0&&(c=2*g+c),(u=l<m?g-u:u)<0&&(u=2*g+u),s&&c>u&&(c-=2*g),!s&&u>c&&(u-=2*g)}var E=u-c;if(Math.abs(E)>y){var M=u,j=l,I=p;u=c+y*(s&&u>c?1:-1),l=m+a*Math.cos(u),p=h+o*Math.sin(u),b=e(l,p,a,o,i,0,s,j,I,[u,M,m,h])}E=u-c;var R=Math.cos(c),N=Math.sin(c),A=Math.cos(u),D=Math.sin(u),L=Math.tan(E/4),P=4/3*a*L,O=4/3*o*L,F=[t,n],B=[t+P*N,n-O*R],G=[l+P*D,p-O*A],U=[l,p];B[0]=2*F[0]-B[0];B[1]=2*F[1]-B[1];if(d)return[B,G,U].concat(b);b=[B,G,U].concat(b).join().split(",");for(var z=[],q=0,V=b.length;q<V;q++)z[q]=q%2?w(b[q-1],b[q],v).y:w(b[q],b[q+1],v).x;return z}.apply(0,[t.x,t.y].concat(e.slice(1))));break;case"S":"C"===n||"S"===n?(a=2*t.x-t.bx,o=2*t.y-t.by):(a=t.x,o=t.y),e=["C",a,o].concat(e.slice(1));break;case"T":"Q"===n||"T"===n?(t.qx=2*t.x-t.qx,t.qy=2*t.y-t.qy):(t.qx=t.x,t.qy=t.y),e=["C"].concat(y(t.x,t.y,t.qx,t.qy,e[1],e[2]));break;
21case"Q":t.qx=e[1],t.qy=e[2],e=["C"].concat(y(t.x,t.y,e[1],e[2],e[3],e[4]));break;case"L":e=["C"].concat(g(t.x,t.y,e[1],e[2]));break;case"H":e=["C"].concat(g(t.x,t.y,e[1],t.y));break;case"V":e=["C"].concat(g(t.x,t.y,t.x,e[1]));break;case"Z":e=["C"].concat(g(t.x,t.y,t.X,t.Y))}return e},d=function(e,t){if(e[t].length>7){e[t].shift();for(var i=e[t];i.length;)s[t]="A",o&&(l[t]="A"),e.splice(t++,0,["C"].concat(i.splice(0,6)));e.splice(t,1),n=Math.max(a.length,o&&o.length||0)}},c=function(e,t,i,r,s){e&&t&&"M"===e[s][0]&&"M"!==t[s][0]&&(t.splice(s,0,["M",r.x,r.y]),i.bx=0,i.by=0,i.x=e[s][1],i.y=e[s][2],n=Math.max(a.length,o&&o.length||0))},u="",m="";n=Math.max(a.length,o&&o.length||0);for(var f=0;f<n;f++){a[f]&&(u=a[f][0]),"C"!==u&&(s[f]=u,f&&(m=s[f-1])),a[f]=p(a[f],i,m),"A"!==s[f]&&"C"===u&&(s[f]="C"),d(a,f),o&&(o[f]&&(u=o[f][0]),"C"!==u&&(l[f]=u,f&&(m=l[f-1])),o[f]=p(o[f],r,m),"A"!==l[f]&&"C"===u&&(l[f]="C"),d(o,f)),c(a,o,i,r,f),c(o,a,r,i,f);var v=a[f],b=o&&o[f],w=v.length,x=o&&b.length;i.x=v[w-2],i.y=v[w-1],i.bx=parseFloat(v[w-4])||i.x,i.by=parseFloat(v[w-3])||i.y,r.bx=o&&(parseFloat(b[x-4])||r.x),r.by=o&&(parseFloat(b[x-3])||r.y),r.x=o&&b[x-2],r.y=o&&b[x-1]}return o?[a,o]:a}(e);for(var a,o,i,r,s,l=0,p=0,d=e.length;p<d;p++){if("M"===(i=e[p])[0])a=+i[1],o=+i[2];else{if(l+(r=u(a,o,i[1],i[2],i[3],i[4],i[5],i[6]))>t&&!n)return{x:(s=u(a,o,i[1],i[2],i[3],i[4],i[5],i[6],t-l)).x,y:s.y,alpha:s.alpha};l+=r,a=+i[5],o=+i[6]}i.shift()+i}return(s=n?l:c(a,o,i[0],i[1],i[2],i[3],i[4],i[5],1)).alpha&&(s={x:s.x,y:s.y,alpha:s.alpha}),s}function h(e){var t=[],n=0,a=0,o=0,i=0,r=0;if(!e)return t;"M"===e[0][0]&&(o=n=+e[0][1],i=a=+e[0][2],r++,t[0]=["M",n,a]);for(var s,l,p,d=3===e.length&&"M"===e[0][0]&&"R"===e[1][0].toUpperCase()&&"Z"===e[2][0].toUpperCase(),c=r,u=e.length;c<u;c++){if(t.push(l=[]),(p=e[c])[0]!==String.prototype.toUpperCase.call(p[0]))switch(l[0]=String.prototype.toUpperCase.call(p[0]),l[0]){case"A":l[1]=p[1],l[2]=p[2],l[3]=p[3],l[4]=p[4],l[5]=p[5],l[6]=+(p[6]+n),l[7]=+(p[7]+a);break;case"V":l[1]=+p[1]+a;break;case"H":l[1]=+p[1]+n;break;case"R":for(var m=2,h=(s=[n,a].concat(p.slice(1))).length;m<h;m++)s[m]=+s[m]+n,s[++m]=+s[m]+a;t.pop(),t=t.concat(f(s,d));break;case"M":o=+p[1]+n,i=+p[2]+a;break;default:for(m=1,h=p.length;m<h;m++)l[m]=+p[m]+(m%2?n:a)}else if("R"===p[0])s=[n,a].concat(p.slice(1)),t.pop(),t=t.concat(f(s,d)),l=["R"].concat(p.slice(-2));else for(var g=0,y=p.length;g<y;g++)l[g]=p[g];switch(l[0]){case"Z":n=o,a=i;break;case"H":n=l[1];break;case"V":a=l[1];break;case"M":o=l[l.length-2],i=l[l.length-1];break;default:n=l[l.length-2],a=l[l.length-1]}}return t}function f(e,t){for(var n=[],a=0,o=e.length;o-2*!t>a;a+=2){var i=[{x:+e[a-2],y:+e[a-1]},{x:+e[a],y:+e[a+1]},{x:+e[a+2],y:+e[a+3]},{x:+e[a+4],y:+e[a+5]}];t?a?o-4===a?i[3]={x:+e[0],y:+e[1]}:o-2===a&&(i[2]={x:+e[0],y:+e[1]},i[3]={x:+e[2],y:+e[3]}):i[0]={x:+e[o-2],y:+e[o-1]}:o-4===a?i[3]=i[2]:a||(i[0]={x:+e[a],y:+e[a+1]}),n.push(["C",(-i[0].x+6*i[1].x+i[2].x)/6,(-i[0].y+6*i[1].y+i[2].y)/6,(i[1].x+6*i[2].x-i[3].x)/6,(i[1].y+6*i[2].y-i[3].y)/6,i[2].x,i[2].y])}return n}function g(e,t,n,a){return[e,t,n,a,n,a]}function y(e,t,n,a,o,i){return[1/3*e+2/3*n,1/3*t+2/3*a,1/3*o+2/3*n,1/3*i+2/3*a,o,i]}function v(e,t,n,a,o,i,r,s,l){null==l&&(l=1);for(var p=(l=l>1?1:l<0?0:l)/2,d=[-.1252,.1252,-.3678,.3678,-.5873,.5873,-.7699,.7699,-.9041,.9041,-.9816,.9816],c=0,u=[.2491,.2491,.2335,.2335,.2032,.2032,.1601,.1601,.1069,.1069,.0472,.0472],m=0;m<12;m++){var h=p*d[m]+p,f=b(h,e,n,o,r),g=b(h,t,a,i,s),y=f*f+g*g;c+=u[m]*Math.sqrt(y)}return p*c}function b(e,t,n,a,o){return e*(e*(-3*t+9*n-9*a+3*o)+6*t-12*n+6*a)-3*t+3*n}o.Font=function(e){this.parent=e,this.cache={},this.font=void 0},o.Font.prototype.textBounds=function(e,t,n,a,o){t=void 0!==t?t:0,n=void 0!==n?n:0;var r,s=o&&o.renderer&&o.renderer._pInst||this.parent,l=s._renderer.drawingContext;l.textAlign||i.LEFT,l.textBaseline||i.BASELINE;if(a=a||s._renderer._textSize,!r){var p,d,c,u,m=[],h=[],f=this._scale(a);this.font.forEachGlyph(e,t,n,a,o,function(e,t,n,a){var o=e.getMetrics();m.push(t+o.xMin*f),m.push(t+o.xMax*f),h.push(n+-o.yMin*f),h.push(n+-o.yMax*f)}),p=Math.min.apply(null,m),d=Math.min.apply(null,h),c=Math.max.apply(null,m),r={x:p,y:d,h:Math.max.apply(null,h)-d,w:c-p,advance:p-t},u=this._handleAlignment(s._renderer,e,r.x,r.y,r.w+r.advance),r.x=u.x,r.y=u.y}return r},o.Font.prototype.textToPoints=function(e,t,n,a,o){var i=0,l=[],p=this._getGlyphs(e);function d(t){return p[t].name&&"space"===p[t].name||e.length===p.length&&" "===e[t]||p[t].index&&3===p[t].index}a=a||this.parent._renderer._textSize;
21for(var c=0;c<p.length;c++){if(!d(c))for(var u=s(p[c].getPath(t,n,a).commands),m=0;m<u.length;m++)for(var h=r(u[m],o),f=0;f<h.length;f++)h[f].x+=i,l.push(h[f]);i+=p[c].advanceWidth*this._scale(a)}return l},o.Font.prototype._getGlyphs=function(e){return this.font.stringToGlyphs(e)},o.Font.prototype._getPath=function(e,t,n,a){var o=(a&&a.renderer&&a.renderer._pInst||this.parent)._renderer,i=this._handleAlignment(o,e,t,n);return this.font.getPath(e,i.x,i.y,o._textSize,a)},o.Font.prototype._getPathData=function(e,t,n,o){var i=3;return"string"==typeof e&&arguments.length>2?e=this._getPath(e,t,n,o):"object"===a(t)&&(o=t),o&&"number"==typeof o.decimals&&(i=o.decimals),e.toPathData(i)},o.Font.prototype._getSVG=function(e,t,n,o){var i=3;return"string"==typeof e&&arguments.length>2?e=this._getPath(e,t,n,o):"object"===a(t)&&(o=t),o&&("number"==typeof o.decimals&&(i=o.decimals),"number"==typeof o.strokeWidth&&(e.strokeWidth=o.strokeWidth),void 0!==o.fill&&(e.fill=o.fill),void 0!==o.stroke&&(e.stroke=o.stroke)),e.toSVG(i)},o.Font.prototype._renderPath=function(e,t,n,o){var r,s=o&&o.renderer||this.parent._renderer,l=s.drawingContext;r="object"===a(e)&&e.commands?e.commands:this._getPath(e,t,n,o).commands,l.beginPath();for(var p=0;p<r.length;p+=1){var d=r[p];"M"===d.type?l.moveTo(d.x,d.y):"L"===d.type?l.lineTo(d.x,d.y):"C"===d.type?l.bezierCurveTo(d.x1,d.y1,d.x2,d.y2,d.x,d.y):"Q"===d.type?l.quadraticCurveTo(d.x1,d.y1,d.x,d.y):"Z"===d.type&&l.closePath()}return s._doStroke&&s._strokeSet&&l.stroke(),s._doFill&&(s._fillSet||s._setFill(i._DEFAULT_TEXT_FILL),l.fill()),this},o.Font.prototype._textWidth=function(e,t){return this.font.getAdvanceWidth(e,t)},o.Font.prototype._textAscent=function(e){return this.font.ascender*this._scale(e)},o.Font.prototype._textDescent=function(e){return-this.font.descender*this._scale(e)},o.Font.prototype._scale=function(e){return 1/this.font.unitsPerEm*(e||this.parent._renderer._textSize)},o.Font.prototype._handleAlignment=function(e,t,n,a,o){var r=e._textSize;switch(void 0===o&&(o=this._textWidth(t,r)),e._textAlign){case i.CENTER:n-=o/2;break;case i.RIGHT:n-=o}switch(e._textBaseline){case i.TOP:a+=this._textAscent(r);break;case i.CENTER:a+=this._textAscent(r)/2;break;case i.BOTTOM:a-=this._textDescent(r)}return{x:n,y:a}},t.exports=o},{"../core/constants":18,"../core/main":24}],61:[function(e,t,n){"use strict";var a=e("../core/main");a.prototype.append=function(e,t){return e.push(t),e},a.prototype.arrayCopy=function(e,t,n,a,o){var i,r;void 0!==o?(r=Math.min(o,e.length),i=a,e=e.slice(t,r+t)):(void 0!==n?(r=n,r=Math.min(r,e.length)):r=e.length,i=0,n=t,e=e.slice(0,r)),Array.prototype.splice.apply(n,[i,r].concat(e))},a.prototype.concat=function(e,t){return e.concat(t)},a.prototype.reverse=function(e){return e.reverse()},a.prototype.shorten=function(e){return e.pop(),e},a.prototype.shuffle=function(e,t){for(var n,a,o=ArrayBuffer&&ArrayBuffer.isView&&ArrayBuffer.isView(e),i=(e=t||o?e:e.slice()).length;i>1;)n=Math.random()*i|0,a=e[--i],e[i]=e[n],e[n]=a;return e},a.prototype.sort=function(e,t){var n=t?e.slice(0,Math.min(t,e.length)):e,a=t?e.slice(Math.min(t,e.length)):[];return(n="string"==typeof n[0]?n.sort():n.sort(function(e,t){return e-t})).concat(a)},a.prototype.splice=function(e,t,n){return Array.prototype.splice.apply(e,[n,0].concat(t)),e},a.prototype.subset=function(e,t,n){return void 0!==n?e.slice(t,t+n):e.slice(t,e.length)},t.exports=a},{"../core/main":24}],62:[function(e,t,n){"use strict";var a=e("../core/main");a.prototype.float=function(e){return e instanceof Array?e.map(parseFloat):parseFloat(e)},a.prototype.int=function(e,t){return t=t||10,e===1/0||"Infinity"===e?1/0:e===-1/0||"-Infinity"===e?-1/0:"str
21ing"==typeof e?parseInt(e,t):"number"==typeof e?0|e:"boolean"==typeof e?e?1:0:e instanceof Array?e.map(function(e){return a.prototype.int(e,t)}):void 0},a.prototype.str=function(e){return e instanceof Array?e.map(a.prototype.str):String(e)},a.prototype.boolean=function(e){return"number"==typeof e?0!==e:"string"==typeof e?"true"===e.toLowerCase():"boolean"==typeof e?e:e instanceof Array?e.map(a.prototype.boolean):void 0},a.prototype.byte=function(e){var t=a.prototype.int(e,10);return"number"==typeof t?(t+128)%256-128:t instanceof Array?t.map(a.prototype.byte):void 0},a.prototype.char=function(e){return"number"!=typeof e||isNaN(e)?e instanceof Array?e.map(a.prototype.char):"string"==typeof e?a.prototype.char(parseInt(e,10)):void 0:String.fromCharCode(e)},a.prototype.unchar=function(e){return"string"==typeof e&&1===e.length?e.charCodeAt(0):e instanceof Array?e.map(a.prototype.unchar):void 0},a.prototype.hex=function(e,t){if(t=null==t?t=8:t,e instanceof Array)return e.map(function(e){return a.prototype.hex(e,t)});if(e===1/0||e===-1/0)return(e===1/0?"F":"0").repeat(t);if("number"==typeof e){e<0&&(e=4294967295+e+1);for(var n=Number(e).toString(16).toUpperCase();n.length<t;)n="0"+n;return n.length>=t&&(n=n.substring(n.length-t,n.length)),n}},a.prototype.unhex=function(e){return e instanceof Array?e.map(a.prototype.unhex):parseInt("0x"+e,16)},t.exports=a},{"../core/main":24}],63:[function(e,t,n){"use strict";var a=e("../core/main");function o(e,t,n){var a=e<0,o=a?e.toString().substring(1):e.toString(),i=o.indexOf("."),r=-1!==i?o.substring(0,i):o,s=-1!==i?o.substring(i+1):"",l=a?"-":"";if(void 0!==n){var p="";(-1!==i||n-s.length>0)&&(p="."),s.length>n&&(s=s.substring(0,n));for(var d=0;d<t-r.length;d++)l+="0";l+=r,l+=p,l+=s;for(var c=0;c<n-s.length;c++)l+="0";return l}for(var u=0;u<Math.max(t-r.length,0);u++)l+="0";return l+=o}function i(e,t){var n=(e=e.toString()).indexOf("."),a=-1!==n?e.substring(n):"",o=-1!==n?e.substring(0,n):e;if(o=o.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),0===t)a="";else if(void 0!==t)if(t>a.length)for(var i=t-(a+=-1===n?".":"").length+1,r=0;r<i;r++)a+="0";else a=a.substring(0,t+1);return o+a}function r(e){return parseFloat(e)>0?"+"+e.toString():e.toString()}function s(e){return parseFloat(e)>=0?" "+e.toString():e.toString()}e("../core/error_helpers"),a.prototype.join=function(e,t){return a._validateParameters("join",arguments),e.join(t)},a.prototype.match=function(e,t){return a._validateParameters("match",arguments),e.match(t)},a.prototype.matchAll=function(e,t){a._validateParameters("matchAll",arguments);for(var n=new RegExp(t,"g"),o=n.exec(e),i=[];null!==o;)i.push(o),o=n.exec(e);return i},a.prototype.nf=function(e,t,n){return a._validateParameters("nf",arguments),e instanceof Array?e.map(function(e){return o(e,t,n)}):"[object Arguments]"===Object.prototype.toString.call(e)?3===e.length?this.nf(e[0],e[1],e[2]):2===e.length?this.nf(e[0],e[1]):this.nf(e[0]):o(e,t,n)},a.prototype.nfc=function(e,t){return a._validateParameters("nfc",arguments),e instanceof Array?e.map(function(e){return i(e,t)}):i(e,t)}
21,a.prototype.nfp=function(){a._validateParameters("nfp",arguments);var e=a.prototype.nf.apply(this,arguments);return e instanceof Array?e.map(r):r(e)},a.prototype.nfs=function(){a._validateParameters("nfs",arguments);var e=a.prototype.nf.apply(this,arguments);return e instanceof Array?e.map(s):s(e)},a.prototype.split=function(e,t){return a._validateParameters("split",arguments),e.split(t)},a.prototype.splitTokens=function(e,t){var n;if(a._validateParameters("splitTokens",arguments),void 0!==t){var o=t,i=/\]/g.exec(o),r=/\[/g.exec(o);r&&i?(o=o.slice(0,i.index)+o.slice(i.index+1),r=/\[/g.exec(o),o=o.slice(0,r.index)+o.slice(r.index+1),n=new RegExp("[\\["+o+"\\]]","g")):i?(o=o.slice(0,i.index)+o.slice(i.index+1),n=new RegExp("["+o+"\\]]","g")):r?(o=o.slice(0,r.index)+o.slice(r.index+1),n=new RegExp("["+o+"\\[]","g")):n=new RegExp("["+o+"]","g")}else n=/\s/g;return e.split(n).filter(function(e){return e})},a.prototype.trim=function(e){return a._validateParameters("trim",arguments),e instanceof Array?e.map(this.trim):e.trim()},t.exports=a},{"../core/error_helpers":20,"../core/main":24}],64:[function(e,t,n){"use strict";var a=e("../core/main");a.prototype.day=function(){return(new Date).getDate()},a.prototype.hour=function(){return(new Date).getHours()},a.prototype.minute=function(){return(new Date).getMinutes()},a.prototype.millis=function(){return window.performance.now()},a.prototype.month=function(){return(new Date).getMonth()+1},a.prototype.second=function(){return(new Date).getSeconds()},a.prototype.year=function(){return(new Date).getFullYear()},t.exports=a},{"../core/main":24}],65:[function(e,t,n){"use strict";var a=e("../core/main");e("./p5.Geometry");var o=e("../core/constants");a.prototype.plane=function(e,t,n,o){this._assert3d("plane"),a._validateParameters("plane",arguments),void 0===e&&(e=50),void 0===t&&(t=e),void 0===n&&(n=1),void 0===o&&(o=1);var i="plane|"+n+"|"+o;if(!this._renderer.geometryInHash(i)){var r=new a.Geometry(n,o,function(){for(var e,t,n,o=0;o<=this.detailY;o++){t=o/this.detailY;for(var i=0;i<=this.detailX;i++)e=i/this.detailX,n=new a.Vector(e-.5,t-.5,0),this.vertices.push(n),this.uvs.push(e,t)}});r.computeFaces().computeNormals(),n<=1&&o<=1?r._makeTriangleEdges()._edgesToVertices():console.log("Cannot draw stroke on plane objects with more than 1 detailX or 1 detailY"),this._renderer.createBuffers(i,r)}return this._renderer.drawBuffersScaled(i,e,t,1),this},a.prototype.box=function(e,t,n,o,i){this._assert3d("box"),a._validateParameters("box",arguments),void 0===e&&(e=50),void 0===t&&(t=e),void 0===n&&(n=t);var r=this._renderer.attributes&&this._renderer.attributes.perPixelLighting;void 0===o&&(o=r?1:4),void 0===i&&(i=r?1:4);var s="box|"+o+"|"+i;if(!this._renderer.geometryInHash(s)){var l=new a.Geometry(o,i,function(){var e=[[0,4,2,6],[1,3,5,7],[0,1,4,5],[2,6,3,7],[0,2,1,3],[4,5,6,7]];this.strokeIndices=[[0,1],[1,3],[3,2],[6,7],[8,9],[9,11],[14,15],[16,17],[17,19],[18,19],[20,21],[22,23]];for(var t=0;t<e.length;t++){for(var n=e[t],o=4*t,i=0;i<4;i++){var r=n[i],s=new a.Vector((2*(1&r)-1)/2,((2&r)-1)/2,((4&r)/2-1)/2);this.vertices.push(s),this.uvs.push(1&i,(2&i)/2)}this.faces.push([o,o+1,o+2]),this.faces.push([o+2,o+1,o+3])}});l.computeNormals(),o<=4&&i<=4?l._makeTriangleEdges()._edgesToVertices():console.log("Cannot draw stroke on box objects with more than 4 detailX or 4 detailY"),this._renderer.createBuffers(s,l)}return this._renderer.drawBuffersScaled(s,e,t,n),this},a.prototype.sphere=function(e,t,n){return this._assert3d("sphere"),a._validateParameters("sphere",arguments),void 0===e&&(e=50),void 0===t&&(t=24),void 0===n&&(n=16),this.ellipsoid(e,e,e,t,n),this};var i=function(e,t,n,o,i,r,s){e=e<=0?1:e,t=t<0?0:t,n=n<=0?e:n,o=o<3?3:o;var l,p,d,c=(r=void 0===r||r)?-2:0,u=(i=i<1?1:i)+((s=void 0===s?0!==t:s)?2:0),m=Math.atan2(e-t,n),h=Math.sin(m),f=Math.cos(m);for(l=c;l<=u;++l){var g,y=l/i,v=n*y;for(l<0?(v=0,y=0,g=e):l>i?(v=n,y=1,g=t):g=e+(t-e)*y,-2!==l&&l!==i+2||(g=0),v-=n/2,p=0;p<o;++p){var b,w=p/o,x=2*Math.PI*w,S=Math.sin(x),k=Math.cos(x);this.vertices.push(new a.Vector(S*g,v,k*g)),b=l<0?new a.Vector(0,-1,0):l>i&&t?new a.Vector(0,1,0):new a.Vector(S*f,h,k*f),this.vertexNormals.push(b),this.uvs.push(w,y)}}var T=0;if(r){for(d=0;d<o;++d){var C=(d+1)%o;this.faces.push([T+d,T+o+C,T+o+d])}T+=2*o}for(l=0;l<i;++l){for(p=0;p<o;++p){var _=(p+1)%o;this.faces.push([T+p,T+_,T+o+_]),this.faces.push([T+p,T+o+_,T+o+p])}T+=o}if(s)for(T+=o,p=0;p<o;++p)this.faces.push([T+p,T+(p+1)%o,T+o])};a.prototype.cylinder=function(e,t,n,o,r,s){this._assert3d("cylinder"),a._validateParameters("cylinder",arguments),void 0===e&&(e=50),void 0===t&&(t=e),void 0===n&&(n=24),void 0===o&&(o=1),void 0===s&&(s=!0),void 0===r&&(r=!0);
21var l="cylinder|"+n+"|"+o+"|"+r+"|"+s;if(!this._renderer.geometryInHash(l)){var p=new a.Geometry(n,o);i.call(p,1,1,1,n,o,r,s),n<=24&&o<=16?p._makeTriangleEdges()._edgesToVertices():console.log("Cannot draw stroke on cylinder objects with more than 24 detailX or 16 detailY"),this._renderer.createBuffers(l,p)}return this._renderer.drawBuffersScaled(l,e,t,e),this},a.prototype.cone=function(e,t,n,o,r){this._assert3d("cone"),a._validateParameters("cone",arguments),void 0===e&&(e=50),void 0===t&&(t=e),void 0===n&&(n=24),void 0===o&&(o=1),void 0===r&&(r=!0);var s="cone|"+n+"|"+o+"|"+r;if(!this._renderer.geometryInHash(s)){var l=new a.Geometry(n,o);i.call(l,1,0,1,n,o,r,!1),n<=24&&o<=16?l._makeTriangleEdges()._edgesToVertices():console.log("Cannot draw stroke on cone objects with more than 24 detailX or 16 detailY"),this._renderer.createBuffers(s,l)}return this._renderer.drawBuffersScaled(s,e,t,e),this},a.prototype.ellipsoid=function(e,t,n,o,i){this._assert3d("ellipsoid"),a._validateParameters("ellipsoid",arguments),void 0===e&&(e=50),void 0===t&&(t=e),void 0===n&&(n=e),void 0===o&&(o=24),void 0===i&&(i=16);var r="ellipsoid|"+o+"|"+i;if(!this._renderer.geometryInHash(r)){var s=new a.Geometry(o,i,function(){for(var e=0;e<=this.detailY;e++)for(var t=e/this.detailY,n=Math.PI*t-Math.PI/2,o=Math.cos(n),i=Math.sin(n),r=0;r<=this.detailX;r++){var s=r/this.detailX,l=2*Math.PI*s,p=Math.cos(l),d=Math.sin(l),c=new a.Vector(o*d,i,o*p);this.vertices.push(c),this.vertexNormals.push(c),this.uvs.push(s,t)}});s.computeFaces(),o<=24&&i<=24?s._makeTriangleEdges()._edgesToVertices():console.log("Cannot draw stroke on ellipsoids with more than 24 detailX or 24 detailY"),this._renderer.createBuffers(r,s)}return this._renderer.drawBuffersScaled(r,e,t,n),this},a.prototype.torus=function(e,t,n,o){if(this._assert3d("torus"),a._validateParameters("torus",arguments),void 0===e)e=50;else if(!e)return;if(void 0===t)t=10;else if(!t)return;void 0===n&&(n=24),void 0===o&&(o=16);var i=(t/e).toPrecision(4),r="torus|"+i+"|"+n+"|"+o;if(!this._renderer.geometryInHash(r)){var s=new a.Geometry(n,o,function(){for(var e=0;e<=this.detailY;e++)for(var t=e/this.detailY,n=2*Math.PI*t,o=Math.cos(n),r=Math.sin(n),s=1+i*o,l=0;l<=this.detailX;l++){var p=l/this.detailX,d=2*Math.PI*p,c=Math.cos(d),u=Math.sin(d),m=new a.Vector(s*c,s*u,i*r),h=new a.Vector(o*c,o*u,r);this.vertices.push(m),this.vertexNormals.push(h),this.uvs.push(p,t)}});s.computeFaces(),n<=24&&o<=16?s._makeTriangleEdges()._edgesToVertices():console.log("Cannot draw strokes on torus object with more than 24 detailX or 16 detailY"),this._renderer.createBuffers(r,s)}return this._renderer.drawBuffersScaled(r,e,e,e),this},a.RendererGL.prototype.point=function(e,t,n){void 0===n&&(n=0);var o=[];return o.push(new a.Vector(e,t,n)),this._drawPoints(o,this._pointVertexBuffer),this},a.RendererGL.prototype.triangle=function(e){var t=e[0],n=e[1],o=e[2],i=e[3],r=e[4],s=e[5];if(!this.geometryInHash("tri")){var l=new a.Geometry(1,1,function(){var e=[];e.push(new a.Vector(0,0,0)),e.push(new a.Vector(0,1,0)),e.push(new a.Vector(1,0,0)),this.strokeIndices=[[0,1],[1,2],[2,0]],this.vertices=e,this.faces=[[0,1,2]],this.uvs=[0,0,0,1,1,1]});l._makeTriangleEdges()._edgesToVertices(),l.computeNormals(),this.createBuffers("tri",l)}var p=this.uMVMatrix.copy();try{var d=new a.Matrix([o-t,i-n,0,0,r-t,s-n,0,0,0,0,1,0,t,n,0,1]).mult(this.uMVMatrix);this.uMVMatrix=d,this.drawBuffers("tri")}finally{this.uMVMatrix=p}return this},a.RendererGL.prototype.ellipse=function(e){this.arc(e[0],e[1],e[2],e[3],0,o.TWO_PI,o.OPEN,e[4])},a.RendererGL.prototype.arc=function(e){var t,n,i=arguments[0],r=arguments[1],s=arguments[2],l=arguments[3],p=arguments[4],d=arguments[5],c=arguments[6],u=arguments[7]||25;if(n=Math.abs(d-p)>=o.TWO_PI?(t="ellipse")+"|"+u+"|":(t="arc")+"|"+p+"|"+d+"|"+c+"|"+u+"|",!this.geometryInHash(n)){var m=new a.Geometry(u,1,function(){if(this.strokeIndices=[],p.toFixed(10)!==d.toFixed(10)){c!==o.PIE&&void 0!==c||(this.vertices.push(new a.Vector(.5,.5,0)),this.uvs.push([.5,.5]));for(var e=0;e<=u;e++){var t=e/u*(d-p)+p,n=.5+Math.cos(t)/2,i=.5+Math.sin(t)/2;this.vertices.push(new a.Vector(n,i,0)),this.uvs.push([n,i]),e<u-1&&(this.faces.push([0,e+1,e+2]),this.strokeIndices.push([e+1,e+2]))}switch(c){case o.PIE:this.faces.push([0,this.vertices.length-2,this.vertices.length-1]),this.strokeIndices.push([0,1]),this.strokeIndices.push([this.vertices.length-2,this.vertices.length-1]),this.strokeIndices.push([0,this.vertices.length-1]);break;case o.CHORD:this.strokeIndices.push([0,1]),this.strokeIndices.push([0,this.vertices.length-1]);break;case o.OPEN:this.strokeIndices.push([0,1]);break;default:this.faces.push([0,this.vertices.length-2,this.vertices.length-1]),this.strokeIndices.push([this.vertices.length-2,this.vertices.length-1])}}});m.computeNormals(),u<=50?m._makeTriangleEdges()._edgesToVertices(m):console.log("Cannot stroke "+t+" with more than 50 detail"),this.createBuffers(n,m)}var h=this.uMVMatrix.copy();try{this.uMVMatrix.translate([i,r,0]),this.uMVMatrix.scale(s,l,1),this.drawBuffers(n)}finally{this.uMVMatrix=h}return this},a.RendererGL.prototype.rect=function(e){var t=this._pInst._glAttributes.perPixelLighting,
21n=e[0],o=e[1],i=e[2],r=e[3],s=e[4]||(t?1:24),l=e[5]||(t?1:16),p="rect|"+s+"|"+l;if(!this.geometryInHash(p)){var d=new a.Geometry(s,l,function(){for(var e=0;e<=this.detailY;e++)for(var t=e/this.detailY,n=0;n<=this.detailX;n++){var o=n/this.detailX,i=new a.Vector(o,t,0);this.vertices.push(i),this.uvs.push(o,t)}s>0&&l>0&&(this.strokeIndices=[[0,s],[s,(s+1)*(l+1)-1],[(s+1)*(l+1)-1,(s+1)*l],[(s+1)*l,0]])});d.computeFaces().computeNormals()._makeTriangleEdges()._edgesToVertices(),this.createBuffers(p,d)}var c=this.uMVMatrix.copy();try{this.uMVMatrix.translate([n,o,0]),this.uMVMatrix.scale(i,r,1),this.drawBuffers(p)}finally{this.uMVMatrix=c}return this},a.RendererGL.prototype.quad=function(e,t,n,o,i,r,s,l,p,d,c,u){var m="quad|"+e+"|"+t+"|"+n+"|"+o+"|"+i+"|"+r+"|"+s+"|"+l+"|"+p+"|"+d+"|"+c+"|"+u;if(!this.geometryInHash(m)){var h=new a.Geometry(2,2,function(){this.vertices.push(new a.Vector(e,t,n)),this.vertices.push(new a.Vector(o,i,r)),this.vertices.push(new a.Vector(s,l,p)),this.vertices.push(new a.Vector(d,c,u)),this.uvs.push(0,0,1,0,1,1,0,1),this.strokeIndices=[[0,1],[1,2],[2,3],[3,0]]});h.computeNormals()._makeTriangleEdges()._edgesToVertices(),h.faces=[[0,1,2],[2,3,0]],this.createBuffers(m,h)}return this.drawBuffers(m),this},a.RendererGL.prototype.bezier=function(e,t,n,a,o,i,r,s,l,p,d,c){8===arguments.length&&(d=s,p=r,s=i,r=o,o=a,a=n,n=i=l=c=0);var u=this._pInst._bezierDetail||20;this.beginShape();for(var m=0;m<=u;m++){var h=Math.pow(1-m/u,3),f=m/u*3*Math.pow(1-m/u,2),g=3*Math.pow(m/u,2)*(1-m/u),y=Math.pow(m/u,3);this.vertex(e*h+a*f+r*g+p*y,t*h+o*f+s*g+d*y,n*h+i*f+l*g+c*y)}return this.endShape(),this},a.RendererGL.prototype.curve=function(e,t,n,a,o,i,r,s,l,p,d,c){8===arguments.length&&(p=r,d=s,r=o,s=a,o=a=n,n=i=l=c=0);var u=this._pInst._curveDetail;this.beginShape();for(var m=0;m<=u;m++){var h=.5*Math.pow(m/u,3),f=.5*Math.pow(m/u,2),g=m/u*.5,y=h*(3*a-e-3*r+p)+f*(2*e-5*a+4*r-p)+g*(-e+r)+2*a*.5,v=h*(3*o-t-3*s+d)+f*(2*t-5*o+4*s-d)+g*(-t+s)+2*o*.5,b=h*(3*i-n-3*l+c)+f*(2*n-5*i+4*l-c)+g*(-n+l)+2*i*.5;this.vertex(y,v,b)}return this.endShape(),this},a.RendererGL.prototype.line=function(){return 6===arguments.length?(this.beginShape(),this.vertex(arguments[0],arguments[1],arguments[2]),this.vertex(arguments[3],arguments[4],arguments[5]),this.endShape()):4===arguments.length&&(this.beginShape(),this.vertex(arguments[0],arguments[1],0),this.vertex(arguments[2],arguments[3],0),this.endShape()),this},a.RendererGL.prototype.bezierVertex=function(){if(0===this.immediateMode._bezierVertex.length)throw Error("vertex() must be used once before calling bezierVertex()");var e,t,n,a,o,i=[],r=[],s=[],l=arguments.length;if(e=0,0===this._lookUpTableBezier.length||this._lutBezierDetail!==this._pInst._curveDetail){this._lookUpTableBezier=[],this._lutBezierDetail=this._pInst._curveDetail;for(var p=1/this._lutBezierDetail,d=0,c=1,u=0;d<1;){if(e=parseFloat(d.toFixed(6)),this._lookUpTableBezier[u]=this._bezierCoefficients(e),c.toFixed(6)===p.toFixed(6)){e=parseFloat(c.toFixed(6))+parseFloat(d.toFixed(6)),++u,this._lookUpTableBezier[u]=this._bezierCoefficients(e);break}d+=p,c-=p,++u}}var m=this._lookUpTableBezier.length;if(6===l){for(this.isBezier=!0,i=[this.immediateMode._bezierVertex[0],arguments[0],arguments[2],arguments[4]],r=[this.immediateMode._bezierVertex[1],arguments[1],arguments[3],arguments[5]],o=0;o<m;o++)t=i[0]*this._lookUpTableBezier[o][0]+i[1]*this._lookUpTableBezier[o][1]+i[2]*this._lookUpTableBezier[o][2]+i[3]*this._lookUpTableBezier[o][3],n=r[0]*this._lookUpTableBezier[o][0]+r[1]*this._lookUpTableBezier[o][1]+r[2]*this._lookUpTableBezier[o][2]+r[3]*this._lookUpTableBezier[o][3],this.vertex(t,n);this.immediateMode._bezierVertex[0]=arguments[4],this.immediateMode._bezierVertex[1]=arguments[5]}else if(9===l){for(this.isBezier=!0,i=[this.immediateMode._bezierVertex[0],arguments[0],arguments[3],arguments[6]],r=[this.immediateMode._bezierVertex[1],arguments[1],arguments[4],arguments[7]],s=[this.immediateMode._bezierVertex[2],arguments[2],arguments[5],arguments[8]],o=0;o<m;o++)t=i[0]*this._lookUpTableBezier[o][0]+i[1]*this._lookUpTableBezier[o][1]+i[2]*this._lookUpTableBezier[o][2]+i[3]*this._lookUpTableBezier[o][3],n=r[0]*this._lookUpTableBezier[o][0]+r[1]*this._lookUpTableBezier[o][1]+r[2]*this._lookUpTableBezier[o][2]+r[3]*this._lookUpTableBezier[o][3],a=s[0]*this._lookUpTableBezier[o][0]+s[1]*this._lookUpTableBezier[o][1]+s[2]*this._lookUpTableBezier[o][2]+s[3]*this._lookUpTableBezier[o][3],this.vertex(t,n,a);this.immediateMode._bezierVertex[0]=arguments[6],this.immediateMode._bezierVertex[1]=arguments[7],this.immediateMode._bezierVertex[2]=arguments[8]}},a.RendererGL.prototype.quadraticVertex=function(){if(0===this.immediateMode._quadraticVertex.length)throw Error("vertex() must be used once before calling quadraticVertex()");var e,t,n,a,o,i=[],r=[],s=[],l=arguments.length;if(e=0,0===this._lookUpTableQuadratic.length||this._lutQuadraticDetail!==this._pInst._curveDetail){this._lookUpTableQuadratic=[],this._lutQuadraticDetail
21=this._pInst._curveDetail;for(var p=1/this._lutQuadraticDetail,d=0,c=1,u=0;d<1;){if(e=parseFloat(d.toFixed(6)),this._lookUpTableQuadratic[u]=this._quadraticCoefficients(e),c.toFixed(6)===p.toFixed(6)){e=parseFloat(c.toFixed(6))+parseFloat(d.toFixed(6)),++u,this._lookUpTableQuadratic[u]=this._quadraticCoefficients(e);break}d+=p,c-=p,++u}}var m=this._lookUpTableQuadratic.length;if(4===l){for(this.isQuadratic=!0,i=[this.immediateMode._quadraticVertex[0],arguments[0],arguments[2]],r=[this.immediateMode._quadraticVertex[1],arguments[1],arguments[3]],o=0;o<m;o++)t=i[0]*this._lookUpTableQuadratic[o][0]+i[1]*this._lookUpTableQuadratic[o][1]+i[2]*this._lookUpTableQuadratic[o][2],n=r[0]*this._lookUpTableQuadratic[o][0]+r[1]*this._lookUpTableQuadratic[o][1]+r[2]*this._lookUpTableQuadratic[o][2],this.vertex(t,n);this.immediateMode._quadraticVertex[0]=arguments[2],this.immediateMode._quadraticVertex[1]=arguments[3]}else if(6===l){for(this.isQuadratic=!0,i=[this.immediateMode._quadraticVertex[0],arguments[0],arguments[3]],r=[this.immediateMode._quadraticVertex[1],arguments[1],arguments[4]],s=[this.immediateMode._quadraticVertex[2],arguments[2],arguments[5]],o=0;o<m;o++)t=i[0]*this._lookUpTableQuadratic[o][0]+i[1]*this._lookUpTableQuadratic[o][1]+i[2]*this._lookUpTableQuadratic[o][2],n=r[0]*this._lookUpTableQuadratic[o][0]+r[1]*this._lookUpTableQuadratic[o][1]+r[2]*this._lookUpTableQuadratic[o][2],a=s[0]*this._lookUpTableQuadratic[o][0]+s[1]*this._lookUpTableQuadratic[o][1]+s[2]*this._lookUpTableQuadratic[o][2],this.vertex(t,n,a);this.immediateMode._quadraticVertex[0]=arguments[3],this.immediateMode._quadraticVertex[1]=arguments[4],this.immediateMode._quadraticVertex[2]=arguments[5]}},a.RendererGL.prototype.curveVertex=function(){var e,t,n,a,o,i=[],r=[],s=[];e=0;var l=arguments.length;if(0===this._lookUpTableBezier.length||this._lutBezierDetail!==this._pInst._curveDetail){this._lookUpTableBezier=[],this._lutBezierDetail=this._pInst._curveDetail;for(var p=1/this._lutBezierDetail,d=0,c=1,u=0;d<1;){if(e=parseFloat(d.toFixed(6)),this._lookUpTableBezier[u]=this._bezierCoefficients(e),c.toFixed(6)===p.toFixed(6)){e=parseFloat(c.toFixed(6))+parseFloat(d.toFixed(6)),++u,this._lookUpTableBezier[u]=this._bezierCoefficients(e);break}d+=p,c-=p,++u}}var m=this._lookUpTableBezier.length;if(2===l){if(this.immediateMode._curveVertex.push(arguments[0]),this.immediateMode._curveVertex.push(arguments[1]),8===this.immediateMode._curveVertex.length){for(this.isCurve=!0,i=this._bezierToCatmull([this.immediateMode._curveVertex[0],this.immediateMode._curveVertex[2],this.immediateMode._curveVertex[4],this.immediateMode._curveVertex[6]]),r=this._bezierToCatmull([this.immediateMode._curveVertex[1],this.immediateMode._curveVertex[3],this.immediateMode._curveVertex[5],this.immediateMode._curveVertex[7]]),o=0;o<m;o++)t=i[0]*this._lookUpTableBezier[o][0]+i[1]*this._lookUpTableBezier[o][1]+i[2]*this._lookUpTableBezier[o][2]+i[3]*this._lookUpTableBezier[o][3],n=r[0]*this._lookUpTableBezier[o][0]+r[1]*this._lookUpTableBezier[o][1]+r[2]*this._lookUpTableBezier[o][2]+r[3]*this._lookUpTableBezier[o][3],this.vertex(t,n);for(o=0;o<l;o++)this.immediateMode._curveVertex.shift()}}else if(3===l&&(this.immediateMode._curveVertex.push(arguments[0]),this.immediateMode._curveVertex.push(arguments[1]),this.immediateMode._curveVertex.push(arguments[2]),12===this.immediateMode._curveVertex.length)){for(this.isCurve=!0,i=this._bezierToCatmull([this.immediateMode._curveVertex[0],this.immediateMode._curveVertex[3],this.immediateMode._curveVertex[6],this.immediateMode._curveVertex[9]]),r=this._bezierToCatmull([this.immediateMode._curveVertex[1],this.immediateMode._curveVertex[4],this.immediateMode._curveVertex[7],this.immediateMode._curveVertex[10]]),s=this._bezierToCatmull([this.immediateMode._curveVertex[2],this.immediateMode._curveVertex[5],this.immediateMode._curveVertex[8],this.immediateMode._curveVertex[11]]),o=0;o<m;o++)t=i[0]*this._lookUpTableBezier[o][0]+i[1]*this._lookUpTableBezier[o][1]+i[2]*this._lookUpTableBezier[o][2]+i[3]*this._lookUpTableBezier[o][3],n=r[0]*this._lookUpTableBezier[o][0]+r[1]*this._lookUpTableBezier[o][1]+r[2]*this._lookUpTableBezier[o][2]+r[3]*this._lookUpTableBezier[o][3],a=s[0]*this._lookUpTableBezier[o][0]+s[1]*this._lookUpTableBezier[o][1]+s[2]*this._lookUpTableBezier[o][2]+s[3]*this._lookUpTableBezier[o][3],this.vertex(t,n,a);for(o=0;o<l;o++)this.immediateMode._curveVertex.shift()}},a.RendererGL.prototype.image=function(e,t,n,a,i,r,s,l,p){this._pInst.push(),this._pInst.texture(e),this._pInst.textureMode(o.NORMAL);var d=0;t<=e.width&&(d=t/e.width);var c=1;t+a<=e.width&&(c=(t+a)/e.width);var u=0;n<=e.height&&(u=n/e.height);var m=1;n+i<=e.height&&(m=(n+i)/e.height),this.beginShape(),this.vertex(r,s,0,d,u),this.vertex(r+l,s,0,c,u),this.vertex(r+l,s+p,0,c,m),this.vertex(r,s+p,0,d,m),this.endShape(o.CLOSE),this._pInst.pop()},t.exports=a},{"../core/constants":18,"../core/main":24,"./p5.Geometry":71}],66:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("../core/constants");a.prototype.orbitControl=function(e,t){if(this._assert3d("orbitControl"),a._validateParameters("orbitControl",arguments),this.mouseX<this.width&&this.mouseX>0&&this.mouseY<this.height&&this.mouseY>0){var n=this._renderer._curCamera;void 0===e&&(e=1),void 0===t&&(t=e),!0!==this.contextMenuDisabled&&(this.canvas.oncontextmenu=function(){return!1},this._setProperty("contextMenuDisabled",!0)),!0!==this.wheelDefaultDisabled&&(this.canvas.onwheel=function(){return!1},this._setProperty("wheelDefaultDisabled",!0));var o=this.height<this.width?this.height:this.width;if(this._mouseWheelDeltaY!==this._pmouseWheelDeltaY&&(this._mouseWheelDeltaY>0?this._renderer._curCamera._orbit(0,0,.5*o):this._renderer._curCamera._orbit(0,0,-.5*o)),this.mouseIsPressed)if(this.mouseButton===this.LEFT){var i=-e*(this.mouseX-this.pmouseX)/o,r=t*(this.mouseY-this.pmouseY)/o;this._renderer._curCamera._orbit(i,r,0)}else if(this.mouseButton===this.RIGHT){var s=n._getLocalAxes(),l=Math.sqrt(s.x[0]*s.x[0]+s.x[2]*s.x[2]);0!==l&&(s.x[0]/=l,s.x[2]/=l);var p=Math.sqrt(s.y[0]*s.y[0]+s.y[2]*s.y[2]);0!==p&&(s.y[0]/=p,s.y[2]/=p);var d=-1*e*(this.mouseX-this.pmouseX),c=-1*t*(this.mouseY-this.pmouseY);n.setPosition(n.eyeX+d*s.x[0]+c*s.z[0],n.eyeY,n.eyeZ+d*s.x[2]+c*s.z[2])}return this}},a.prototype.debugMode=function(){this._assert3d("debugMode"),a._validateParameters("debugMode",arguments);for(var e=this._registeredMethods.post.length-1;e>=0;e--)this._registeredMethods.post[e].toString()!==this._grid().toString()&&this._registeredMethods.post[e].toString()!==this._axesIcon().toString()||this._registeredMethods.post.splice(e,1);arguments[0]===o.GRID?this.registerMethod("post",this._grid.call(this,arguments[1],arguments[2],arguments[3],arguments[4],arguments[5])):arguments[0]===o.AXES?this.registerMethod("post",this._axesIcon.call(this,arguments[1],arguments[2],arguments[3],arguments[4])):(this.registerMethod("post",this._grid.call(this,arguments[0],arguments[1],arguments[2],arguments[3],arguments[4])),this.registerMethod("post",this._axesIcon.call(this,arguments[5],arguments[6],arguments[7],arguments[8])))},a.prototype.noDebugMode=function(){this._assert3d("noDebugMode");for(var e=this._registeredMethods.post.length-1;e>=0;e--)this._registeredMethods.post[e].toString()!==this._grid().toString()&&this._registeredMethods.post[e].toString()!==this._axesIcon().toString()||this._registeredMethods.post.splice(e,1)},a.prototype._grid=function(e,t,n,a,o){void 0===e&&(e=this.width/2),void 0===t&&(t=Math.round(e/30)<4?4:Math.round(e/30)),void 0===n&&(n=0),void 0===a&&(a=0),void 0===o&&(o=0);var i=e/t,r=e/2;return function(){this.push(),this.stroke(255*this._renderer.curStrokeColor[0],255*this._renderer.curStrokeColor[1],255*this._renderer.curStrokeColor[2]),this._renderer.uMVMatrix.set(this._renderer._curCamera.cameraMatrix.mat4[0],this._renderer._curCamera.cameraMatrix.mat4[1],this._renderer._curCamera.cameraMatrix.mat4[2],this._renderer._curCamera.cameraMatrix.mat4[3],this._renderer._curCamera.cameraMatrix.mat4[4],this._renderer._curCamera.cameraMatrix.mat4[5],this._renderer._curCamera.cameraMatrix.mat4[6],this._renderer._curCamera.cameraMatrix.mat4[7],this._renderer._curCamera.cameraMatrix.mat4[8],this._renderer._curCamera.cameraMatrix.mat4[9],this._renderer._curCamera.cameraMatrix.mat4[10],this._renderer._curCamera.cameraMatrix.mat4[11],this._renderer._curCamera.cameraMatrix.mat4[12],this._renderer._curCamera.cameraMatrix.mat4[13],this._renderer._curCamera.cameraMatrix.mat4[14],this._renderer._curCamera.cameraMatrix.mat4[15]);for(var e=0;e<=t;e++)this.beginShape(this.LINES),this.vertex(-r+n,a,e*i-r+o),this.vertex(+r+n,a,e*i-r+o),this.endShape();for(var s=0;s<=t;s++)this.beginShape(this.LINES),this.vertex(s*i-r+n,a,-r+o),this.vertex(s*i-r+n,a,+r+o),this.endShape();this.pop()}},a.prototype._axesIcon=function(e,t,n,a){return void 0===e&&(e=this.width/20>40?this.width/20:40),void 0===t&&(t=-this.width/4),void 0===n&&(n=t),void 0===a&&(a=t),function(){this.push(),this._renderer.uMVMatrix.set(this._renderer._curCamera.cameraMatrix.mat4[0],this._renderer._curCamera.cameraMatrix.mat4[1],this._renderer._curCamera.cameraMatrix.mat4[2],this._renderer._curCamera.cameraMatrix.mat4[3],this._renderer._curCamera.cameraMatrix.mat4[4],this._renderer._curCamera.cameraMatrix.mat4[5],this._renderer._curCamera.cameraMatrix.mat4[6],this._renderer._curCamera.cameraMatrix.mat4[7],this._renderer._curCamera.cameraMatrix.mat4[8],this._renderer._curCamera.cameraMatrix.mat4[9],this._renderer._curCamera.cameraMatrix.mat4[10],this._renderer._curCamera.cameraMatrix.mat4[11],this._renderer._curCamera.cameraMatrix.mat4[12],this._renderer._curCamera.cameraMatrix.mat4[13],this._renderer._curCamera.cameraMatrix.mat4[14],this._renderer._curCamera.cameraMatrix.mat4[15]),this.strokeWeight(2),this.stroke(255,0,0),this.beginShape(this.LINES),this.vertex(t,n,a),this.vertex(t+e,n,a),this.endShape(),this.stroke(0,255,0),this.beginShape(this.LINES),this.vertex(t,n,a),this.vertex(t,n+e,a),this.endShape(),this.stroke(0,0,255),this.beginShape(this.LINES),this.vertex(t,n,a),this.vertex(t,n,a+e),this.endShape(),this.pop()}},t.exports=a},{"../core/constants":18,"../core/main":24}],67:[function(e,t,n){"use strict";var a=e("../core/main");a.prototype.ambientLight=function(e,t,n,o){this._assert3d("ambientLight"),a._validateParameters("ambientLight",arguments);var i=this.color.apply(this,arguments);return this._renderer.ambientLightColors.push(i._array[0],i._array[1],i._array[2]),this._renderer._enableLighting=!0,this},a.prototype.directionalLight=function(e,t,n,o,i,r){var s,l,p,d;this._assert3d("directionalLight"),a._validateParameters("directionalLight",arguments),s=e instanceof a.Color?e:this.color(e,t,n);var c=arguments[arguments.length-1];"number"==typeof c?(l=arguments[arguments.length-3],p=arguments[arguments.length-2],d=arguments[arguments.length-1]):(l=c.x,p=c.y,d=c.z);var u=Math.sqrt(l*l+p*p+d*d);return this._renderer.directionalLightDirections.push(l/u,p/u,d/u),this._renderer.directionalLightColors.push(s._array[0],s._array[1],s._array[2]),this._renderer._enableLighting=!0,this},a.prototype.pointLight=function(e,t,n,o,i,r){var s,l,p,d;this._assert3d("pointLight"),a._validateParameters("pointLight",arguments),s=e instanceof a.Color?e:this.color(e,t,n);var c=arguments[arguments.length-1];return"number"==typeof c?(l=arguments[arguments.length-3],p=arguments[arguments.length-2],d=arguments[arguments.length-1]):(l=c.x,p=c.y,d=c.z),this._renderer.pointLightPositions.push(l,p,d),this._renderer.pointLightColors.push(s._array[0],s._array[1],s._array[2]),this._renderer._enableLighting=!0,this},a.prototype.lights=function(){return this._assert3d("lights"),this.ambientLight(128,128,128),this.directionalLight(128,128,128,0,0,-1),this},a.prototype.lightFalloff=function(e,t,n){return this._assert3d("lightFalloff"),a._validateParameters("lightFalloff",arguments),e<0&&(e=0,console.warn("Value of constant argument in lightFalloff() should be never be negative. Set to 0.")),t<0&&(t=0,console.warn("Value of linear argument in lightFalloff() should be never be negative. Set to 0.")),n<0&&(n=0,console.warn("Value of quadratic argument in lightFalloff() should be never be negative. Set to 0.")),0===e&&0===t&&0===n&&(e=1,console.warn("Either one of the three arguments in lightFalloff() should be greater than zero. Set constant argument to 1.")),this._renderer.constantAttenuation=e,this._renderer.linearAttenuation=t,this._renderer.quadraticAttenuation=n,this},t.exports=a},{"../core/main":24}],68:[function(e,t,n){"use strict";var a=e("../core/main");function o(e,t,n){for(var a=0,o=e.length;a<o;a++)if(e[a]!==t.getUint8(n+a,!1))return!1;return!0}e("./p5.Geometry"),a.prototype.loadModel=function(e){var t,n,i;
21a._validateParameters("loadModel",arguments),"boolean"==typeof arguments[1]?(t=arguments[1],n=arguments[2],i=arguments[3]):(t=!1,n=arguments[1],i=arguments[2]);var r=e.slice(-4),s=new a.Geometry;s.gid=e+"|"+t;var l=this;return".stl"===r?this.httpDo(e,"GET","arrayBuffer",function(e){!function(e,t){if(function(e){for(var t=new DataView(e),n=[115,111,108,105,100],a=0;a<5;a++)if(o(n,t,a))return!1;return!0}(t))!function(e,t){for(var n,o,i,r,s,l,p,d=new DataView(t),c=d.getUint32(80,!0),u=!1,m=0;m<70;m++)1129270351===d.getUint32(m,!1)&&82===d.getUint8(m+4)&&61===d.getUint8(m+5)&&(u=!0,r=[],s=d.getUint8(m+6)/255,l=d.getUint8(m+7)/255,p=d.getUint8(m+8)/255);for(var h=0;h<c;h++){var f=84+50*h,g=d.getFloat32(f,!0),y=d.getFloat32(f+4,!0),v=d.getFloat32(f+8,!0);if(u){var b=d.getUint16(f+48,!0);0==(32768&b)?(n=(31&b)/31,o=(b>>5&31)/31,i=(b>>10&31)/31):(n=s,o=l,i=p)}for(var w=1;w<=3;w++){var x=f+12*w,S=new a.Vector(d.getFloat32(x,!0),d.getFloat32(x+8,!0),d.getFloat32(x+4,!0));e.vertices.push(S),u&&r.push(n,o,i)}var k=new a.Vector(g,y,v);e.vertexNormals.push(k,k,k),e.faces.push([3*h,3*h+1,3*h+2])}}(e,t);else{var n=new DataView(t);if(!("TextDecoder"in window))return console.warn("Sorry, ASCII STL loading only works in browsers that support TextDecoder (https://caniuse.com/#feat=textencoder)"),e;var i=new TextDecoder("utf-8"),r=i.decode(n),s=r.split("\n");!function(e,t){for(var n,o,i="",r=[],s=0;s<t.length;++s){for(var l=t[s].trim(),p=l.split(" "),d=0;d<p.length;++d)""===p[d]&&p.splice(d,1);if(0!==p.length)switch(i){case"":if("solid"!==p[0])return console.error(l),void console.error('Invalid state "'+p[0]+'", should be "solid"');i="solid";break;case"solid":if("facet"!==p[0]||"normal"!==p[1])return console.error(l),void console.error('Invalid state "'+p[0]+'", should be "facet normal"');n=new a.Vector(parseFloat(p[2]),parseFloat(p[3]),parseFloat(p[4])),e.vertexNormals.push(n,n,n),i="facet normal";break;case"facet normal":if("outer"!==p[0]||"loop"!==p[1])return console.error(l),void console.error('Invalid state "'+p[0]+'", should be "outer loop"');i="vertex";break;case"vertex":if("vertex"===p[0])o=new a.Vector(parseFloat(p[1]),parseFloat(p[2]),parseFloat(p[3])),e.vertices.push(o),r.push(e.vertices.indexOf(o));else{if("endloop"!==p[0])return console.error(l),void console.error('Invalid state "'+p[0]+'", should be "vertex" or "endloop"');e.faces.push(r),r=[],i="endloop"}break;case"endloop":if("endfacet"!==p[0])return console.error(l),void console.error('Invalid state "'+p[0]+'", should be "endfacet"');i="endfacet";break;case"endfacet":if("endsolid"===p[0]);else{if("facet"!==p[0]||"normal"!==p[1])return console.error(l),void console.error('Invalid state "'+p[0]+'", should be "endsolid" or "facet normal"');n=new a.Vector(parseFloat(p[2]),parseFloat(p[3]),parseFloat(p[4])),e.vertexNormals.push(n,n,n),i="facet normal"}break;default:console.error('Invalid state "'+i+'"')}}}(e,s)}}(s,e),t&&s.normalize(),l._decrementPreload(),"function"==typeof n&&n(s)}.bind(this),i):".obj"===r?this.loadStrings(e,function(e){!function(e,t){for(var n={v:[],vt:[],vn:[]},o={},i=0;i<t.length;++i){var r=t[i].trim().split(/\b\s+/);if(r.length>0)if("v"===r[0]||"vn"===r[0]){var s=new a.Vector(parseFloat(r[1]),parseFloat(r[2]),parseFloat(r[3]));n[r[0]].push(s)}else if("vt"===r[0]){var l=[parseFloat(r[1]),parseFloat(r[2])];n[r[0]].push(l)}else if("f"===r[0])for(var p=3;p<r.length;++p){for(var d=[],c=[1,p-1,p],u=0;u<c.length;++u){var m=r[c[u]],h=0;if(void 0!==o[m])h=o[m];else{for(var f=m.split("/"),g=0;g<f.length;g++)f[g]=parseInt(f[g])-1;h=o[m]=e.vertices.length,e.vertices.push(n.v[f[0]].copy()),n.vt[f[1]]?e.uvs.push(n.vt[f[1]].slice()):e.uvs.push([0,0]),n.vn[f[2]]&&e.vertexNormals.push(n.vn[f[2]].copy())}d.push(h)}d[0]!==d[1]&&d[0]!==d[2]&&d[1]!==d[2]&&e.faces.push(d)}}0===e.vertexNormals.length&&e.computeNormals()}(s,e),t&&s.normalize(),l._decrementPreload(),"function"==typeof n&&n(s)}.bind(this),i):(a._friendlyFileLoadError(3,e),i?i():console.error("Sorry, the file type is invalid. Only OBJ and STL files are supported.")),s},a.prototype.model=function(e){this._assert3d("model"),a._validateParameters("model",arguments),e.vertices.length>0&&(this._renderer.geometryInHash(e.gid)||(e._makeTriangleEdges()._edgesToVertices(),this._renderer.createBuffers(e.gid,e)),this._renderer.drawBuffers(e.gid))},t.exports=a},{"../core/main":24,"./p5.Geometry":71}],69:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("../core/constants");
21e("./p5.Texture"),a.prototype.loadShader=function(e,t,n,o){a._validateParameters("loadShader",arguments),o||(o=console.error);var i=new a.Shader,r=this,s=!1,l=!1,p=function(){r._decrementPreload(),n&&n(i)};return this.loadStrings(e,function(e){i._vertSrc=e.join("\n"),l=!0,s&&p()},o),this.loadStrings(t,function(e){i._fragSrc=e.join("\n"),s=!0,l&&p()},o),i},a.prototype.createShader=function(e,t){return this._assert3d("createShader"),a._validateParameters("createShader",arguments),new a.Shader(this._renderer,e,t)},a.prototype.shader=function(e){return this._assert3d("shader"),a._validateParameters("shader",arguments),void 0===e._renderer&&(e._renderer=this._renderer),e.isStrokeShader()?this._renderer.userStrokeShader=e:(this._renderer.userFillShader=e,this._renderer._useNormalMaterial=!1),e.init(),this},a.prototype.resetShader=function(){return this._renderer.userFillShader=this._renderer.userStrokeShader=null,this},a.prototype.normalMaterial=function(){return this._assert3d("normalMaterial"),a._validateParameters("normalMaterial",arguments),this._renderer.drawMode=o.FILL,this._renderer._useSpecularMaterial=!1,this._renderer._useNormalMaterial=!0,this._renderer.curFillColor=[1,1,1,1],this._renderer._setProperty("_doFill",!0),this.noStroke(),this},a.prototype.texture=function(e){return this._assert3d("texture"),a._validateParameters("texture",arguments),this._renderer.drawMode=o.TEXTURE,this._renderer._useSpecularMaterial=!1,this._renderer._useNormalMaterial=!1,this._renderer._tex=e,this._renderer._setProperty("_doFill",!0),this},a.prototype.textureMode=function(e){e!==o.IMAGE&&e!==o.NORMAL?console.warn("You tried to set "+e+" textureMode only supports IMAGE & NORMAL "):this._renderer.textureMode=e},a.prototype.textureWrap=function(e,t){t=t||e,this._renderer.textureWrapX=e,this._renderer.textureWrapY=t;for(var n=this._renderer.textures,a=0;a<n.length;a++)n[a].setWrapMode(e,t)},a.prototype.ambientMaterial=function(e,t,n,o){this._assert3d("ambientMaterial"),a._validateParameters("ambientMaterial",arguments);var i=a.prototype.color.apply(this,arguments);return this._renderer.curFillColor=i._array,this._renderer._useSpecularMaterial=!1,this._renderer._useNormalMaterial=!1,this._renderer._enableLighting=!0,this._renderer._tex=null,this},a.prototype.specularMaterial=function(e,t,n,o){this._assert3d("specularMaterial"),a._validateParameters("specularMaterial",arguments);var i=a.prototype.color.apply(this,arguments);return this._renderer.curFillColor=i._array,this._renderer._useSpecularMaterial=!0,this._renderer._useNormalMaterial=!1,this._renderer._enableLighting=!0,this._renderer._tex=null,this},a.prototype.shininess=function(e){return this._assert3d("shininess"),a._validateParameters("shininess",arguments),e<1&&(e=1),this._renderer._useShininess=e,this},a.RendererGL.prototype._applyColorBlend=function(e){var t=this.GL,n=this.drawMode===o.TEXTURE;return n||e[e.length-1]<1?(t.depthMask(n),t.enable(t.BLEND),this._applyBlendMode()):(t.depthMask(!0),t.disable(t.BLEND)),e},a.RendererGL.prototype._applyBlendMode=function(){var e=this.GL;switch(this.curBlendMode){case o.BLEND:case o.ADD:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA);break;case o.MULTIPLY:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ZERO,e.SRC_COLOR,e.ONE,e.ONE);break;case o.SCREEN:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE_MINUS_DST_COLOR,e.ONE,e.ONE,e.ONE);break;case o.EXCLUSION:e.blendEquationSeparate(e.FUNC_ADD,e.FUNC_ADD),e.blendFuncSeparate(e.ONE_MINUS_DST_COLOR,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE);break;case o.REPLACE:e.blendEquation(e.FUNC_ADD),e.blendFunc(e.ONE,e.ZERO);break;case o.SUBTRACT:e.blendEquationSeparate(e.FUNC_REVERSE_SUBTRACT,e.FUNC_ADD),e.blendFuncSeparate(e.SRC_ALPHA,e.ONE,e.ONE,e.ONE);break;case o.DARKEST:this.blendExt?(e.blendEquationSeparate(this.blendExt.MIN_EXT,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):console.warn("blendMode(DARKEST) does not work in your browser in WEBGL mode.");break;case o.LIGHTEST:this.blendExt?(e.blendEquationSeparate(this.blendExt.MAX_EXT,e.FUNC_ADD),e.blendFuncSeparate(e.ONE,e.ONE,e.ONE,e.ONE)):console.warn("blendMode(LIGHTEST) does not work in your browser in WEBGL mode.");break;
21default:console.error("Oops! Somehow RendererGL set curBlendMode to an unsupported mode.")}},t.exports=a},{"../core/constants":18,"../core/main":24,"./p5.Texture":77}],70:[function(e,t,n){"use strict";var a=e("../core/main");a.prototype.camera=function(){return this._assert3d("camera"),a._validateParameters("camera",arguments),this._renderer._curCamera.camera.apply(this._renderer._curCamera,arguments),this},a.prototype.perspective=function(){return this._assert3d("perspective"),a._validateParameters("perspective",arguments),this._renderer._curCamera.perspective.apply(this._renderer._curCamera,arguments),this},a.prototype.ortho=function(){return this._assert3d("ortho"),a._validateParameters("ortho",arguments),this._renderer._curCamera.ortho.apply(this._renderer._curCamera,arguments),this},a.prototype.createCamera=function(){this._assert3d("createCamera");var e=new a.Camera(this._renderer);return e._computeCameraDefaultSettings(),e._setDefaultCamera(),this._renderer._curCamera=e,e},a.Camera=function(e){this._renderer=e,this.cameraType="default",this.cameraMatrix=new a.Matrix,this.projMatrix=new a.Matrix},a.Camera.prototype.perspective=function(e,t,n,o){void 0===e?(e=this.defaultCameraFOV,this.cameraFOV=e):this.cameraFOV=this._renderer._pInst._toRadians(e),void 0===t&&(t=this.defaultAspectRatio),void 0===n&&(n=this.defaultCameraNear),void 0===o&&(o=this.defaultCameraFar),n<=1e-4&&(n=.01,console.log("Avoid perspective near plane values close to or below 0. Setting value to 0.01.")),o<n&&console.log("Perspective far plane value is less than near plane value. Nothing will be shown."),this.aspectRatio=t,this.cameraNear=n,this.cameraFar=o,this.projMatrix=a.Matrix.identity();var i=1/Math.tan(this.cameraFOV/2),r=1/(this.cameraNear-this.cameraFar);this.projMatrix.set(i/t,0,0,0,0,-i,0,0,0,0,(o+n)*r,-1,0,0,2*o*n*r,0),this._isActive()&&this._renderer.uPMatrix.set(this.projMatrix.mat4[0],this.projMatrix.mat4[1],this.projMatrix.mat4[2],this.projMatrix.mat4[3],this.projMatrix.mat4[4],this.projMatrix.mat4[5],this.projMatrix.mat4[6],this.projMatrix.mat4[7],this.projMatrix.mat4[8],this.projMatrix.mat4[9],this.projMatrix.mat4[10],this.projMatrix.mat4[11],this.projMatrix.mat4[12],this.projMatrix.mat4[13],this.projMatrix.mat4[14],this.projMatrix.mat4[15]),this.cameraType="custom"},a.Camera.prototype.ortho=function(e,t,n,o,i,r){void 0===e&&(e=-this._renderer.width/2),void 0===t&&(t=+this._renderer.width/2),void 0===n&&(n=-this._renderer.height/2),void 0===o&&(o=+this._renderer.height/2),void 0===i&&(i=0),void 0===r&&(r=Math.max(this._renderer.width,this._renderer.height));var s=t-e,l=o-n,p=r-i,d=2/s,c=2/l,u=-2/p,m=-(t+e)/s,h=-(o+n)/l,f=-(r+i)/p;this.projMatrix=a.Matrix.identity(),this.projMatrix.set(d,0,0,0,0,-c,0,0,0,0,u,0,m,h,f,1),this._isActive()&&this._renderer.uPMatrix.set(this.projMatrix.mat4[0],this.projMatrix.mat4[1],this.projMatrix.mat4[2],this.projMatrix.mat4[3],this.projMatrix.mat4[4],this.projMatrix.mat4[5],this.projMatrix.mat4[6],this.projMatrix.mat4[7],this.projMatrix.mat4[8],this.projMatrix.mat4[9],this.projMatrix.mat4[10],this.projMatrix.mat4[11],this.projMatrix.mat4[12],this.projMatrix.mat4[13],this.projMatrix.mat4[14],this.projMatrix.mat4[15]),this.cameraType="custom"},a.Camera.prototype._rotateView=function(e,t,n,o){var i=this.centerX,r=this.centerY,s=this.centerZ;i-=this.eyeX,r-=this.eyeY,s-=this.eyeZ;var l=a.Matrix.identity(this._renderer._pInst);l.rotate(this._renderer._pInst._toRadians(e),t,n,o);var p=[i*l.mat4[0]+r*l.mat4[4]+s*l.mat4[8],i*l.mat4[1]+r*l.mat4[5]+s*l.mat4[9],i*l.mat4[2]+r*l.mat4[6]+s*l.mat4[10]];p[0]+=this.eyeX,p[1]+=this.eyeY,p[2]+=this.eyeZ,this.camera(this.eyeX,this.eyeY,this.eyeZ,p[0],p[1],p[2],this.upX,this.upY,this.upZ)},a.Camera.prototype.pan=function(e){var t=this._getLocalAxes();this._rotateView(e,t.y[0],t.y[1],t.y[2])},a.Camera.prototype.tilt=function(e){var t=this._getLocalAxes();this._rotateView(e,t.x[0],t.x[1],t.x[2])},a.Camera.prototype.lookAt=function(e,t,n){this.camera(this.eyeX,this.eyeY,this.eyeZ,e,t,n,this.upX,this.upY,this.upZ)},a.Camera.prototype.camera=function(e,t,n,a,o,i,r,s,l){void 0===e&&(e=this.defaultEyeX,t=this.defaultEyeY,n=this.defaultEyeZ,a=e,o=t,i=0,r=0,s=1,l=0),this.eyeX=e,this.eyeY=t,this.eyeZ=n,this.centerX=a,this.centerY=o,this.centerZ=i,this.upX=r,this.upY=s,this.upZ=l;var p=this._getLocalAxes();this.cameraMatrix.set(p.x[0],p.y[0],p.z[0],0,p.x[1],p.y[1],p.z[1],0,p.x[2],p.y[2],p.z[2],0,0,0,0,1);var d=-e,c=-t,u=-n;return this.cameraMatrix.translate([d,c,u]),this._isActive()&&this._renderer.uMVMatrix.set(this.cameraMatrix.mat4[0],this.cameraMatrix.mat4[1],this.cameraMatrix.mat4[2],this.cameraMatrix.mat4[3],this.cameraMatrix.mat4[4],this.cameraMatrix.mat4[5],this.cameraMatrix.mat4[6],this.cameraMatrix.mat4[7],this.cameraMatrix.mat4[8],this.cameraMatrix.mat4[9],this.cameraMatrix.mat4[10],this.cameraMatrix.mat4[11],this.cameraMatrix.mat4[12],this.cameraMatrix.mat4[13],this.cameraMatrix.mat4[14],this.cameraMatrix.mat4[15]),this},a.Camera.prototype.move=function(e,t,n){var a=this._getLocalAxes(),o=[a.x[0]*e,a.x[1]*e,a.x[2]*e],i=[a.y[0]*t,a.y[1]*t,a.y[2]*t],r=[a.z[0]*n,a.z[1]*n,a.z[2]*n];this.camera(this.eyeX+o[0]+i[0]+r[0],this.eyeY+o[1]+i[1]+r[1],this.eyeZ+o[2]+i[2]+r[2],this.centerX+o[0]+i[0]+r[0],this.centerY+o[1]+i[1]+r[1],this.centerZ+o[2]+i[2]+r[2],0,1,0)},a.Camera.prototype.setPosition=function(e,t,n){var a=e-this.eyeX,o=t-this.eyeY,i=n-this.eyeZ;this.camera(e,t,n,this.centerX+a,this.centerY+o,this.centerZ+i,0,1,0)},a.Camera.prototype._computeCameraDefaultSettings=function(){this.defaultCameraFOV=60/180*Math.PI,this.defaultAspectRatio=this._renderer.width/this._renderer.height,this.defaultEyeX=0,this.defaultEyeY=0,this.defaultEyeZ=this._renderer.height/2/Math.tan(this.defaultCameraFOV/2),this.defaultCenterX=0,this.defaultCenterY=0,this.defaultCenterZ=0,this.defaultCameraNear=.1*this.defaultEyeZ,this.defaultCameraFar=10*this.defaultEyeZ},a.Camera.prototype._setDefaultCamera=function(){this.cameraFOV=this.defaultCameraFOV,this.aspectRatio=this.defaultAspectRatio,this.eyeX=this.defaultEyeX,this.eyeY=this.defaultEyeY,this.eyeZ=this.defaultEyeZ,this.centerX=this.defaultCenterX,this.centerY=this.defaultCenterY,this.centerZ=this.defaultCenterZ,this.upX=0,this.upY=1,this.upZ=0,this.cameraNear=this.defaultCameraNear,this.cameraFar=this.defaultCameraFar,this.perspective(),this.camera(),this.cameraType="default"},a.Camera.prototype._resize=function(){"default"===this.cameraType?(this._computeCameraDefaultSettings(),this._setDefaultCamera()):this.perspective(this.cameraFOV,this._renderer.width/this._renderer.height)},a.Camera.prototype.copy=function(){var e=new a.Camera(this._renderer);return e.cameraFOV=this.cameraFOV,e.aspectRatio=this.aspectRatio,e.eyeX=this.eyeX,e.eyeY=this.eyeY,e.eyeZ=this.eyeZ,e.centerX=this.centerX,e.centerY=this.centerY,e.centerZ=this.centerZ,e.cameraNear=this.cameraNear,e.cameraFar=this.cameraFar,e.cameraType=this.cameraType,e.cameraMatrix=this.cameraMatrix.copy(),e.projMatrix=this.projMatrix.copy(),e},a.Camera.prototype._getLocalAxes=function(){var e=this.eyeX-this.centerX,t=this.eyeY-this.centerY,n=this.eyeZ-this.centerZ,a=Math.sqrt(e*e+t*t+n*n);0!==a&&(e/=a,t/=a,n/=a);var o=this.upX,i=this.upY,r=this.upZ,s=i*n-r*t,l=-o*n+r*e,p=o*t-i*e;o=t*p-n*l,i=-e*p+n*s,r=e*l-t*s;var d=Math.sqrt(s*s+l*l+p*p);0!==d&&(s/=d,l/=d,p/=d);var c=Math.sqrt(o*o+i*i+r*r);return 0!==c&&(o/=c,i/=c,r/=c),{x:[s,l,p],y:[o,i,r],z:[e,t,n]}},a.Camera.prototype._orbit=function(e,t,n){var a=this.eyeX-this.centerX,o=this.eyeY-this.centerY,i=this.eyeZ-this.centerZ,r=Math.sqrt(a*a+o*o+i*i),s=Math.atan2(a,i),l=Math.acos(Math.max(-1,Math.min(1,o/r)));s+=e,(r+=n)<0&&(r=.1),(l+=t)>Math.PI?l=Math.PI:l<=0&&(l=.001);var p=Math.sin(l)*r*Math.sin(s),d=Math.cos(l)*r,c=Math.sin(l)*r*Math.cos(s);this.camera(p+this.centerX,d+this.centerY,c+this.centerZ,this.centerX,this.centerY,this.centerZ,0,1,0)},a.Camera.prototype._isActive=function(){return this===this._renderer._curCamera},a.prototype.setCamera=function(e){this._renderer._curCamera=e,this._renderer.uPMatrix.set(e.projMatrix.mat4[0],e.projMatrix.mat4[1],e.projMatrix.mat4[2],e.projMatrix.mat4[3],e.projMatrix.mat4[4],e.projMatrix.mat4[5],e.projMatrix.mat4[6],e.projMatrix.mat4[7],e.projMatrix.mat4[8],e.projMatrix.mat4[9],e.projMatrix.mat4[10],e.projMatrix.mat4[11],e.projMatrix.mat4[12],e.projMatrix.mat4[13],e.projMatrix.mat4[14],e.projMatrix.mat4[15])},t.exports=a.Camera},{"../core/main":24}],71:[function(e,t,n){"use strict";var a=e("../core/main");a.Geometry=function(e,t,n){return this.vertices=[],this.lineVertices=[],this.lineNormals=[],this.vertexNormals=[],this.faces=[],this.uvs=[],this.edges=[],this.detailX=void 0!==e?e:1,this.detailY=void 0!==t?t:1,this.dirtyFlags={},n instanceof Function&&n.call(this),this},a.Geometry.prototype.reset=function(){this.lineVertices.length=0,this.lineNormals.length=0,this.vertices.length=0,this.edges.length=0,this.vertexColors.length=0,this.vertexNormals.length=0,this.uvs.length=0,this.dirtyFlags={}},a.Geometry.prototype.computeFaces=function(){this.faces.length=0;for(var e,t,n,a,o=this.detailX+1,i=0;i<this.detailY;i++)for(var r=0;r<this.detailX;r++)e=i*o+r,t=i*o+r+1,n=(i+1)*o+r+1,a=(i+1)*o+r,this.faces.push([e,t,a]),this.faces.push([a,t,n]);return this}
vendor: 6,436 bytes, line 21
21,a.Geometry.prototype._getFaceNormal=function(e){var t=this.faces[e],n=this.vertices[t[0]],o=this.vertices[t[1]],i=this.vertices[t[2]],r=a.Vector.sub(o,n),s=a.Vector.sub(i,n),l=a.Vector.cross(r,s),p=a.Vector.mag(l),d=p/(a.Vector.mag(r)*a.Vector.mag(s));return 0===d||isNaN(d)?(console.warn("p5.Geometry.prototype._getFaceNormal:","face has colinear sides or a repeated vertex"),l):(d>1&&(d=1),l.mult(Math.asin(d)/p))},a.Geometry.prototype.computeNormals=function(){var e,t=this.vertexNormals,n=this.vertices,o=this.faces;for(t.length=0,e=0;e<n.length;++e)t.push(new a.Vector);for(var i=0;i<o.length;++i)for(var r=o[i],s=this._getFaceNormal(i),l=0;l<3;++l){t[r[l]].add(s)}for(e=0;e<n.length;++e)t[e].normalize();return this},a.Geometry.prototype.averageNormals=function(){for(var e=0;e<=this.detailY;e++){var t=this.detailX+1,n=a.Vector.add(this.vertexNormals[e*t],this.vertexNormals[e*t+this.detailX]);n=a.Vector.div(n,2),this.vertexNormals[e*t]=n,this.vertexNormals[e*t+this.detailX]=n}return this},a.Geometry.prototype.averagePoleNormals=function(){for(var e=new a.Vector(0,0,0),t=0;t<this.detailX;t++)e.add(this.vertexNormals[t]);for(e=a.Vector.div(e,this.detailX),t=0;t<this.detailX;t++)this.vertexNormals[t]=e;for(e=new a.Vector(0,0,0),t=this.vertices.length-1;t>this.vertices.length-1-this.detailX;t--)e.add(this.vertexNormals[t]);for(e=a.Vector.div(e,this.detailX),t=this.vertices.length-1;t>this.vertices.length-1-this.detailX;t--)this.vertexNormals[t]=e;return this},a.Geometry.prototype._makeTriangleEdges=function(){if(this.edges.length=0,Array.isArray(this.strokeIndices))for(var e=0,t=this.strokeIndices.length;e<t;e++)this.edges.push(this.strokeIndices[e]);else for(var n=0;n<this.faces.length;n++)this.edges.push([this.faces[n][0],this.faces[n][1]]),this.edges.push([this.faces[n][1],this.faces[n][2]]),this.edges.push([this.faces[n][2],this.faces[n][0]]);return this},a.Geometry.prototype._edgesToVertices=function(){this.lineVertices.length=0,this.lineNormals.length=0;for(var e=0;e<this.edges.length;e++){var t=this.vertices[this.edges[e][0]],n=this.vertices[this.edges[e][1]],a=n.copy().sub(t).normalize(),o=t.array(),i=t.array(),r=n.array(),s=n.array(),l=a.array(),p=a.array();l.push(1),p.push(-1),this.lineNormals.push(l,p,l,l,p,p),this.lineVertices.push(o,i,r,r,i,s)}return this},a.Geometry.prototype.normalize=function(){if(this.vertices.length>0){for(var e=this.vertices[0].copy(),t=this.vertices[0].copy(),n=0;n<this.vertices.length;n++)e.x=Math.max(e.x,this.vertices[n].x),t.x=Math.min(t.x,this.vertices[n].x),e.y=Math.max(e.y,this.vertices[n].y),t.y=Math.min(t.y,this.vertices[n].y),e.z=Math.max(e.z,this.vertices[n].z),t.z=Math.min(t.z,this.vertices[n].z);var o=a.Vector.lerp(e,t,.5),i=a.Vector.sub(e,t),r=200/Math.max(Math.max(i.x,i.y),i.z);for(n=0;n<this.vertices.length;n++)this.vertices[n].sub(o),this.vertices[n].mult(r)}return this},t.exports=a.Geometry},{"../core/main":24}],72:[function(e,t,n){"use strict";var a=e("../core/main"),o=Array,i=function(e){return e instanceof Array};"undefined"!=typeof Float32Array&&(o=Float32Array,i=function(e){return e instanceof Array||e instanceof Float32Array}),a.Matrix=function(){for(var e=new Array(arguments.length),t=0;t<e.length;++t)e[t]=arguments[t];return e.length&&e[e.length-1]instanceof a&&(this.p5=e[e.length-1]),"mat3"===e[0]?this.mat3=Array.isArray(e[1])?e[1]:new o([1,0,0,0,1,0,0,0,1]):this.mat4=Array.isArray(e[0])?e[0]:new o([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1]),this},a.Matrix.prototype.set=function(e){return e instanceof a.Matrix?(this.mat4=e.mat4,this):i(e)?(this.mat4=e,this):(16===arguments.length&&(this.mat4[0]=arguments[0],this.mat4[1]=arguments[1],this.mat4[2]=arguments[2],this.mat4[3]=arguments[3],this.mat4[4]=arguments[4],this.mat4[5]=arguments[5],this.mat4[6]=arguments[6],this.mat4[7]=arguments[7],this.mat4[8]=arguments[8],this.mat4[9]=arguments[9],this.mat4[10]=arguments[10],this.mat4[11]=arguments[11],this.mat4[12]=arguments[12],this.mat4[13]=arguments[13],this.mat4[14]=arguments[14],this.mat4[15]=arguments[15]),this)},a.Matrix.prototype.get=function(){return new a.Matrix(this.mat4,this.p5)},a.Matrix.prototype.copy=function(){var e=new a.Matrix(this.p5);return e.mat4[0]=this.mat4[0],e.mat4[1]=this.mat4[1],e.mat4[2]=this.mat4[2],e.mat4[3]=this.mat4[3],e.mat4[4]=this.mat4[4],e.mat4[5]=this.mat4[5],e.mat4[6]=this.mat4[6],e.mat4[7]=this.mat4[7],e.mat4[8]=this.mat4[8],e.mat4[9]=this.mat4[9],e.mat4[10]=this.mat4[10],e.mat4[11]=this.mat4[11],e.mat4[12]=this.mat4[12],e.mat4[13]=this.mat4[13],e.mat4[14]=this.mat4[14],e.mat4[15]=this.mat4[15],e},a.Matrix.identity=function(e){return new a.Matrix(e)},a.Matrix.prototype.transpose=function(e){var t,n,o,r,s,l;return e instanceof a.Matrix?(t=e.mat4[1],n=e.mat4[2],o=e.mat4[3],r=e.mat4[6],s=e.mat4[7],l=e.mat4[11],this.mat4[0]=e.mat4[0],this.mat4[1]=e.mat4[4],this.mat4[2]=e.mat4[8],this.mat4[3]=e.mat4[12],this.mat4[4]=t,this.mat4[5]=e.mat4[5],this.mat4[6]=e.mat4[9],this.mat4[7]=e.mat4[13],this.mat4[8]=n,this.mat4[9]=r,this.mat4[10]=e.mat4[10],this.mat4[11]=e.mat4[14],this.mat4[12]=o,this.mat4[13]=s,this.mat4[14]=l,this.mat4[15]=e.mat4[15]):i(e)&&(t=e[1],n=e[2],o=e[3],r=e[6],s=e[7],l=e[11],this.mat4[0]=e[0],this.mat4[1]=e[4],this.mat4[2]=e[8],this.mat4[3]=e[12],this.mat4[4]=t,this.mat4[5]=e[5],this.mat4[6]=e[9],this.mat4[7]=e[13],this.mat4[8]=n,this.mat4[9]=r,this.mat4[10]=e[10],this.mat4[11]=e[14],this.mat4[12]=o,this.mat4[13]=s,this.mat4[14]=l,this.mat4[15]=e[15]),this},a.Matrix.prototype.invert=function(e){var t,n,o,r,s,l,p,d,c,u,m,h,f,g,y,v;e instanceof a.Matrix?(t=e.mat4[0],n=e.mat4[1],o=e.mat4[2],r=e.mat4[3],s=e.mat4[4],l=e.mat4[5],p=e.mat4[6],d=e.mat4[7],c=e.mat4[8],u=e.mat4[9],m=e.mat4[10],h=e.mat4[11],f=e.mat4[12],g=e.mat4[13],y=e.mat4[14],v=e.mat4[15]):i(e)&&(t=e[0],n=e[1],o=e[2],r=e[3],s=e[4],l=e[5],p=e[6],d=e[7],c=e[8],u=e[9],m=e[10],h=e[11],f=e[12],g=e[13],y=e[14],v=e[15]);var b=t*l-n*s,w=t*p-o*s,x=t*d-r*s,S=n*p-o*l,k=n*d-r*l,T=o*d-r*p,C=c*g-u*f,_=c*y-m*f,E=c*v-h*f,M=u*y-m*g,j=u*v-h*g,I=m*v-h*y,R=b*I-w*j+x*M+S*E-k*_+T*C;return R?(R=1/R,this.mat4[0]=(l*I-p*j+d*M)*R,this.mat4[1]=(o*j-n*I-r*M)*R,this.mat4[2]=(g*T-y*k+v*S)*R,this.mat4[3]=(m*k-u*T-h*S)*R,this.mat4[4]=(p*E-s*I-d*_)*R,this.mat4[5]=(t*I-o*E+r*_)*R,this.mat4[6]=(y*x-f*T-v*w)*R,this.mat4[7]=(c*T-m*x+h*w)*R,this.mat4[8]=(s*j-l*E+d*C)*R,this.mat4[9]=(n*E-t*j-r*C)*R,this.mat4[10]=(f*k-g*x+v*b)*R,this.mat4[11]=(u*x-c*k-h*b)*R,this.mat4[12]=(l*_-s*M-p*C)*R,this.mat4[13]=(t*M-n*_+o*C)*
21R,this.mat4[14]=(g*w-f*S-y*b)*R,this.mat4[15]=(c*S-u*w+m*b)*R,this):null},a.Matrix.prototype.invert3x3=function(){var e=this.mat3[0],t=this.mat3[1],n=this.mat3[2],a=this.mat3[3],o=this.mat3[4],i=this.mat3[5],r=this.mat3[6],s=this.mat3[7],l=this.mat3[8],p=l*o-i*s,d=-l*a+i*r,c=s*a-o*r,u=e*p+t*d+n*c;return u?(u=1/u,this.mat3[0]=p*u,this.mat3[1]=(-l*t+n*s)*u,this.mat3[2]=(i*t-n*o)*u,this.mat3[3]=d*u,this.mat3[4]=(l*e-n*r)*u,this.mat3[5]=(-i*e+n*a)*u,this.mat3[6]=c*u,this.mat3[7]=(-s*e+t*r)*u,this.mat3[8]=(o*e-t*a)*u,this):null},a.Matrix.prototype.transpose3x3=function(e){var t=e[1],n=e[2],a=e[5];return this.mat3[1]=e[3],this.mat3[2]=e[6],this.mat3[3]=t,this.mat3[5]=e[7],this.mat3[6]=n,this.mat3[7]=a,this},a.Matrix.prototype.inverseTranspose=function(e){void 0===this.mat3?console.error("sorry, this function only works with mat3"):(this.mat3[0]=e.mat4[0],this.mat3[1]=e.mat4[1],this.mat3[2]=e.mat4[2],this.mat3[3]=e.mat4[4],this.mat3[4]=e.mat4[5],this.mat3[5]=e.mat4[6],this.mat3[6]=e.mat4[8],this.mat3[7]=e.mat4[9],this.mat3[8]=e.mat4[10]);var t=this.invert3x3();if(t)t.transpose3x3(this.mat3);else for(var n=0;n<9;n++)this.mat3[n]=0;return this},a.Matrix.prototype.determinant=function(){var e=this.mat4[0]*this.mat4[5]-this.mat4[1]*this.mat4[4],t=this.mat4[0]*this.mat4[6]-this.mat4[2]*this.mat4[4],n=this.mat4[0]*this.mat4[7]-this.mat4[3]*this.mat4[4],a=this.mat4[1]*this.mat4[6]-this.mat4[2]*this.mat4[5],o=this.mat4[1]*this.mat4[7]-this.mat4[3]*this.mat4[5],i=this.mat4[2]*this.mat4[7]-this.mat4[3]*this.mat4[6],r=this.mat4[8]*this.mat4[13]-this.mat4[9]*this.mat4[12],s=this.mat4[8]*this.mat4[14]-this.mat4[10]*this.mat4[12],l=this.mat4[8]*this.mat4[15]-this.mat4[11]*this.mat4[12],p=this.mat4[9]*this.mat4[14]-this.mat4[10]*this.mat4[13],d=this.mat4[9]*this.mat4[15]-this.mat4[11]*this.mat4[13];return e*(this.mat4[10]*this.mat4[15]-this.mat4[11]*this.mat4[14])-t*d+n*p+a*l-o*s+i*r},a.Matrix.prototype.mult=function(e){var t;if(e===this||e===this.mat4)t=this.copy().mat4;else if(e instanceof a.Matrix)t=e.mat4;else if(i(e))t=e;else{if(16!==arguments.length)return;t=arguments}var n=this.mat4[0],o=this.mat4[1],r=this.mat4[2],s=this.mat4[3];return this.mat4[0]=n*t[0]+o*t[4]+r*t[8]+s*t[12],this.mat4[1]=n*t[1]+o*t[5]+r*t[9]+s*t[13],this.mat4[2]=n*t[2]+o*t[6]+r*t[10]+s*t[14],this.mat4[3]=n*t[3]+o*t[7]+r*t[11]+s*t[15],n=this.mat4[4],o=this.mat4[5],r=this.mat4[6],s=this.mat4[7],this.mat4[4]=n*t[0]+o*t[4]+r*t[8]+s*t[12],this.mat4[5]=n*t[1]+o*t[5]+r*t[9]+s*t[13],this.mat4[6]=n*t[2]+o*t[6]+r*t[10]+s*t[14],this.mat4[7]=n*t[3]+o*t[7]+r*t[11]+s*t[15],n=this.mat4[8],o=this.mat4[9],r=this.mat4[10],s=this.mat4[11],this.mat4[8]=n*t[0]+o*t[4]+r*t[8]+s*t[12],this.mat4[9]=n*t[1]+o*t[5]+r*t[9]+s*t[13],this.mat4[10]=n*t[2]+o*t[6]+r*t[10]+s*t[14],this.mat4[11]=n*t[3]+o*t[7]+r*t[11]+s*t[15],n=this.mat4[12],o=this.mat4[13],r=this.mat4[14],s=this.mat4[15],this.mat4[12]=n*t[0]+o*t[4]+r*t[8]+s*t[12],this.mat4[13]=n*t[1]+o*t[5]+r*t[9]+s*t[13],this.mat4[14]=n*t[2]+o*t[6]+r*t[10]+s*t[14],this.mat4[15]=n*t[3]+o*t[7]+r*t[11]+s*t[15],this},a.Matrix.prototype.apply=function(e){var t;if(e===this||e===this.mat4)t=this.copy().mat4;else if(e instanceof a.Matrix)t=e.mat4;else if(i(e))t=e;else{if(16!==arguments.length)return;t=arguments}var n=this.mat4,o=n[0],r=n[4],s=n[8],l=n[12];n[0]=t[0]*o+t[1]*r+t[2]*s+t[3]*l,n[4]=t[4]*o+t[5]*r+t[6]*s+t[7]*l,n[8]=t[8]*o+t[9]*r+t[10]*s+t[11]*l,n[12]=t[12]*o+t[13]*r+t[14]*s+t[15]*l;var p=n[1],d=n[5],c=n[9],u=n[13];n[1]=t[0]*p+t[1]*d+t[2]*c+t[3]*u,n[5]=t[4]*p+t[5]*d+t[6]*c+t[7]*u,n[9]=t[8]*p+t[9]*d+t[10]*c+t[11]*u,n[13]=t[12]*p+t[13]*d+t[14]*c+t[15]*u;var m=n[2],h=n[6],f=n[10],g=n[14];n[2]=t[0]*m+t[1]*h+t[2]*f+t[3]*g,n[6]=t[4]*m+t[5]*h+t[6]*f+t[7]*g,n[10]=t[8]*m+t[9]*h+t[10]*f+t[11]*g,n[14]=t[12]*m+t[13]*h+t[14]*f+t[15]*g;var y=n[3],v=n[7],b=n[11],w=n[15];return n[3]=t[0]*y+t[1]*v+t[2]*b+t[3]*w,n[7]=t[4]*y+t[5]*v+t[6]*b+t[7]*w,n[11]=t[8]*y+t[9]*v+t[10]*b+t[11]*w,n[15]=t[12]*y+t[13]*v+t[14]*b+t[15]*w,this},a.Matrix.prototype.scale=function(e,t,n){return e instanceof a.Vector?(t=e.y,n=e.z,e=e.x):e instanceof Array&&(t=e[1],n=e[2],e=e[0]),this.mat4[0]*=e,this.mat4[1]*=e,this.mat4[2]*=e,this.mat4[3]*=e,this.mat4[4]*=t,this.mat4[5]*=t,this.mat4[6]*=t,this.mat4[7]*=t,this.mat4[8]*=n,this.mat4[9]*=n,this.mat4[10]*=n,this.mat4[11]*=n,this},a.Matrix.prototype.rotate=function(e,t,n,o){t instanceof a.Vector?(n=t.y,o=t.z,t=t.x):t instanceof Array&&(n=t[1],o=t[2],t=t[0]);var i=Math.sqrt(t*t+n*n+o*o);t*=1/i,n*=1/i,o*=1/i;var r=this.mat4[0],s=this.mat4[1],l=this.mat4[2],p=this.mat4[3],d=this.mat4[4],c=this.mat4[5],u=this.mat4[6],m=this.mat4[7],h=this.mat4[8],f=this.mat4[9],g=this.mat4[10],y=this.mat4[11],v=Math.sin(e),b=Math.cos(e),w=1-b,x=t*t*w+b,S=n*t*w+o*v,k=o*t*w-n*v,T=t*n*w-o*v,C=n*n*w+b,_=o*n*w+t*v,E=t*o*w+n*v,M=n*o*w-t*v,j=o*o*w+b;return this.mat4[0]=r*x+d*S+h*k,this.mat4[1]=s*x+c*S+f*k,this.mat4[2]=l*x+u*S+g*k,this.mat4[3]=p*x+m*S+y*k,this.mat4[4]=r*T+d*C+h*_,this.mat4[5]=s*T+c*C+f*_,this.mat4[6]=l*T+u*C+g*_,this.mat4[7]=p*T+m*C+y*_,this.mat4[8]=r*E+d*M+h*j,this.mat4[9]=s*E+c*M+f*j,this.mat4[10]=l*E+u*M+g*j,this.mat4[11]=p*E+m*M+y*j,this},a.Matrix.prototype.translate=function(e){var t=e[0],n=e[1],a=e[2]||0;this.mat4[12]+=this.mat4[0]*t+this.mat4[4]*n+this.mat4[8]*a,this.mat4[13]+=this.mat4[1]*t+this.mat4[5]*n+this.mat4[9]*a,this.mat4[14]+=this.mat4[2]*t+this.mat4[6]*n+this.mat4[10]*a,this.mat4[15]+=this.mat4[3]*t+this.mat4[7]*n+this.mat4[11]*a},a.Matrix.prototype.rotateX=function(e){this.rotate(e,1,0,0)},a.Matrix.prototype.rotateY=function(e){this.rotate(e,0,1,0)},a.Matrix.prototype.rotateZ=function(e){this.rotate(e,0,0,1)},a.Matrix.prototype.perspective=function(e,t,n,a){var o=1/Math.tan(e/2),i=1/(n-a);return this.mat4[0]=o/t,this.mat4[1]=0,this.mat4[2]=0,this.mat4[3]=0,this.mat4[4]=0,this.mat4[5]=o,this.mat4[6]=0,this.mat4[7]=0,this.mat4[8]=0,this.mat4[9]=0,this.mat4[10]=(a+n)*i,this.mat4[11]=-1,this.mat4[12]=0,this.mat4[13]=0,this.mat4[14]=2*a*n*i,this.mat4[15]=0,this},a.Matrix.prototype.ortho=function(e,t,n,a,o,i){var r=1/(e-t),s=1/(n-a),l=1/(o-i);return this.mat4[0]=-2*r,this.mat4[1]=0,this.mat4[2]=0,this.mat4[3]=0,this.mat4[4]=0,this.mat4[5]=-2*s,this.mat4[6]=0,this.mat4[7]=0,this.mat4[8]=0,this.mat4[9]=0,this.mat4[10]=2*l,this.mat4[11]=0,this.mat4[12]=(e+t)*r,this.mat4[13]=(a+n)*s,this.mat4[14]=(i+o)*l,this.mat4[15]=1,this},t.exports=a.Matrix},{"../core/main":24}],73:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("../core/constants");a.RendererGL.prototype.beginShape=function(e){return this.immediateMode.shapeMode=void 0!==e?e:o.LINE_STRIP,void 0===this.immediateMode.vertices?(this.immediateMode.vertices=[],this.immediateMode.edges=[],this.immediateMode.lineVertices=[],this.immediateMode.vertexColors=[],this.immediateMode.lineNormals=[],this.immediateMode.uvCoords=[],this.immediateMode.vertexBuffer=this.GL.createBuffer(),this.immediateMode.colorBuffer=this.GL.createBuffer(),this.immediateMode.uvBuffer=this.GL.createBuffer(),this.immediateMode.lineVertexBuffer=this.GL.createBuffer(),this.immediateMode.lineNormalBuffer=this.GL.createBuffer(),this.immediateMode.pointVertexBuffer=this.GL.createBuffer(),this.immediateMode._bezierVertex=[],this.immediateMode._quadraticVertex=[],this.immediateMode._curveVertex=[],this.immediateMode._isCoplanar=!0,this.immediateMode._testIfCoplanar=null):(this.immediateMode.vertices.length=0,this.immediateMode.edges.length=0,this.immediateMode.lineVertices.length=0,this.immediateMode.lineNormals.length=0,this.immediateMode.vertexColors.length=0,this.immediateMode.uvCoords.length=0),this.isImmediateDrawing=!0,this},a.RendererGL.prototype.vertex=function(e,t){var n,i,r;n=i=r=0,3===arguments.length?n=arguments[2]:4===arguments.length?(i=arguments[2],r=arguments[3]):5===arguments.length&&(n=arguments[2],i=arguments[3],r=arguments[4]),null==this.immediateMode._testIfCoplanar?this.immediateMode._testIfCoplanar=n:this.immediateMode._testIfCoplanar!==n&&(this.immediateMode._isCoplanar=!1);var s=new a.Vector(e,t,n);this.immediateMode.vertices.push(s);var l=this.curFillColor||[.5,.5,.5,1];return this.immediateMode.vertexColors.push(l[0],l[1],l[2],l[3]),this.textureMode===o.IMAGE&&(null!==this._tex?this._tex.width>0&&this._tex.height>0&&(i/=this._tex.width,r/=this._tex.height):null===this._tex&&arguments.length>=4&&console.warn("You must first call texture() before using vertex() with image based u and v coordinates")),this.immediateMode.uvCoords.push(i,r),this.immediateMode._bezierVertex[0]=e,this.immediateMode._bezierVertex[1]=t,this.immediateMode._bezierVertex[2]=n,this.immediateMode._quadraticVertex[0]=e,this.immediateMode._quadraticVertex[1]=t,this.immediateMode._quadraticVertex[2]=n,this},a.RendererGL.prototype.endShape=function(e,t,n,i,r,s){if(this.immediateMode.shapeMode===o.POINTS)this._drawPoints(this.immediateMode.vertices,this.immediateMode.pointVertexBuffer);else if(this.immediateMode.vertices.length>1){if(this._doStroke&&this.drawMode!==o.TEXTURE){if(this.immediateMode.shapeMode===o.TRIANGLE_STRIP){var l;
21for(l=0;l<this.immediateMode.vertices.length-2;l++)this.immediateMode.edges.push([l,l+1]),this.immediateMode.edges.push([l,l+2]);this.immediateMode.edges.push([l,l+1])}else if(this.immediateMode.shapeMode===o.TRIANGLES)for(l=0;l<this.immediateMode.vertices.length-2;l+=3)this.immediateMode.edges.push([l,l+1]),this.immediateMode.edges.push([l+1,l+2]),this.immediateMode.edges.push([l+2,l]);else if(this.immediateMode.shapeMode===o.LINES)for(l=0;l<this.immediateMode.vertices.length-1;l+=2)this.immediateMode.edges.push([l,l+1]);else for(l=0;l<this.immediateMode.vertices.length-1;l++)this.immediateMode.edges.push([l,l+1]);e===o.CLOSE&&this.immediateMode.edges.push([this.immediateMode.vertices.length-1,0]),a.Geometry.prototype._edgesToVertices.call(this.immediateMode),this._drawStrokeImmediateMode()}if(this._doFill&&this.immediateMode.shapeMode!==o.LINES){if(this.isBezier||this.isQuadratic||this.isCurve||this.immediateMode.shapeMode===o.LINE_STRIP&&this.drawMode===o.FILL&&!0===this.immediateMode._isCoplanar){this.immediateMode.shapeMode=o.TRIANGLES;var p=[new Float32Array(this._vToNArray(this.immediateMode.vertices))],d=this._triangulate(p);this.immediateMode.vertices=[];for(var c=0,u=d.length;c<u;c+=3)this.vertex(d[c],d[c+1],d[c+2])}this.immediateMode.vertices.length>0&&this._drawFillImmediateMode(e,t,n,i,r,s)}}return this.immediateMode.vertices.length=0,this.immediateMode.vertexColors.length=0,this.immediateMode.uvCoords.length=0,this.isImmediateDrawing=!1,this.isBezier=!1,this.isQuadratic=!1,this.isCurve=!1,this.immediateMode._bezierVertex.length=0,this.immediateMode._quadraticVertex.length=0,this.immediateMode._curveVertex.length=0,this.immediateMode._isCoplanar=!0,this.immediateMode._testIfCoplanar=null,this},a.RendererGL.prototype._drawFillImmediateMode=function(e,t,n,a,i,r){var s=this.GL,l=this._getImmediateFillShader();if(this._setFillUniforms(l),l.attributes.aPosition&&(this._bindBuffer(this.immediateMode.vertexBuffer,s.ARRAY_BUFFER,this._vToNArray(this.immediateMode.vertices),Float32Array,s.DYNAMIC_DRAW),l.enableAttrib(l.attributes.aPosition,3)),this.drawMode===o.FILL&&l.attributes.aVertexColor&&(this._bindBuffer(this.immediateMode.colorBuffer,s.ARRAY_BUFFER,this.immediateMode.vertexColors,Float32Array,s.DYNAMIC_DRAW),l.enableAttrib(l.attributes.aVertexColor,4)),this.drawMode===o.TEXTURE&&l.attributes.aTexCoord&&(this._bindBuffer(this.immediateMode.uvBuffer,s.ARRAY_BUFFER,this.immediateMode.uvCoords,Float32Array,s.DYNAMIC_DRAW),l.enableAttrib(l.attributes.aTexCoord,2)),this.drawMode===o.FILL||this.drawMode===o.TEXTURE)switch(this.immediateMode.shapeMode){case o.LINE_STRIP:case o.LINES:this.immediateMode.shapeMode=o.TRIANGLE_FAN}else switch(this.immediateMode.shapeMode){case o.LINE_STRIP:case o.LINES:this.immediateMode.shapeMode=o.LINE_LOOP}if(this.immediateMode.shapeMode===o.QUADS||this.immediateMode.shapeMode===o.QUAD_STRIP)throw new Error("sorry, "+this.immediateMode.shapeMode+" not yet implemented in webgl mode.");this._applyColorBlend(this.curFillColor),s.enable(s.BLEND),s.drawArrays(this.immediateMode.shapeMode,0,this.immediateMode.vertices.length),this._pixelsState._pixelsDirty=!0,l.unbindShader()},a.RendererGL.prototype._drawStrokeImmediateMode=function(){var e=this.GL,t=this._getImmediateStrokeShader();this._setStrokeUniforms(t),t.attributes.aPosition&&(this._bindBuffer(this.immediateMode.lineVertexBuffer,e.ARRAY_BUFFER,this._flatten(this.immediateMode.lineVertices),Float32Array,e.STATIC_DRAW),t.enableAttrib(t.attributes.aPosition,3)),t.attributes.aDirection&&(this._bindBuffer(this.immediateMode.lineNormalBuffer,e.ARRAY_BUFFER,this._flatten(this.immediateMode.lineNormals),Float32Array,e.STATIC_DRAW),t.enableAttrib(t.attributes.aDirection,4)),this._applyColorBlend(this.curStrokeColor),e.drawArrays(e.TRIANGLES,0,this.immediateMode.lineVertices.length),this._pixelsState._pixelsDirty=!0,t.unbindShader()},t.exports=a.RendererGL},{"../core/constants":18,"../core/main":24}],74:[function(e,t,n){"use strict";var a=e("../core/main");function o(e,t,n,a,o){this.size=e,this.src=t,this.dst=n,this.attr=a,this.map=o}e("./p5.RendererGL");var i=a.RendererGL.prototype._flatten,r=a.RendererGL.prototype._vToNArray,s=[new o(3,"lineVertices","lineVertexBuffer","aPosition",i),new o(4,"lineNormals","lineNormalBuffer","aDirection",i)],l=[new o(3,"vertices","vertexBuffer","aPosition",r),new o(3,"vertexNormals","normalBuffer","aNormal",r),new o(4,"vertexColors","colorBuffer","aMaterialColor"),new o(3,"vertexAmbients","ambientBuffer","aAmbientColor"),new o(2,"uvs","uvBuffer","aTexCoord",i)];a.RendererGL._textBuffers=[new o(3,"vertices","vertexBuffer","aPosition",r),new o(2,"uvs","uvBuffer","aTexCoord",i)];var p=0;a.RendererGL.prototype._initBufferDefaults=function(e){if(this._freeBuffers(e),++p>1e3){var t=Object.keys(this.gHash)[0];delete this.gHash[t],p--}return this.gHash[e]={}},a.RendererGL.prototype._freeBuffers=function(e){var t=this.gHash[e];if(t){delete this.gHash[e],p--;var n=this.GL;t.indexBuffer&&n.deleteBuffer(t.indexBuffer),a(s),a(l)}function a(e){for(var a=0;a<e.length;a++){var o=e[a];t[o.dst]&&(n.deleteBuffer(t[o.dst]),t[o.dst]=null)}}},a.RendererGL.prototype._prepareBuffers=function(e,t,n){for(var a=e.model,o=t.attributes,i=this.GL,r=0;r<n.length;r++){var s=n[r],l=o[s.attr];if(l){var p=e[s.dst],d=a[s.src];if(d){var c=!p;if(c&&(e[s.dst]=p=i.createBuffer()),i.bindBuffer(i.ARRAY_BUFFER,p),c||!1!==a.dirtyFlags[s.src]){var u=s.map,m=u?u(d):d;this._bindBuffer(p,i.ARRAY_BUFFER,m),a.dirtyFlags[s.src]=!1}t.enableAttrib(l,s.size)}else p&&(i.deleteBuffer(p),e[s.dst]=null),i.disableVertexAttribArray(l.index)}}},a.RendererGL.prototype.createBuffers=function(e,t){var n=this.GL,o=this._initBufferDefaults(e);o.model=t;var i=o.indexBuffer;if(t.faces.length){i||(i=o.indexBuffer=n.createBuffer());var r=a.RendererGL.prototype._flatten(t.faces);this._bindBuffer(i,n.ELEMENT_ARRAY_BUFFER,r,Uint16Array),o.vertexCount=3*t.faces.length}else i&&(n.deleteBuffer(i),o.indexBuffer=null),o.vertexCount=t.vertices?t.vertices.length:0;return o.lineVertexCount=t.lineVertices?t.lineVertices.length:0,o},a.RendererGL.prototype.drawBuffers=function(e){var t=this.GL,n=this.gHash[e];if(this._doStroke&&n.lineVertexCount>0){var a=this._getRetainedStrokeShader();this._setStrokeUniforms(a),this._prepareBuffers(n,a,s),this._applyColorBlend(this.curStrokeColor),this._drawArrays(t.TRIANGLES,e),a.unbindShader()}if(this._doFill){var o=this._getRetainedFillShader();this._setFillUniforms(o),this._prepareBuffers(n,o,l),n.indexBuffer&&this._bindBuffer(n.indexBuffer,t.ELEMENT_ARRAY_BUFFER),this._applyColorBlend(this.curFillColor),this._drawElements(t.TRIANGLES,e),o.unbindShader()}return this},a.RendererGL.prototype.drawBuffersScaled=function(e,t,n,a){var o=this.uMVMatrix.copy();try{this.uMVMatrix.scale(t,n,a),this.drawBuffers(e)}finally{this.uMVMatrix=o}},a.RendererGL.prototype._drawArrays=function(e,t){return this.GL.drawArrays(e,0,this.gHash[t].lineVertexCount),this._pixelsState._pixelsDirty=!0,this},a.RendererGL.prototype._drawElements=function(e,t){var n=this.gHash[t],a=this.GL;n.indexBuffer?a.drawElements(a.TRIANGLES,n.vertexCount,a.UNSIGNED_SHORT,0):a.drawArrays(e||a.TRIANGLES,0,n.vertexCount),this._pixelsState._pixelsDirty=!0},a.RendererGL.prototype._drawPoints=function(e,t){var n=this.GL,a=this._getImmediatePointShader();this._setPointUniforms(a),this._bindBuffer(t,n.ARRAY_BUFFER,this._vToNArray(e),Float32Array,n.STATIC_DRAW),a.enableAttrib(a.attributes.aPosition,3),n.drawArrays(n.Points,0,e.length),a.unbindShader(),this._pixelsState._pixelsDirty=!0},t.exports=a.RendererGL},{"../core/main":24,"./p5.RendererGL":75}],75:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("../core/constants"),i=e("libtess");
21e("./p5.Shader"),e("./p5.Camera"),e("../core/p5.Renderer"),e("./p5.Matrix");var r="precision mediump float;\n\nuniform mat4 uViewMatrix;\n\nuniform bool uUseLighting;\n\nuniform int uAmbientLightCount;\nuniform vec3 uAmbientColor[8];\n\nuniform int uDirectionalLightCount;\nuniform vec3 uLightingDirection[8];\nuniform vec3 uDirectionalColor[8];\n\nuniform int uPointLightCount;\nuniform vec3 uPointLightLocation[8];\nuniform vec3 uPointLightColor[8];\n\nuniform bool uSpecular;\nuniform float uShininess;\n\nuniform float uConstantAttenuation;\nuniform float uLinearAttenuation;\nuniform float uQuadraticAttenuation;\n\nconst float specularFactor = 2.0;\nconst float diffuseFactor = 0.73;\n\nstruct LightResult {\n  float specular;\n  float diffuse;\n};\n\nfloat _phongSpecular(\n  vec3 lightDirection,\n  vec3 viewDirection,\n  vec3 surfaceNormal,\n  float shininess) {\n\n  vec3 R = reflect(lightDirection, surfaceNormal);\n  return pow(max(0.0, dot(R, viewDirection)), shininess);\n}\n\nfloat _lambertDiffuse(vec3 lightDirection, vec3 surfaceNormal) {\n  return max(0.0, dot(-lightDirection, surfaceNormal));\n}\n\nLightResult _light(vec3 viewDirection, vec3 normal, vec3 lightVector) {\n\n  vec3 lightDir = normalize(lightVector);\n\n  //compute our diffuse & specular terms\n  LightResult lr;\n  if (uSpecular)\n    lr.specular = _phongSpecular(lightDir, viewDirection, normal, uShininess);\n  lr.diffuse = _lambertDiffuse(lightDir, normal);\n  return lr;\n}\n\nvoid totalLight(\n  vec3 modelPosition,\n  vec3 normal,\n  out vec3 totalDiffuse,\n  out vec3 totalSpecular\n) {\n\n  totalSpecular = vec3(0.0);\n\n  if (!uUseLighting) {\n    totalDiffuse = vec3(1.0);\n    return;\n  }\n\n  totalDiffuse = vec3(0.0);\n\n  vec3 viewDirection = normalize(-modelPosition);\n\n  for (int j = 0; j < 8; j++) {\n    if (j < uDirectionalLightCount) {\n      vec3 lightVector = (uViewMatrix * vec4(uLightingDirection[j], 0.0)).xyz;\n      vec3 lightColor = uDirectionalColor[j];\n      LightResult result = _light(viewDirection, normal, lightVector);\n      totalDiffuse += result.diffuse * lightColor;\n      totalSpecular += result.specular * lightColor;\n    }\n\n    if (j < uPointLightCount) {\n      vec3 lightPosition = (uViewMatrix * vec4(uPointLightLocation[j], 1.0)).xyz;\n      vec3 lightVector = modelPosition - lightPosition;\n    \n      //calculate attenuation\n      float lightDistance = length(lightVector);\n      float lightFalloff = 1.0 / (uConstantAttenuation + lightDistance * uLinearAttenuation + (lightDistance * lightDistance) * uQuadraticAttenuation);\n      vec3 lightColor = lightFalloff * uPointLightColor[j];\n\n      LightResult result = _light(viewDirection, normal, lightVector);\n      totalDiffuse += result.diffuse * lightColor;\n      totalSpecular += result.specular * lightColor;\n    }\n  }\n\n  totalDiffuse *= diffuseFactor;\n  totalSpecular *= specularFactor;\n}\n",s={immediateVert:"attribute vec3 aPosition;\nattribute vec4 aVertexColor;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform float uResolution;\nuniform float uPointSize;\n\nvarying vec4 vColor;
21\nvoid main(void) {\n  vec4 positionVec4 = vec4(aPosition, 1.0);\n  gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n  vColor = aVertexColor;\n  gl_PointSize = uPointSize;\n}\n",vertexColorVert:"attribute vec3 aPosition;\nattribute vec4 aVertexColor;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nvarying vec4 vColor;\n\nvoid main(void) {\n  vec4 positionVec4 = vec4(aPosition, 1.0);\n  gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n  vColor = aVertexColor;\n}\n",vertexColorFrag:"precision mediump float;\nvarying vec4 vColor;\nvoid main(void) {\n  gl_FragColor = vColor;\n}",normalVert:"attribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\n\nvarying vec3 vVertexNormal;\nvarying highp vec2 vVertTexCoord;\n\nvoid main(void) {\n  vec4 positionVec4 = vec4(aPosition, 1.0);\n  gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n  vVertexNormal = normalize(vec3( uNormalMatrix * aNormal ));\n  vVertTexCoord = aTexCoord;\n}\n",normalFrag:"precision mediump float;\nvarying vec3 vVertexNormal;\nvoid main(void) {\n  gl_FragColor = vec4(vVertexNormal, 1.0);\n}",basicFrag:"precision mediump float;\nuniform vec4 uMaterialColor;\nvoid main(void) {\n  gl_FragColor = uMaterialColor;\n}",lightVert:r+"// include lighting.glgl\n\nattribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord;\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\n\nvarying highp vec2 vVertTexCoord;\nvarying vec3 vDiffuseColor;\nvarying vec3 vSpecularColor;\n\nvoid main(void) {\n\n  vec4 viewModelPosition = uModelViewMatrix * vec4(aPosition, 1.0
21);\n  gl_Position = uProjectionMatrix * viewModelPosition;\n\n  vec3 vertexNormal = normalize(uNormalMatrix * aNormal);\n  vVertTexCoord = aTexCoord;\n\n  totalLight(viewModelPosition.xyz, vertexNormal, vDiffuseColor, vSpecularColor);\n\n  for (int i = 0; i < 8; i++) {\n    if (i < uAmbientLightCount) {\n      vDiffuseColor += uAmbientColor[i];\n    }\n  }\n}\n",lightTextureFrag:"precision mediump float;\n\nuniform vec4 uMaterialColor;\nuniform vec4 uTint;\nuniform sampler2D uSampler;\nuniform bool isTexture;\n\nvarying highp vec2 vVertTexCoord;\nvarying vec3 vDiffuseColor;\nvarying vec3 vSpecularColor;\n\nvoid main(void) {\n  gl_FragColor = isTexture ? texture2D(uSampler, vVertTexCoord) * (uTint / vec4(255, 255, 255, 255)) : uMaterialColor;\n  gl_FragColor.rgb = gl_FragColor.rgb * vDiffuseColor + vSpecularColor;\n}",phongVert:"precision mediump float;\nprecision mediump int;\n\nattribute vec3 aPosition;\nattribute vec3 aNormal;\nattribute vec2 aTexCoord;\n\nuniform vec3 uAmbientColor[8];\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform mat3 uNormalMatrix;\nuniform int uAmbientLightCount;\n\nvarying vec3 vNormal;\nvarying vec2 vTexCoord;\nvarying vec3 vViewPosition;\nvarying vec3 vAmbientColor;\n\nvoid main(void) {\n\n  vec4 viewModelPosition = uModelViewMatrix * vec4(aPosition, 1.0
21);\n\n  // Pass varyings to fragment shader\n  vViewPosition = viewModelPosition.xyz;\n  gl_Position = uProjectionMatrix * viewModelPosition;  \n\n  vNormal = uNormalMatrix * aNormal;\n  vTexCoord = aTexCoord;\n\n  // TODO: this should be a uniform\n  vAmbientColor = vec3(0.0);\n  for (int i = 0; i < 8; i++) {\n    if (i < uAmbientLightCount) {\n      vAmbientColor += uAmbientColor[i];\n    }\n  }\n}\n",phongFrag:r+"// include lighting.glgl\n\nuniform vec4 uMaterialColor;\nuniform sampler2D uSampler;\nuniform bool isTexture;\n\nvarying vec3 vNormal;\nvarying vec2 vTexCoord;\nvarying vec3 vViewPosition;\nvarying vec3 vAmbientColor;\n\nvoid main(void) {\n\n  vec3 diffuse;\n  vec3 specular;\n  totalLight(vViewPosition, normalize(vNormal), diffuse, specular);\n\n  gl_FragColor = isTexture ? texture2D(uSampler, vTexCoord) : uMaterialColor;\n  gl_FragColor.rgb = gl_FragColor.rgb * (diffuse + vAmbientColor) + specular;\n}",fontVert:"precision mediump float;\n\nattribute vec3 aPosition;\nattribute vec2 aTexCoord;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\n\nuniform vec4 uGlyphRect;\nuniform float uGlyphOffset;\n\nvarying vec2 vTexCoord;\nvarying float w;
21\n\nvoid main() {\n  vec4 positionVec4 = vec4(aPosition, 1.0);\n\n  // scale by the size of the glyph's rectangle\n  positionVec4.xy *= uGlyphRect.zw - uGlyphRect.xy;\n\n  // move to the corner of the glyph\n  positionVec4.xy += uGlyphRect.xy;\n\n  // move to the letter's line offset\n  positionVec4.x += uGlyphOffset;\n  \n  gl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n  vTexCoord = aTexCoord;\n  w = gl_Position.w;\n}\n",fontFrag:"#extension GL_OES_standard_derivatives : enable\nprecision mediump float;\n\n#if 0\n  // simulate integer math using floats\n\t#define int float\n\t#define ivec2 vec2\n\t#define INT(x) float(x)\n\n\tint ifloor(float v) { return floor(v); }\n\tivec2 ifloor(vec2 v) { return floor(v); }\n\n#else\n  // use native integer math\n\tprecision highp int;\n\t#define INT(x) x\n\n\tint ifloor(float v) { return int(v); }\n\tint ifloor(int v) { return v; }\n\tivec2 ifloor(vec2 v) { return ivec2(v); }\n\n#endif\n\nuniform sampler2D uSamplerStrokes;\nuniform sampler2D uSamplerRowStrokes;\nuniform sampler2D uSamplerRows;\nuniform sampler2D uSamplerColStrokes;\nuniform sampler2D uSamplerCols;\n\nuniform ivec2 uStrokeImageSize;\nuniform ivec2 uCellsImageSize;\nuniform ivec2 uGridImageSize;\n\nuniform ivec2 uGridOffset;\nuniform ivec2 uGridSize;\nuniform vec4 uMaterialColor;\n\nvarying vec2 vTexCoord;\n\n// some helper functions\nint round(float v) { return ifloor(v + 0.5); }\nivec2 round(vec2 v) { return ifloor(v + 0.5); }\nfloat saturate(float v) { return clamp(v, 0.0, 1.0); }\nvec2 saturate(vec2 v) { return clamp(v, 0.0, 1.0); }\n\nint mul(float v1, int v2) {\n  return ifloor(v1 * float(v2));\n}\n\nivec2 mul(vec2 v1, ivec2 v2) {\n  return ifloor(v1 * vec2(v2) + 0.5);\n}\n\n// unpack a 16-bit integer from a float vec2\nint getInt16(vec2 v) {\n  ivec2 iv = round(v * 255.0);\n  return iv.x * INT(128) + iv.y;\n}\n\nvec2 pixelScale;\nvec2 coverage = vec2(0.0);\nvec2 weight = vec2(0.5);\nconst float minDistance = 1.0/8192.0;\nconst float hardness = 1.05; // amount of antialias\n\n// the maximum number of curves in a glyph\nconst int N = INT(250);\n\n// retrieves an indexed pixel from a sampler\nvec4 getTexel(sampler2D sampler, int pos, ivec2 size) {\n  int width = size.x;\n  int y = ifloor(pos / width);\n  int x = pos - y * width;  // pos % width\n\n  return texture2D(sampler, (vec2(x, y) + 0.5) / vec2(size));\n}\n\nvoid calulateCrossings(vec2 p0, vec2 p1, vec2 p2, out vec2 C1, out vec2 C2) {\n\n  // get the coefficients of the quadratic in t\n  vec2 a = p0 - p1 * 2.0 + p2;\n  vec2 b = p0 - p1;\n  vec2 c = p0 - vTexCoord;\n\n  // found out which values of 't' it crosses the axes\n  vec2 surd = sqrt(max(vec2(0.0), b * b - a * c));\n  vec2 t1 = ((b - surd) / a).yx;\n  vec2 t2 = ((b + surd) / a).yx;\n\n  // approximate straight lines to avoid rounding errors\n  if (abs(a.y) < 0.001)\n    t1.x = t2.x = c.y / (2.0 * b.y);\n\n  if (abs(a.x) < 0.001)\n    t1.y = t2.y = c.x / (2.0 * b.x);\n\n  // plug into quadratic formula to find the corrdinates of the crossings\n  C1 = ((a * t1 - b * 2.0) * t1 + c) * pixelScale;\n  C2 = ((a * t2 - b * 2.0) * t2 + c) * pixelScale;\n}\n\nvoid coverageX(vec2 p0, vec2 p1, vec2 p2) {\n\n  vec2 C1, C2;\n  calulateCrossings(p0, p1, p2, C1, C2);\n\n  // determine on which side of the x-axis the points lie\n  bool y0 = p0.y > vTexCoord.y;\n  bool y1 = p1.y > vTexCoord.y;\n  bool y2 = p2.y > vTexCoord.y;\n\n  // could web be under the curve (after t1)?\n  if (y1 ? !y2 : y0) {\n    // add the coverage for t1\n    coverage.x += saturate(C1.x + 0.5);\n    // calculate the anti-aliasing for t1\n    weight.x = min(weight.x, abs(C1.x));\n  }\n\n  // are we outside the curve (after t2)?\n  if (y1 ? !y0 : y2) {\n    // subtract the coverage for t2\n    coverage.x -= saturate(C2.x + 0.5);\n    // calculate the anti-aliasing for t2\n    weight.x = min(weight.x, abs(C2.x));\n  }\n}\n\n// this is essentially the same as coverageX, but with the axes swapped\nvoid coverageY(vec2 p0, vec2 p1, vec2 p2) {\n\n  vec2 C1, C2;\n  calulateCrossings(p0, p1, p2, C1, C2);\n\n  bool x0 = p0.x > vTexCoord.x;\n  bool x1 = p1.x > vTexCoord.x;\n  bool x2 = p2.x > vTexCoord.x;
21\n\n  if (x1 ? !x2 : x0) {\n    coverage.y -= saturate(C1.y + 0.5);\n    weight.y = min(weight.y, abs(C1.y));\n  }\n\n  if (x1 ? !x0 : x2) {\n    coverage.y += saturate(C2.y + 0.5);\n    weight.y = min(weight.y, abs(C2.y));\n  }\n}\n\nvoid main() {\n\n  // calculate the pixel scale based on screen-coordinates\n  pixelScale = hardness / fwidth(vTexCoord);\n\n  // which grid cell is this pixel in?\n  ivec2 gridCoord = ifloor(vTexCoord * vec2(uGridSize));\n\n  // intersect curves in this row\n  {\n    // the index into the row info bitmap\n    int rowIndex = gridCoord.y + uGridOffset.y;\n    // fetch the info texel\n    vec4 rowInfo = getTexel(uSamplerRows, rowIndex, uGridImageSize);\n    // unpack the rowInfo\n    int rowStrokeIndex = getInt16(rowInfo.xy);\n    int rowStrokeCount = getInt16(rowInfo.zw);\n\n    for (int iRowStroke = INT(0); iRowStroke < N; iRowStroke++) {\n      if (iRowStroke >= rowStrokeCount)\n        break;\n\n      // each stroke is made up of 3 points: the start and control point\n      // and the start of the next curve.\n      // fetch the indices of this pair of strokes:\n      vec4 strokeIndices = getTexel(uSamplerRowStrokes, rowStrokeIndex++, uCellsImageSize);\n\n      // unpack the stroke index\n      int strokePos = getInt16(strokeIndices.xy);\n\n      // fetch the two strokes\n      vec4 stroke0 = getTexel(uSamplerStrokes, strokePos + INT(0), uStrokeImageSize);\n      vec4 stroke1 = getTexel(uSamplerStrokes, strokePos + INT(1), uStrokeImageSize);\n\n      // calculate the coverage\n      coverageX(stroke0.xy, stroke0.zw, stroke1.xy);\n    }\n  }\n\n  // intersect curves in this column\n  {\n    int colIndex = gridCoord.x + uGridOffset.x;\n    vec4 colInfo = getTexel(uSamplerCols, colIndex, uGridImageSize);\n    int colStrokeIndex = getInt16(colInfo.xy);\n    int colStrokeCount = getInt16(colInfo.zw);\n    \n    for (int iColStroke = INT(0); iColStroke < N; iColStroke++) {\n      if (iColStroke >= colStrokeCount)\n        break;\n\n      vec4 strokeIndices = getTexel(uSamplerColStrokes, colStrokeIndex++, uCellsImageSize);\n\n      int strokePos = getInt16(strokeIndices.xy);\n      vec4 stroke0 = getTexel(uSamplerStrokes, strokePos + INT(0), uStrokeImageSize);\n      vec4 stroke1 = getTexel(uSamplerStrokes, strokePos + INT(1), uStrokeImageSize);\n      coverageY(stroke0.xy, stroke0.zw, stroke1.xy);\n    }\n  }\n\n  weight = saturate(1.0 - weight * 2.0);\n  float distance = max(weight.x + weight.y, minDistance); // manhattan approx.\n  float antialias = abs(dot(coverage, weight) / distance);\n  float cover = min(abs(coverage.x), abs(coverage.y));\n  gl_FragColor = uMaterialColor;\n  gl_FragColor.a *= saturate(max(antialias, cover));\n}",lineVert:"/*\n  Part of the Processing project - http://processing.org\n  Copyright (c) 2012-15 The Processing Foundation\n  Copyright (c) 2004-12 Ben Fry and Casey Reas\n  Copyright (c) 2001-04 Massachusetts Institute of Technology\n  This library is free software; you can redistribute it and/or\n  modify it under the terms of the GNU Lesser General Public\n  License as published by the Free Software Foundation, version 2.1.\n  This library is distributed in the hope that it will be useful,\n  but WITHOUT ANY WARRANTY; without even the implied warranty of\n  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU\n  Lesser General Public License for more details.\n  You should have received a copy of the GNU Lesser General\n  Public License along with this library; if not, write to the\n  Free Software Foundation, Inc., 59 Temple Place, Suite 330,\n  Boston, MA  02111-1307  USA\n*/\n\n#define PROCESSING_LINE_SHADER\n\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;\nuniform float uStrokeWeight;\n\nuniform vec4 uViewport;\n\nattribute vec4 aPosition;\nattribute vec4 aDirection;\n  \nvoid main() {\n  // using a scale <1 moves the lines towards the camera\n  // in order to prevent popping effects due to half of\n  // the line disappearing behind the geometry faces.\n  vec3 scale = vec3(0.9995);\n\n  vec4 posp = uModelViewMatrix * aPosition;\n  vec4 posq = uModelViewMatrix * (aPosition + vec4(aDirection.xyz, 0));\n\n  // Moving vertices slightly toward the camera\n  // to avoid depth-fighting with the fill triangles.\n  // Discussed here:\n  // http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=252848  \n  posp.xyz = posp.xyz * scale;\n  posq.xyz = posq.xyz * scale;\n\n  vec4 p = uProjectionMatrix * posp;\n  vec4 q = uProjectionMatrix * posq;\n\n  // formula to convert from clip space (range -1..1) to screen space (range 0..[width or height])\n  // screen_p = (p.xy/p.w + <1,1>) * 0.5 * uViewport.zw\n\n  // prevent division by W by transforming the tangent formula (div by 0 causes\n  // the line to disappear, see https://github.com/processing/processing/issues/5183)\n  // t = screen_q - screen_p\n  //\n  // tangent is normalized and we don't care which aDirection it points to (+-)\n  // t = +- normalize( screen_q - screen_p )\n  // t = +- normalize( (q.xy/q.w+<1,1>)*0.5*uViewport.zw - (p.xy/p.w+<1,1>)*0.5*uViewport.zw )\n  //\n  // extract common factor, <1,1> - <1,1> cancels out\n  // t = +- normalize( (q.xy/q.w - p.xy/p.w) * 0.5 * uViewport.zw )\n  //\n  // convert to common divisor\n  // t = +- normalize( ((q.xy*p.w - p.xy*q.w) / (p.w*q.w)) * 0.5 * uViewport.zw )\n  //\n  // remove the common scalar divisor/factor, not needed due to normalize and +-\n  // (keep uViewport - can't remove because it has different c
21omponents for x and y\n  //  and corrects for aspect ratio, see https://github.com/processing/processing/issues/5181)\n  // t = +- normalize( (q.xy*p.w - p.xy*q.w) * uViewport.zw )\n\n  vec2 tangent = normalize((q.xy*p.w - p.xy*q.w) * uViewport.zw);\n\n  // flip tangent to normal (it's already normalized)\n  vec2 normal = vec2(-tangent.y, tangent.x);\n\n  float thickness = aDirection.w * uStrokeWeight;\n  vec2 offset = normal * thickness / 2.0;\n\n  // Perspective ---\n  // convert from world to clip by multiplying with projection scaling factor\n  // to get the right thickness (see https://github.com/processing/processing/issues/5182)\n  // invert Y, projections in Processing invert Y\n  vec2 perspScale = (uProjectionMatrix * vec4(1, -1, 0, 0)).xy;\n\n  // No Perspective ---\n  // multiply by W (to cancel out division by W later in the pipeline) and\n  // convert from screen to clip (derived from clip to screen above)\n  vec2 noPerspScale = p.w / (0.5 * uViewport.zw);\n\n  //gl_Position.xy = p.xy + offset.xy * mix(noPerspScale, perspScale, float(perspective > 0));\n  gl_Position.xy = p.xy + offset.xy * perspScale;\n  gl_Position.zw = p.zw;\n}\n",lineFrag:"precision mediump float;\nprecision mediump int;\n\nuniform vec4 uMaterialColor;\n\nvoid main() {\n  gl_FragColor = uMaterialColor;\n}",pointVert:"attribute vec3 aPosition;\nuniform float uPointSize;\nvarying float vStrokeWeight;\nuniform mat4 uModelViewMatrix;\nuniform mat4 uProjectionMatrix;
21\nvoid main() {\n\tvec4 positionVec4 =  vec4(aPosition, 1.0);\n\tgl_Position = uProjectionMatrix * uModelViewMatrix * positionVec4;\n\tgl_PointSize = uPointSize;\n\tvStrokeWeight = uPointSize;\n}",pointFrag:"precision mediump float;\nprecision mediump int;\nuniform vec4 uMaterialColor;\nvarying float vStrokeWeight;\n\nvoid main(){\n\tfloat mask = 0.0;\n\n\t// make a circular mask using the gl_PointCoord (goes from 0 - 1 on a point)\n    // might be able to get a nicer edge on big strokeweights with smoothstep but slightly less performant\n\n\tmask = step(0.98, length(gl_PointCoord * 2.0 - 1.0));\n\n\t// if strokeWeight is 1 or less lets just draw a square\n\t// this prevents weird artifacting from carving circles when our points are really small\n\t// if strokeWeight is larger than 1, we just use it as is\n\n\tmask = mix(0.0, mask, clamp(floor(vStrokeWeight - 0.5),0.0,1.0));\n\n\t// throw away the borders of the mask\n    // otherwise we get weird alpha blending issues\n\n\tif(mask > 0.98){\n      discard;\n  \t}\n\n  \tgl_FragColor = vec4(uMaterialColor.rgb * (1.0 - mask), uMaterialColor.a) ;\n}"};a.RendererGL=function(e,t,n,i){return a.Renderer.call(this,e,t,n),this._setAttributeDefaults(t),this._initContext(),this.isP3D=!0,this.GL=this.drawingContext,this._enableLighting=!1,this.ambientLightColors=[],this.directionalLightDirections=[],this.directionalLightColors=[],this.pointLightPositions=[],this.pointLightColors=[],this.drawMode=o.FILL,this.curFillColor=[1,1,1,1],this.curStrokeColor=[0,0,0,1],this.curBlendMode=o.BLEND,this.blendExt=this.GL.getExtension("EXT_blend_minmax"),this._useSpecularMaterial=!1,this._useNormalMaterial=!1,this._useShininess=1,this._tint=[255,255,255,255],this.constantAttenuation=1,this.linearAttenuation=0,this.quadraticAttenuation=0,this.uMVMatrix=new a.Matrix,this.uPMatrix=new a.Matrix,this.uNMatrix=new a.Matrix("mat3"),this._curCamera=new a.Camera(this),this._curCamera._computeCameraDefaultSettings(),this._curCamera._setDefaultCamera(),this.gHash={},this._defaultLightShader=void 0,this._defaultImmediateModeShader=void 0,this._defaultNormalShader=void 0,this._defaultColorShader=void 0,this._defaultPointShader=void 0,this._pointVertexBuffer=this.GL.createBuffer(),this.userFillShader=void 0,this.userStrokeShader=void 0,this.userPointShader=void 0,this.isImmediateDrawing=!1,this.immediateMode={},this.pointSize=5,this.curStrokeWeight=1,this.textures=[],this.textureMode=o.IMAGE,this.textureWrapX=o.CLAMP,this.textureWrapY=o.CLAMP,this._tex=null,this._curveTightness=6,this._lookUpTableBezier=[],this._lookUpTableQuadratic=[],this._lutBezierDetail=0,this._lutQuadraticDetail=0,this._tessy=this._initTessy(),this.fontInfos={},this},a.RendererGL.prototype=Object.create(a.Renderer.prototype),a.RendererGL.prototype._setAttributeDefaults=function(e){var t={alpha:!0,depth:!0,stencil:!0,antialias:!1,premultipliedAlpha:!1,preserveDrawingBuffer:!0,perPixelLighting:!1};null===e._glAttributes?e._glAttributes=t:e._glAttributes=Object.assign(t,e._glAttributes)},a.RendererGL.prototype._initContext=function(){try{if(this.drawingContext=this.canvas.getContext("webgl",this._pInst._glAttributes)||this.canvas.getContext("experimental-webgl",this._pInst._glAttributes),null===this.drawingContext)throw new Error("Error creating webgl context");var e=this.drawingContext;e.enable(e.DEPTH_TEST),e.depthFunc(e.LEQUAL),e.viewport(0,0,e.drawingBufferWidth,e.drawingBufferHeight),this._viewport=this.drawingContext.getParameter(this.drawingContext.VIEWPORT)}catch(t){throw t}},a.RendererGL.prototype._resetContext=function(e,t){var n=this.width,o=this.height,i=this.canvas.id,r=this._pInst instanceof a.Graphics;if(r){var s=this._pInst;s.canvas.parentNode.removeChild(s.canvas),s.canvas=document.createElement("canvas"),(s._pInst._userNode||document.body).appendChild(s.canvas),a.Element.call(s,s.canvas,s._pInst),s.width=n,s.height=o}else{var l=this.canvas;l&&l.parentNode.removeChild(l),(l=document.createElement("canvas")).id=i,this._pInst._userNode?this._pInst._userNode.appendChild(l):document.body.appendChild(l),this._pInst.canvas=l}var p=new a.RendererGL(this._pInst.canvas,this._pInst,!r);this._pInst._setProperty("_renderer",p),p.resize(n,o),p._applyDefaults(),r||this._pInst._elements.push(p),"function"==typeof t&&setTimeout(function(){t.apply(window._renderer,e)},0)},a.prototype.setAttributes=function(e,t){if(void 0!==this._glAttributes){var n=!0;if(void 0!==t?(null===this._glAttributes&&(this._glAttributes={}),this._glAttributes[e]!==t&&(this._glAttributes[e]=t,n=!1)):e instanceof Object&&this._glAttributes!==e&&(this._glAttributes=e,n=!1),this._renderer.isP3D&&!n){if(!this._setupDone)for(var a in this._renderer.gHash)if(this._renderer.gHash.hasOwnProperty(a))return void console.error("Sorry, Could not set the attributes, you need to call setAttributes() before calling the other drawing methods in setup()");this.push(),this._renderer._resetContext(),this.pop(),this._renderer._curCamera&&(this._renderer._curCamera._renderer=this._renderer)}}else console.log("You are trying to use setAttributes on a p5.Graphics object that does not use a WEBGL renderer.")},a.RendererGL.prototype._update=function(){this.uMVMatrix.set(this._curCamera.cameraMatrix.mat4[0],this._curCamera.cameraMatrix.mat4[1],this._curCamera.cameraMatrix.mat4[2],this._curCamera.cameraMatrix.mat4[3],this._curCamera.cameraMatrix.mat4[4],this._curCamera.cameraMatrix.mat4[5],this._curCamera.cameraMatrix.mat4[6],this._curCamera.cameraMatrix.mat4[7],this._curCamera.cameraMatrix.mat4[8],this._curCamera.cameraMatrix.mat4[9],this._curCamera.cameraMatrix.mat4[10],this._curCamera.cameraMatrix.mat4[11],this._curCamera.cameraMatrix.mat4[12],this._curCamera.cameraMatrix.mat4[13],this._curCamera.cameraMatrix.mat4[14],this._curCamera.cameraMatrix.mat4[15]),this.ambientLightColors.length=0,this.directionalLightDirections.length=0,this.directionalLightColors.length=0,this.pointLightPositions.length=0,this.pointLightColors.length=0,this._enableLighting=!1,this._tint=[255,255,255,255]},a.RendererGL.prototype.background=function(){var e=this._pInst.color.apply(this._pInst,arguments),t=e.levels[0]/255,n=e.levels[1]/255,a=e.levels[2]/255,o=e.levels[3]/255;this.GL.clearColor(t,n,a,o),this.GL.depthMask(!0),this.GL.clear(this.GL.COLOR_BUFFER_BIT|this.GL.DEPTH_BUFFER_BIT),this._pixelsState._pixelsDirty=!0},a.RendererGL.prototype.fill=function(e,t,n,i){var r=a.prototype.color.apply(this._pInst,arguments);this.curFillColor=r._array,this.drawMode=o.FILL,this._useNormalMaterial=!1,this._tex=null},a.RendererGL.prototype.stroke=function(e,t,n,o){arguments[3]=255;var i=a.prototype.color.apply(this._pInst,arguments);this.curStrokeColor=i._array},a.RendererGL.prototype.strokeCap=function(e){console.error("Sorry, strokeCap() is not yet implemented in WEBGL mode")},a.RendererGL.prototype.blendMode=function(e){e===o.DARKEST||e===o.LIGHTEST||e===o.ADD||e===o.BLEND||e===o.SUBTRACT||e===o.SCREEN||e===o.EXCLUSION||e===o.REPLACE||e===o.MULTIPLY?this.curBlendM
21ode=e:e!==o.BURN&&e!==o.OVERLAY&&e!==o.HARD_LIGHT&&e!==o.SOFT_LIGHT&&e!==o.DODGE||console.warn("BURN, OVERLAY, HARD_LIGHT, SOFT_LIGHT, and DODGE only work for blendMode in 2D mode.")},a.RendererGL.prototype.strokeWeight=function(e){this.curStrokeWeight!==e&&(this.pointSize=e,this.curStrokeWeight=e)},a.RendererGL.prototype._getPixel=function(e,t){var n,a,o=this._pixelsState;return o._pixelsDirty?(n=new Uint8Array(4),this.drawingContext.readPixels(e,t,1,1,this.drawingContext.RGBA,this.drawingContext.UNSIGNED_BYTE,n),a=0):(n=o.pixels,a=4*(Math.floor(e)+Math.floor(t)*this.canvas.width)),[n[a+0],n[a+1],n[a+2],n[a+3]]},a.RendererGL.prototype.loadPixels=function(){var e=this._pixelsState;if(e._pixelsDirty)if(e._pixelsDirty=!1,!0===this._pInst._glAttributes.preserveDrawingBuffer){var t=e.pixels,n=this.GL.drawingBufferWidth*this.GL.drawingBufferHeight*4;t instanceof Uint8Array&&t.length===n||(t=new Uint8Array(n),this._pixelsState._setProperty("pixels",t));var a=this._pInst._pixelDensity;this.GL.readPixels(0,0,this.width*a,this.height*a,this.GL.RGBA,this.GL.UNSIGNED_BYTE,t)}else console.log("loadPixels only works in WebGL when preserveDrawingBuffer is true.")},a.RendererGL.prototype.geometryInHash=function(e){return void 0!==this.gHash[e]},a.RendererGL.prototype.resize=function(e,t){a.Renderer.prototype.resize.call(this,e,t),this.GL.viewport(0,0,this.GL.drawingBufferWidth,this.GL.drawingBufferHeight),this._viewport=this.GL.getParameter(this.GL.VIEWPORT),this._curCamera._resize();var n=this._pixelsState;n._pixelsDirty=!0,void 0!==n.pixels&&n._setProperty("pixels",new Uint8Array(this.GL.drawingBufferWidth*this.GL.drawingBufferHeight*4))},a.RendererGL.prototype.clear=function(){var e=arguments[0]||0,t=arguments[1]||0,n=arguments[2]||0,a=arguments[3]||0;this.GL.clearColor(e,t,n,a),this.GL.clear(this.GL.COLOR_BUFFER_BIT|this.GL.DEPTH_BUFFER_BIT),this._pixelsState._pixelsDirty=!0},a.RendererGL.prototype.applyMatrix=function(e,t,n,o,i,r){16===arguments.length?a.Matrix.prototype.apply.apply(this.uMVMatrix,arguments):this.uMVMatrix.apply([e,t,0,0,n,o,0,0,0,0,1,0,i,r,0,1])},a.RendererGL.prototype.translate=function(e,t,n){return e instanceof a.Vector&&(n=e.z,t=e.y,e=e.x),this.uMVMatrix.translate([e,t,n]),this},a.RendererGL.prototype.scale=function(e,t,n){return this.uMVMatrix.scale(e,t,n),this},a.RendererGL.prototype.rotate=function(e,t){return void 0===t?this.rotateZ(e):(a.Matrix.prototype.rotate.apply(this.uMVMatrix,arguments),this)},a.RendererGL.prototype.rotateX=function(e){return this.rotate(e,1,0,0),this},a.RendererGL.prototype.rotateY=function(e){return this.rotate(e,0,1,0),this},a.RendererGL.prototype.rotateZ=function(e){return this.rotate(e,0,0,1),this},a.RendererGL.prototype.push=function(){var e=a.Renderer.prototype.push.apply(this),t=e.properties;return t.uMVMatrix=this.uMVMatrix.copy(),t.uPMatrix=this.uPMatrix.copy(),t._curCamera=this._curCamera,this._curCamera=this._curCamera.copy(),t.ambientLightColors=this.ambientLightColors.slice(),t.directionalLightDirections=this.directionalLightDirections.slice(),t.directionalLightColors=this.directionalLightColors.slice(),t.pointLightPositions=this.pointLightPositions.slice(),t.pointLightColors=this.pointLightColors.slice(),t.userFillShader=this.userFillShader,t.userStrokeShader=this.userStrokeShader,t.userPointShader=this.userPointShader,t.pointSize=this.pointSize,t.curStrokeWeight=this.curStrokeWeight,t.curStrokeColor=this.curStrokeColor,t.curFillColor=this.curFillColor,t._useSpecularMaterial=this._useSpecularMaterial,t._useShininess=this._useShininess,t.constantAttenuation=this.constantAttenuation,t.linearAttenuation=this.linearAttenuation,t.quadraticAttenuation=this.quadraticAttenuation,t._enableLighting=this._enableLighting,t._useNormalMaterial=this._useNormalMaterial,t._tex=this._tex,t.drawMode=this.drawMode,e},a.RendererGL.prototype.resetMatrix=function(){return this.uMVMatrix=a.Matrix.identity(this._pInst),this},a.RendererGL.prototype._getImmediateStrokeShader=function(){var e=this.userStrokeShader;return e&&e.isStrokeShader()?e:this._getLineShader()},a.RendererGL.prototype._getRetainedStrokeShader=a.RendererGL.prototype._getImmediateStrokeShader,a.RendererGL.prototype._getImmediateFillShader=function(){if(this._useNormalMaterial)return console.log("Sorry, normalMaterial() does not currently work with custom WebGL geometry created with beginShape(). Falling back to standard fill material."),this._getImmediateModeShader();var e=this.userFillShader;if(this._enableLighting){if(!e||!e.isLightShader())return this._getLightShader()}else if(this._tex){if(!e||!e.isTextureShader())return this._getLightShader()}else if(!e)return this._getImmediateModeShader();return e},a.RendererGL.prototype._getRetainedFillShader=function(){if(this._useNormalMaterial)return this._getNormalShader();var e=this.userFillShader;if(this._enableLighting){if(!e||!e.isLightShader())return this._getLightShader()}else if(this._tex){if(!e||!e.isTextureShader())return this._getLightShader()}else if(!e)return this._getColorShader();return e},a.RendererGL.prototype._getImmediatePointShader=function(){var e=this.userPointShader;return e&&e.isPointShader()?e:this._getPointShader()},a.RendererGL.prototype._getRetainedLineShader=a.RendererGL.prototype._getImmediateLineShader,a.RendererGL.prototype._getLightShader=function(){return this._defaultLightShader||(this._pInst._glAttributes.perPixelLighting?this._defaultLightShader=new a.Shader(this,s.phongVert,s.phongFrag):this._defaultLightShader=new a.Shader(this,s.lightVert,s.lightTextureFrag)),this._defaultLightShader}
21,a.RendererGL.prototype._getImmediateModeShader=function(){return this._defaultImmediateModeShader||(this._defaultImmediateModeShader=new a.Shader(this,s.immediateVert,s.vertexColorFrag)),this._defaultImmediateModeShader},a.RendererGL.prototype._getNormalShader=function(){return this._defaultNormalShader||(this._defaultNormalShader=new a.Shader(this,s.normalVert,s.normalFrag)),this._defaultNormalShader},a.RendererGL.prototype._getColorShader=function(){return this._defaultColorShader||(this._defaultColorShader=new a.Shader(this,s.normalVert,s.basicFrag)),this._defaultColorShader},a.RendererGL.prototype._getPointShader=function(){return this._defaultPointShader||(this._defaultPointShader=new a.Shader(this,s.pointVert,s.pointFrag)),this._defaultPointShader},a.RendererGL.prototype._getLineShader=function(){return this._defaultLineShader||(this._defaultLineShader=new a.Shader(this,s.lineVert,s.lineFrag)),this._defaultLineShader},a.RendererGL.prototype._getFontShader=function(){return this._defaultFontShader||(this.GL.getExtension("OES_standard_derivatives"),this._defaultFontShader=new a.Shader(this,s.fontVert,s.fontFrag)),this._defaultFontShader},a.RendererGL.prototype._getEmptyTexture=function(){if(!this._emptyTexture){var e=new a.Image(1,1);e.set(0,0,255),this._emptyTexture=new a.Texture(this,e)}return this._emptyTexture},a.RendererGL.prototype.getTexture=function(e){for(var t=this.textures,n=0;n<t.length;++n){var o=t[n];if(o.src===e)return o}var i=new a.Texture(this,e);return t.push(i),i},a.RendererGL.prototype._setStrokeUniforms=function(e){e.bindShader(),e.setUniform("uMaterialColor",this.curStrokeColor),e.setUniform("uStrokeWeight",this.curStrokeWeight)},a.RendererGL.prototype._setFillUniforms=function(e){e.bindShader(),e.setUniform("uMaterialColor",this.curFillColor),e.setUniform("isTexture",!!this._tex),this._tex&&e.setUniform("uSampler",this._tex),e.setUniform("uTint",this._tint),e.setUniform("uSpecular",this._useSpecularMaterial),e.setUniform("uShininess",this._useShininess),e.setUniform("uUseLighting",this._enableLighting);var t=this.pointLightColors.length/3;e.setUniform("uPointLightCount",t),e.setUniform("uPointLightLocation",this.pointLightPositions),e.setUniform("uPointLightColor",this.pointLightColors);var n=this.directionalLightColors.length/3;e.setUniform("uDirectionalLightCount",n),e.setUniform("uLightingDirection",this.directionalLightDirections),e.setUniform("uDirectionalColor",this.directionalLightColors);var a=this.ambientLightColors.length/3;e.setUniform("uAmbientLightCount",a),e.setUniform("uAmbientColor",this.ambientLightColors),e.setUniform("uConstantAttenuation",this.constantAttenuation),e.setUniform("uLinearAttenuation",this.linearAttenuation),e.setUniform("uQuadraticAttenuation",this.quadraticAttenuation),e.bindTextures()},a.RendererGL.prototype._setPointUniforms=function(e){e.bindShader(),e.setUniform("uMaterialColor",this.curStrokeColor),e.setUniform("uPointSize",this.pointSize)},a.RendererGL.prototype._bindBuffer=function(e,t,n,a,o){if(t||(t=this.GL.ARRAY_BUFFER),this.GL.bindBuffer(t,e),void 0!==n){var i=new(a||Float32Array)(n);this.GL.bufferData(t,i,o||this.GL.STATIC_DRAW)}},a.RendererGL.prototype._flatten=function(e){if(0===e.length)return[];if(e.length>2e4){var t,n=Object.prototype.toString,a=[],o=e.slice();t=o.pop();do{"[object Array]"===n.call(t)?o.push.apply(o,t):a.push(t)}while(o.length&&void 0!==(t=o.pop()));return a.reverse(),a}return[].concat.apply([],e)},a.RendererGL.prototype._vToNArray=function(e){for(var t=[],n=0;n<e.length;n++){var a=e[n];t.push(a.x,a.y,a.z)}return t},a.prototype._assert3d=function(e){if(!this._renderer.isP3D)throw new Error(e+"() is only supported in WEBGL mode. If you'd like to use 3D graphics and WebGL, see  https://p5js.org/examples/form-3d-primitives.html for more information.")},a.RendererGL.prototype._initTessy=function(){var e=new i.GluTesselator;return e.gluTessCallback(i.gluEnum.GLU_TESS_VERTEX_DATA,function(e,t){t[t.length]=e[0],t[t.length]=e[1],t[t.length]=e[2]}),e.gluTessCallback(i.gluEnum.GLU_TESS_BEGIN,function(e){e!==i.primitiveType.GL_TRIANGLES&&console.log("expected TRIANGLES but got type: "+e)}),e.gluTessCallback(i.gluEnum.GLU_TESS_ERROR,function(e){console.log("error callback"),
21console.log("error number: "+e)}),e.gluTessCallback(i.gluEnum.GLU_TESS_COMBINE,function(e,t,n){return[e[0],e[1],e[2]]}),e.gluTessCallback(i.gluEnum.GLU_TESS_EDGE_FLAG,function(e){}),e},a.RendererGL.prototype._triangulate=function(e){this._tessy.gluTessNormal(0,0,1);var t=[];this._tessy.gluTessBeginPolygon(t);for(var n=0;n<e.length;n++){this._tessy.gluTessBeginContour();for(var a=e[n],o=0;o<a.length;o+=3){var i=[a[o],a[o+1],a[o+2]];this._tessy.gluTessVertex(i,i)}this._tessy.gluTessEndContour()}return this._tessy.gluTessEndPolygon(),t},a.RendererGL.prototype._bezierCoefficients=function(e){var t=e*e,n=1-e,a=n*n;return[a*n,3*a*e,3*n*t,t*e]},a.RendererGL.prototype._quadraticCoefficients=function(e){var t=1-e;return[t*t,2*t*e,e*e]},a.RendererGL.prototype._bezierToCatmull=function(e){return[e[1],e[1]+(e[2]-e[0])/this._curveTightness,e[2]-(e[3]-e[1])/this._curveTightness,e[2]]},t.exports=a.RendererGL},{"../core/constants":18,"../core/main":24,"../core/p5.Renderer":27,"./p5.Camera":70,"./p5.Matrix":72,"./p5.Shader":76,libtess:9}],76:[function(e,t,n){"use strict";var a=e("../core/main");a.Shader=function(e,t,n){this._renderer=e,this._vertSrc=t,this._fragSrc=n,this._vertShader=-1,this._fragShader=-1,this._glProgram=0,this._loadedAttributes=!1,this.attributes={},this._loadedUniforms=!1,this.uniforms={},this._bound=!1,this.samplers=[]},a.Shader.prototype.init=function(){if(0===this._glProgram){var e=this._renderer.GL;if(this._vertShader=e.createShader(e.VERTEX_SHADER),e.shaderSource(this._vertShader,this._vertSrc),e.compileShader(this._vertShader),!e.getShaderParameter(this._vertShader,e.COMPILE_STATUS))return console.error("Yikes! An error occurred compiling the vertex shader:"+e.getShaderInfoLog(this._vertShader)),null;if(this._fragShader=e.createShader(e.FRAGMENT_SHADER),e.shaderSource(this._fragShader,this._fragSrc),e.compileShader(this._fragShader),!e.getShaderParameter(this._fragShader,e.COMPILE_STATUS))return console.error("Darn! An error occurred compiling the fragment shader:"+e.getShaderInfoLog(this._fragShader)),null;this._glProgram=e.createProgram(),e.attachShader(this._glProgram,this._vertShader),e.attachShader(this._glProgram,this._fragShader),e.linkProgram(this._glProgram),e.getProgramParameter(this._glProgram,e.LINK_STATUS)||console.error("Snap! Error linking shader program: "+e.getProgramInfoLog(this._glProgram)),this._loadAttributes(),this._loadUniforms()}return this},a.Shader.prototype._loadAttributes=function(){if(!this._loadedAttributes){this.attributes={};for(var e=this._renderer.GL,t=e.getProgramParameter(this._glProgram,e.ACTIVE_ATTRIBUTES),n=0;n<t;++n){var a=e.getActiveAttrib(this._glProgram,n),o=a.name,i=e.getAttribLocation(this._glProgram,o),r={};r.name=o,r.location=i,r.index=n,r.type=a.type,r.size=a.size,this.attributes[o]=r}this._loadedAttributes=!0}},a.Shader.prototype._loadUniforms=function(){if(!this._loadedUniforms){for(var e=this._renderer.GL,t=e.getProgramParameter(this._glProgram,e.ACTIVE_UNIFORMS),n=0,a=0;a<t;++a){var o=e.getActiveUniform(this._glProgram,a),i={};i.location=e.getUniformLocation(this._glProgram,o.name),i.size=o.size;var r=o.name;o.size>1&&(r=r.substring(0,r.indexOf("[0]"))),i.name=r,i.type=o.type,i.type===e.SAMPLER_2D&&(i.samplerIndex=n,n++,this.samplers.push(i)),this.uniforms[r]=i}this._loadedUniforms=!0}},a.Shader.prototype.compile=function(){},a.Shader.prototype.bindShader=function(){this.init(),this._bound||(this.useProgram(),this._bound=!0,this._setMatrixUniforms(),this.setUniform("uViewport",this._renderer._viewport))},a.Shader.prototype.unbindShader=function(){return this._bound&&(this.unbindTextures(),this._bound=!1),this},a.Shader.prototype.bindTextures=function(){for(var e=this._renderer.GL,t=0;t<this.samplers.length;t++){var n=this.samplers[t],a=n.texture;void 0===a&&(a=this._renderer._getEmptyTexture()),e.activeTexture(e.TEXTURE0+n.samplerIndex),a.bindTexture(),a.update(),e.uniform1i(n.location,n.samplerIndex)}},a.Shader.prototype.updateTextures=function(){for(var e=0;e<this.samplers.length;e++){var t=this.samplers[e].texture;t&&t.update()}},a.Shader.prototype.unbindTextures=function(){},a.Shader.prototype._setMatrixUniforms=function(){this.setUniform("uProjectionMatrix",this._renderer.uPMatrix.mat4),this.setUniform("uModelViewMatrix",this._renderer.uMVMatrix.mat4),this.setUniform("uViewMatrix",this._renderer._curCamera.cameraMatrix.mat4),this.uniforms.uNormalMatrix&&(this._renderer.uNMatrix.inverseTranspose(this._renderer.uMVMatrix),this.setUniform("uNormalMatrix",this._renderer.uNMatrix.mat3))},a.Shader.prototype.useProgram=function(){return this._renderer.GL.useProgram(this._glProgram),this},a.Shader.prototype.setUniform=function(e,t){var n=this.uniforms[e];if(n){var a=n.location,o=this._renderer.GL;switch(this.useProgram(),n.type){case o.BOOL:!0===t?o.uniform1i(a,1):o.uniform1i(a,0);break;case o.INT:n.size>1?t.length&&o.uniform1iv(a,t):o.uniform1i(a,t);break;case o.FLOAT:n.size>1?t.length&&o.uniform1fv(a,t):o.uniform1f(a,t);break;case o.FLOAT_MAT3:o.uniformMatrix3fv(a,!1,t);break;case o.FLOAT_MAT4:o.uniformMatrix4fv(a,!1,t);break;case o.FLOAT_VEC2:n.size>1?t.length&&o.uniform2fv(a,t):o.uniform2f(a,t[0],t[1]);break;case o.FLOAT_VEC3:n.size>1?t.length&&o.uniform3fv(a,t):o.uniform3f(a,t[0],t[1],t[2]);break;case o.FLOAT_VEC4:n.size>1?t.length&&o.uniform4fv(a,t):o.uniform4f(a,t[0],t[1],t[2],t[3]);break;case o.INT_VEC2:n.size>1?t.length&&o.uniform2iv(a,t):o.uniform2i(a,t[0],t[1]);break;case o.INT_VEC3:n.size>1?t.length&&o.uniform3iv(a,t):o.uniform3i(a,t[0],t[1],t[2]);break;case o.INT_VEC4:n.size>1?t.length&&o.uniform4iv(a,t):o.uniform4i(a,t[0],t[1],t[2],t[3]);break;case o.SAMPLER_2D:o.activeTexture(o.TEXTURE0+n.samplerIndex),n.texture=this._renderer.getTexture(t),o.uniform1i(n.location,n.samplerIndex)}return this}},a.Shader.prototype.isLightShader=function(){return void 0!==this.attributes.aNormal||void 0!==this.uniforms.uUseLighting||void 0!==this.uniforms.uAmbientLightCount||void 0!==this.uniforms.uDirectionalLightCount||void 0!==this.uniforms.uPointLightCount||void 0!==this.uniforms.uAmbientColor||void 0!==this.uniforms.uDirectionalColor||void 0!==this.uniforms.uPointLightLocation||void 0!==this.uniforms.uPointLightColor||void 0!==this.uniforms.uLightingDirection||void 0!==this.uniforms.uSpecular},a.Shader.prototype.isTextureShader=function(){return this.samplerIndex>0},a.Shader.prototype.isColorShader=function(){return void 0!==this.attributes.aVertexColor||void 0!==this.uniforms.uMaterialColor},a.Shader.prototype.isTexLightShader=function(){return this.isLightShader()&&this.isTextureShader()},a.Shader.prototype.isStrokeShader=function(){return void 0!==this.uniforms.uStrokeWeight},a.Shader.prototype.enableAttrib=function(e,t,n,a,o,i){if(e){"undefined"==typeof IS_MINIFIED&&this.attributes[e.name]!==e&&console.warn('The attribute "'+e.name+'"passed to enableAttrib does not belong to this shader.');var r=e.location;if(-1!==r){var s=this._renderer.GL;s.enableVertexAttribArray(r),s.vertexAttribPointer(r,t,n||s.FLOAT,a||!1,o||0,i||0)}}return this},t.exports=a.Shader},{"../core/main":24}],77:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("../core/constants");a.Texture=function(e,t){this._renderer=e;var n=this._renderer.GL;this.src=t,this.glTex=void 0,this.glTarget=n.TEXTURE_2D,this.glFormat=n.RGBA,this.mipmaps=!1,this.glMinFilter=n.LINEAR,this.glMagFilter=n.LINEAR,this.glWrapS=n.CLAMP_TO_EDGE,this.glWrapT=n.CLAMP_TO_EDGE,this.isSrcMediaElement=void 0!==a.MediaElement&&t instanceof a.MediaElement,this._videoPrevUpdateTime=0,this.isSrcHTMLElement=void 0!==a.Element&&t instanceof a.Element&&!(t instanceof a.Graphics),this.isSrcP5Image=t instanceof a.Image,this.isSrcP5Graphics=t instanceof a.Graphics,this.isImageData="undefined"!=typeof ImageData&&t instanceof ImageData;var o=this._getTextureDataFromSource();return this.width=o.width,this.height=o.height,this.init(o),this},a.Texture.prototype._getTextureDataFromSource=function(){var e;return this.isSrcP5Image?e=this.src.canvas:this.isSrcMediaElement||this.isSrcP5Graphics||this.isSrcHTMLElement?e=this.src.elt:this.isImageData&&(e=this.src),e},a.Texture.prototype.init=function(e){var t=this._renderer.GL;if(this.glTex=t.createTexture(),this.glWrapS=this._renderer.textureWrapX,this.glWrapT=this._renderer.textureWrapY,this.setWrapMode(this.glWrapS,this.glWrapT),this.bindTexture(),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,this.glMagFilter),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,this.glMinFilter),0===this.width||0===this.height||this.isSrcMediaElement&&!this.src.loadedmetadata){var n=new Uint8Array([1,1,1,1]);t.texImage2D(this.glTarget,0,t.RGBA,1,1,0,this.glFormat,t.UNSIGNED_BYTE,n)}else t.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,t.UNSIGNED_BYTE,e)},a.Texture.prototype.update=function(){var e=this.src;if(0===e.width||0===e.height)return!1;var t=this._getTextureDataFromSource(),n=!1,a=this._renderer.GL;return t.width!==this.width||t.height!==this.height?(n=!0,this.width=t.width,this.height=t.height,this.isSrcP5Image?e.setModified(!1):(this.isSrcMediaElement||this.isSrcHTMLElement)&&e.setModified(!0)):this.isSrcP5Image?e.isModified()&&(n=!0,e.setModified(!1)):this.isSrcMediaElement?e.
21isModified()?(n=!0,e.setModified(!1)):e.loadedmetadata&&this._videoPrevUpdateTime!==e.time()&&(this._videoPrevUpdateTime=e.time(),n=!0):this.isImageData?e._dirty&&(e._dirty=!1,n=!0):n=!0,n&&(this.bindTexture(),a.texImage2D(this.glTarget,0,this.glFormat,this.glFormat,a.UNSIGNED_BYTE,t)),n},a.Texture.prototype.bindTexture=function(){return this._renderer.GL.bindTexture(this.glTarget,this.glTex),this},a.Texture.prototype.unbindTexture=function(){this._renderer.GL.bindTexture(this.glTarget,null)},a.Texture.prototype.setInterpolation=function(e,t){var n=this._renderer.GL;e===o.NEAREST?this.glMinFilter=n.NEAREST:this.glMinFilter=n.LINEAR,t===o.NEAREST?this.glMagFilter=n.NEAREST:this.glMagFilter=n.LINEAR,this.bindTexture(),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MIN_FILTER,this.glMinFilter),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_MAG_FILTER,this.glMagFilter),this.unbindTexture()},a.Texture.prototype.setWrapMode=function(e,t){var n=this._renderer.GL,a=function(e){return 0==(e&e-1)},i=a(this.width),r=a(this.height);e===o.REPEAT?i&&r?this.glWrapS=n.REPEAT:(console.warn("You tried to set the wrap mode to REPEAT but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapS=n.CLAMP_TO_EDGE):e===o.MIRROR?i&&r?this.glWrapS=n.MIRRORED_REPEAT:(console.warn("You tried to set the wrap mode to MIRROR but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapS=n.CLAMP_TO_EDGE):this.glWrapS=n.CLAMP_TO_EDGE,t===o.REPEAT?i&&r?this.glWrapT=n.REPEAT:(console.warn("You tried to set the wrap mode to REPEAT but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapT=n.CLAMP_TO_EDGE):t===o.MIRROR?i&&r?this.glWrapT=n.MIRRORED_REPEAT:(console.warn("You tried to set the wrap mode to MIRROR but the texture size is not a power of two. Setting to CLAMP instead"),this.glWrapT=n.CLAMP_TO_EDGE):this.glWrapT=n.CLAMP_TO_EDGE,this.bindTexture(),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_S,this.glWrapS),n.texParameteri(n.TEXTURE_2D,n.TEXTURE_WRAP_T,this.glWrapT),this.unbindTexture()},t.exports=a.Texture},{"../core/constants":18,"../core/main":24}],78:[function(e,t,n){"use strict";var a=e("../core/main"),o=e("../core/constants");e("./p5.Shader"),e("./p5.RendererGL.Retained"),a.RendererGL.prototype._applyTextProperties=function(){},a.RendererGL.prototype.textWidth=function(e){return this._isOpenType()?this._textFont._textWidth(e,this._textSize):0};var i=9,r=i;function s(e,t){this.width=e,this.height=t,this.infos=[],this.findImage=function(e){var t,n,a=this.width*this.height;if(e>a)throw new Error("font is too complex to render in 3D");for(var o=this.infos.length-1;o>=0;--o){var i=this.infos[o];if(i.index+e<a){t=i,n=i.imageData;break}}if(!t){try{n=new ImageData(this.width,this.height)}catch(d){var r=document.getElementsByTagName("canvas")[0],s=!r;r||((r=document.createElement("canvas")).style.display="none",document.body.appendChild(r));var l=r.getContext("2d");l&&(n=l.createImageData(this.width,this.height)),s&&document.body.removeChild(r)}t={index:0,imageData:n},this.infos.push(t)}var p=t.index;return t.index+=e,n._dirty=!0,{imageData:n,index:p}}}function l(e,t,n,a,o){var i=e.imageData.data,r=4*e.index++;i[r++]=t,i[r++]=n,i[r++]=a,i[r++]=o}var p=Math.sqrt(3),d=function(e){this.font=e,this.strokeImageInfos=new s(64,64),this.colDimImageInfos=new s(64,64),this.rowDimImageInfos=new s(64,64),this.colCellImageInfos=new s(64,64),this.rowCellImageInfos=new s(64,64),this.glyphInfos={},this.getGlyphInfo=function(e){var t=this.glyphInfos[e.index];if(t)return t;var n,o=e.getBoundingBox(),s=o.x1,d=o.y1,c=o.x2-s,u=o.y2-d,m=e.path.commands;if(0===c||0===u||!m.length)return this.glyphInfos[e.index]={};var h,f,g,y,v=[],b=[],w=[];for(n=i-1;n>=0;--n)w.push([]);for(n=r-1;n>=0;--n)b.push([]);function x(e,t,n){var a=v.length;function o(e,t,n){for(var a=e.length;a-- >0;){var o=e[a];t>o&&(t=o),n<o&&(n=o)}return{min:t,max:n}}v.push(n);for(var s=o(e,1,0),l=Math.max(Math.floor(s.min*i),0),p=Math.min(Math.ceil(s.max*i),i),d=l;d<p;++d)w[d].push(a);for(var c=o(t,1,0),u=Math.max(Math.floor(c.min*r),0),m=Math.min(Math.ceil(c.max*r),r),h=u;h<m;++h)b[h].push(a)}function S(e){return function(e,t,n){return e<t?t:e>n?n:e}(255*e,0,255)}function k(e,t,n,o){this.p0=e,this.c0=t,this.c1=n,this.p1=o,this.toQuadratic=function(){return{x:this.p0.x,y:this.p0.y,x1:this.p1.x,y1:this.p1.y,cx:(3*(this.c0.x+this.c1.x)-(this.p0.x+this.p1.x))/4,cy:(3*(this.c0.y+this.c1.y)-(this.p0.y+this.p1.y))/4}},this.quadError=function(){return a.Vector.sub(a.Vector.sub(this.p1,this.p0),a.Vector.mult(a.Vector.sub(this.c1,this.c0),3)).mag()/2},this.split=function(e){var t=a.Vector.lerp(this.p0,this.c0,e),n=a.Vector.lerp(this.c0,this.c1,e),o=a.Vector.lerp(t,n,e);this.c1=a.Vector.lerp(this.c1,this.p1,e),this.c0=a.Vector.lerp(n,this.c1,e);var i=a.Vector.lerp(o,this.c0,e),r=new k(this.p0,t,o,i);return this.p0=i,r},this.splitInflections=function(){var e=a.Vector.sub(this.c0,this.p0),t=a.Vector.sub(a.Vector.sub(this.c1,this.c0),e),n=a.Vector.sub(a.Vector.sub(a.Vector.sub(this.p1,this.c1),e),a.Vector.mult(t,2)),o=[],i=t.x*n.y-t.y*n.x;if(0!==i){var r=e.x*n.y-e.y*n.x,s=e.x*t.y-e.y*t.x,l=r*r-4*i*s;if(l>=0){i<0&&(i=-i,r=-r,s=-s);var p=Math.sqrt(l),d=(-r-p)/(2*i),c=(-r+p)/(2*i);d>0&&d<1&&(o.push(this.split(d)),c=1-(1-c)/(1-d)),c>0&&c<1&&o.push(this.split(c))}}return o.push(this),o}}function T(e,t,n,o,i,r,s,l){for(var d=new k(new a.Vector(e,t),new a.Vector(n,o),new a.Vector(i,r),new a.Vector(s,l)).splitInflections(),c=[],u=30/p,m=0;m<d.length;m++){for(var h,f=d[m],g=[];!((h=u/f.quadError())>=.125);){var y=Math.pow(h,1/3),v=f.split(y),b=f.split(1-y/(1-y));c.push(v),g.push(f),f=b}h<1&&c.push(f.split(.5)),c.push(f),Array.prototype.push.apply(c,g.reverse())}return c}function C(e,t,n,a){x([e,n],[t,a],{x:e,y:t,cx:(e+n)/2,cy:(t+a)/2})}function _(e,t,n,a){return Math.abs(n-e)<1e-5&&Math.abs(a-t)<1e-5}for(var E=0;E<m.length;++E){var M=m[E],j=(M.x-s)/c,I=(M.y-d)/u;if(!_(h,f,j,I)){switch(M.type){case"M":g=j,y=I;break;case"L":C(h,f,j,I);break;case"Q":var R=(M.x1-s)/c,N=(M.y1-d)/u;x([h,j,R],[f,I,N],{x:h,y:f,cx:R,cy:N});break;case"Z":_(h,f,g,y)?v.push({x:h,y:f}):(C(h,f,g,y),v.push({x:g,y:y}));break;case"C":for(var A=T(h,f,(M.x1-s)/c,(M.y1-d)/u,(M.x2-s)/c,(M.y2-d)/u,j,I),D=0;D<A.length;D++){var L=A[D].toQuadratic();x([L.x,L.x1,L.cx],[L.y,L.y1,L.cy],L)}break;default:throw new Error("unknown command type: "+M.type)}h=j,f=I}}for(var P=v.length,O=this.strokeImageInfos.findImage(P),F=O.index,B=0;B<P;++B){var G=v[B];l(O,S(G.x),S(G.y),S(G.cx),S(G.cy))}function U(e,t,n){for(var a=e.length,o=t.findImage(a),i=o.index,r=0,s=0;s<a;++s)r+=e[s].length;for(var p=n.findImage(r),d=0;d<a;++d){var c=e[d],u=c.length,m=p.index;l(o,m>>7,127&m,u>>7,127&u);for(var h=0;h<u;++h){var f=c[h]+F;l(p,f>>7,127&f,0,0)}}return{cellImageInfo:p,dimOffset:i,dimImageInfo:o}}return(t=this.glyphInfos[e.index]={glyph:e,uGlyphRect:[o.x1,-o.y1,o.x2,-o.y2],strokeImageInfo:O,strokes:v,colInfo:U(w,this.colDimImageInfos,this.colCellImageInfos),rowInfo:U(b,this.rowDimImageInfos,this.rowCellImageInfos)}).uGridOffset=[t.colInfo.dimOffset,t.rowInfo.dimOffset],t}};a.RendererGL.prototype._renderText=function(e,t,n,s,l){if(this._textFont&&"string"!=typeof this._textFont){if(!(s>=l)&&this._doFill){if(!this._isOpenType())return console.log("WEBGL: only opentype fonts are supported"),e;e.push();var p=this._doStroke,c=this.drawMode;this._doStroke=!1,this.drawMode=o.TEXTURE;var u=this._textFont.font,m=this._textFont._fontInfo;m||(m=this._textFont._fontInfo=new d(u));var h=this._textFont._handleAlignment(this,t,n,s),f=this._textSize/u.unitsPerEm;this.translate(h.x,h.y,0),this.scale(f,f,1);var g=this.GL,y=!this._defaultFontShader,v=this._getFontShader();v.init(),v.bindShader(),y&&(v.setUniform("uGridImageSize",[64,64]),v.setUniform("uCellsImageSize",[64,64]),v.setUniform("uStrokeImageSize",[64,64]),v.setUniform("uGridSize",[i,r])),this._applyColorBlend(this.curFillColor);var b=this.gHash.glyph;if(!b){var w=this._textGeom=new a.Geometry(1,1,function(){for(var e=0;e<=1;e++)for(var t=0;t<=1;t++)this.vertices.push(new a.Vector(t,e,0)),this.uvs.push(t,e)});w.computeFaces().computeNormals(),b=this.createBuffers("glyph",w)}this._prepareBuffers(b,v,a.RendererGL._textBuffers),this._bindBuffer(b.indexBuffer,g.ELEMENT_ARRAY_BUFFER),v.setUniform("uMaterialColor",this.curFillColor);try{for(var x=0,S=null,k=u.stringToGlyphs(t),T=0;T<k.length;
21++T){var C=k[T];S&&(x+=u.getKerningValue(S,C));var _=m.getGlyphInfo(C);if(_.uGlyphRect){var E=_.rowInfo,M=_.colInfo;v.setUniform("uSamplerStrokes",_.strokeImageInfo.imageData),v.setUniform("uSamplerRowStrokes",E.cellImageInfo.imageData),v.setUniform("uSamplerRows",E.dimImageInfo.imageData),v.setUniform("uSamplerColStrokes",M.cellImageInfo.imageData),v.setUniform("uSamplerCols",M.dimImageInfo.imageData),v.setUniform("uGridOffset",_.uGridOffset),v.setUniform("uGlyphRect",_.uGlyphRect),v.setUniform("uGlyphOffset",x),v.bindTextures(),g.drawElements(g.TRIANGLES,6,this.GL.UNSIGNED_SHORT,0)}x+=C.advanceWidth,S=C}}finally{v.unbindShader(),this._doStroke=p,this.drawMode=c,e.pop()}return this._pixelsState._pixelsDirty=!0,e}}else console.log("WEBGL: you must load and set a font before drawing text. See `loadFont` and `textFont` for more details.")}},{"../core/constants":18,"../core/main":24,"./p5.RendererGL.Retained":74,"./p5.Shader":76}]},{},[13])(13)});
22},{"buffer":"aMB2","process":"g5I+"}],"CUYq":[function(require,module,exports) {
23var define;
24var t;!function(e,i){"function"==typeof t&&t.amd?t("p5.sound",["p5"],function(t){i(t)}):"object"==typeof exports?i(require("../p5")):i(e.p5)}(this,function(t){var e,i,n,o,s,r,a,u,c,h,p,l,f,d,m,y,v,_,g,T,b,x,S,w,A;(function(){!function(){function t(t){t&&(t.setTargetAtTime||(t.setTargetAtTime=t.setTargetValueAtTime))}window.hasOwnProperty("webkitAudioContext")&&!window.hasOwnProperty("AudioContext")&&(window.AudioContext=window.webkitAudioContext,"function"!=typeof AudioContext.prototype.createGain&&(AudioContext.prototype.createGain=AudioContext.prototype.createGainNode),"function"!=typeof AudioContext.prototype.createDelay&&(AudioContext.prototype.createDelay=AudioContext.prototype.createDelayNode),"function"!=typeof AudioContext.prototype.createScriptProcessor&&(AudioContext.prototype.createScriptProcessor=AudioContext.prototype.createJavaScriptNode),"function"!=typeof AudioContext.prototype.createPeriodicWave&&(AudioContext.prototype.createPeriodicWave=AudioContext.prototype.createWaveTable),AudioContext.prototype.internal_createGain=AudioContext.prototype.createGain,AudioContext.prototype.createGain=function(){var e=this.internal_createGain();return t(e.gain),e},AudioContext.prototype.internal_createDelay=AudioContext.prototype.createDelay,AudioContext.prototype.createDelay=function(e){var i=e?this.internal_createDelay(e):this.internal_createDelay();return t(i.delayTime),i},AudioContext.prototype.internal_createBufferSource=AudioContext.prototype.createBufferSource,AudioContext.prototype.createBufferSource=function(){var e=this.internal_createBufferSource();return e.start?(e.internal_start=e.start,e.start=function(t,i,n){void 0!==n?e.internal_start(t||0,i,n):e.internal_start(t||0,i||0)}):e.start=function(t,e,i){e||i?this.noteGrainOn(t||0,e,i):this.noteOn(t||0)},e.stop?(e.internal_stop=e.stop,e.stop=function(t){e.internal_stop(t||0)}):e.stop=function(t){this.noteOff(t||0)},t(e.playbackRate),e},AudioContext.prototype.internal_createDynamicsCompressor=AudioContext.prototype.createDynamicsCompressor,AudioContext.prototype.createDynamicsCompressor=function(){var e=this.internal_createDynamicsCompressor();return t(e.threshold),t(e.knee),t(e.ratio),t(e.reduction),t(e.attack),t(e.release),e},AudioContext.prototype.internal_createBiquadFilter=AudioContext.prototype.createBiquadFilter,AudioContext.prototype.createBiquadFilter=function(){var e=this.internal_createBiquadFilter();return t(e.frequency),t(e.detune),t(e.Q),t(e.gain),e},"function"!=typeof AudioContext.prototype.createOscillator&&(AudioContext.prototype.internal_createOscillator=AudioContext.prototype.createOscillator,AudioContext.prototype.createOscillator=function(){var e=this.internal_createOscillator();return e.start?(e.internal_start=e.start,e.start=function(t){e.internal_start(t||0)}):e.start=function(t){this.noteOn(t||0)},e.stop?(e.internal_stop=e.stop,e.stop=function(t){e.internal_stop(t||0)}):e.stop=function(t){this.noteOff(t||0)},e.setPeriodicWave||(e.setPeriodicWave=e.setWaveTable),t(e.frequency),t(e.detune),e})),window.hasOwnProperty("webkitOfflineAudioContext")&&!window.hasOwnProperty("OfflineAudioContext")&&(window.OfflineAudioContext=window.webkitOfflineAudioContext)}(window),navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia;var e=document.createElement("audio");t.prototype.isSupported=function(){return!!e.canPlayType};t.prototype.isFileSupported=function(t){switch(t.toLowerCase()){case"mp3":return!!e.canPlayType&&e.canPlayType("audio/mpeg;");case"wav":return!!e.canPlayType&&e.canPlayType('audio/wav; codecs="1"');case"ogg":return!!e.canPlayType&&e.canPlayType('audio/ogg; codecs="vorbis"');case"aac":case"m4a":case"mp4":return!!e.canPlayType&&(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/aac;"));case"aif":case"aiff":return!!e.canPlayType&&e.canPlayType("audio/x-aiff;");default:return!1}}})(),e=function(){var t=function(t,e){this._dragged=!1,this._element=t,this._bindedMove=this._moved.bind(this),this._bindedEnd=this._ended.bind(this,e),t.addEventListener("touchstart",this._bindedEnd),t.addEventListener("touchmove",this._bindedMove),t.addEventListener("touchend",this._bindedEnd),t.addEventListener("mouseup",this._bindedEnd)};function e(t){return"running"===t.state}return t.prototype._moved=function(t){this._dragged=!0},t.prototype._ended=function(t){this._dragged||function(t){var e=t.createBuffer(1,1,t.sampleRate),i=t.createBufferSource();i.buffer=e,i.connect(t.destination),i.start(0),t.resume&&t.resume()}(t),this._dragged=!1},t.prototype.dispose=function(){this._element.removeEventListener("touchstart",this._bindedEnd),this._element.removeEventListener("touchmove",this._bindedMove),this._element.removeEventListener("touchend",this._bindedEnd),this._element.removeEventListener("mouseup",this._bindedEnd),this._bindedMove=null,this._bindedEnd=null,this._element=null},function(i,n,o){var s=new Promise(function(t){!function(t,i){e(t)?i():function n(){e(t)?i():(requestAnimationFrame(n),t.resume&&t.resume())}()}(i,t)}),r=[];return n||(n=document.body),function e(i,n,o){if(Array.isArray(i)||NodeList&&i instanceof NodeList)for(var s=0;s<i.length;s++)e(i[s],n,o);else if("string"==typeof i)e(document.querySelectorAll(i),n,o);else if(i.jquery&&"function"==typeof i.toArray)e(i.toArray(),n,o);else if(Element&&i instanceof Element){var r=new t(i,o);n.push(r)}}(n,r,i),s.then(function(){for(var t=0;t<r.length;t++)r[t].dispose();r=null,o&&o()}),s}}(),function(t){"use strict";t.Emitter=function(){this._events={}},t.extend(t.Emitter),t.Emitter.prototype.on=function(t,e){for(var i=t.split(/\W+/),n=0;n<i.length;n++){var o=i[n];this._events.hasOwnProperty(o)||(this._events[o]=[]),this._events[o].push(e)}return this},t.Emitter.prototype.off=function(e,i){for(var n=e.split(/\W+/),o=0;o<n.length;o++)if(e=n[o],this._events.hasOwnProperty(e))if(t.prototype.isUndef(i))this._events[e]=[];else for(var s=this._events[e],r=0;r<s.length;r++)s[r]===i&&s.splice(r,1);return this},t.Emitter.prototype.emit=function(t){if(this._events){var e=Array.apply(null,arguments).slice(1);if(this._events.hasOwnProperty(t))for(var i=this._events[t],n=0,o=i.length;n<o;n++)i[n].apply(this,e)}return this},t.Emitter.mixin=function(e){var i=["on","off","emit"];e._events={};for(var n=0;n<i.length;n++){var o=i[n],s=t.Emitter.prototype[o];e[o]=s}},t.Emitter.prototype.dispose=function(){return t.prototype.dispose.call(this),this._events=null,this},t.Emitter}(i=function(){"use strict";var t,e=function(t,e){this.isUndef(t)||1===t?this.input=this.context.createGain():t>1&&(this.input=new Array(t)),this.isUndef(e)||1===e?this.output=this.context.createGain():e>1&&(this.output=new Array(t))};return e.prototype.set=function(t,i,n){if(this.isObject(t))n=i;else if(this.isString(t)){var o={};o[t]=i,t=o}t:for(var s in t){i=t[s];var r=this;if(-1!==s.indexOf(".")){for(var a=s.split("."),u=0;u<a.length-1;u++)if((r=r[a[u]])instanceof e){a.splice(0,u+1);var c=a.join(".");r.set(c,i);continue t}s=a[a.length-1]}var h=r[s];this.isUndef(h)||(e.Signal&&h instanceof e.Signal||e.Param&&h instanceof e.Param?h.value!==i&&(this.isUndef(n)?h.value=i:h.rampTo(i,n)):h instanceof AudioParam?h.value!==i&&(h.value=i):h instanceof e?h.set(i):h!==i&&(r[s]=i))}return this},e.prototype.get=function(t){this.isUndef(t)?t=this._collectDefaults(this.constructor):this.isString(t)&&(t=[t]);for(var i={},n=0;n<t.length;n++){var o=t[n],s=this,r=i;if(-1!==o.indexOf(".")){for(var a=o.split("."),u=0;u<a.length-1;u++){var c=a[u];r[c]=r[c]||{},r=r[c],s=s[c]}o=a[a.length-1]}var h=s[o];this.isObject(t[o])?r[o]=h.get():e.Signal&&h instanceof e.Signal?r[o]=h.value:e.Param&&h instanceof e.Param?r[o]=h.value:h instanceof AudioParam?r[o]=h.value:h instanceof e?r[o]=h.get():this.isFunction(h)||this.isUndef(h)||(r[o]=h)}return i},e.prototype._collectDefaults=function(t){var e=[];
24if(this.isUndef(t.defaults)||(e=Object.keys(t.defaults)),!this.isUndef(t._super))for(var i=this._collectDefaults(t._super),n=0;n<i.length;n++)-1===e.indexOf(i[n])&&e.push(i[n]);return e},e.prototype.toString=function(){for(var t in e){var i=t[0].match(/^[A-Z]$/),n=e[t]===this.constructor;if(this.isFunction(e[t])&&i&&n)return t}return"Tone"},Object.defineProperty(e.prototype,"numberOfInputs",{get:function(){return this.input?this.isArray(this.input)?this.input.length:1:0}}),Object.defineProperty(e.prototype,"numberOfOutputs",{get:function(){return this.output?this.isArray(this.output)?this.output.length:1:0}}),e.prototype.dispose=function(){return this.isUndef(this.input)||(this.input instanceof AudioNode&&this.input.disconnect(),this.input=null),this.isUndef(this.output)||(this.output instanceof AudioNode&&this.output.disconnect(),this.output=null),this},e.prototype.connect=function(t,e,i){return Array.isArray(this.output)?(e=this.defaultArg(e,0),this.output[e].connect(t,0,i)):this.output.connect(t,e,i),this},e.prototype.disconnect=function(t,e,i){this.isArray(this.output)?this.isNumber(t)?this.output[t].disconnect():(e=this.defaultArg(e,0),this.output[e].disconnect(t,0,i)):this.output.disconnect.apply(this.output,arguments)},e.prototype.connectSeries=function(){if(arguments.length>1)for(var t=arguments[0],e=1;e<arguments.length;e++){var i=arguments[e];t.connect(i),t=i}return this},e.prototype.chain=function(){if(arguments.length>0)for(var t=this,e=0;e<arguments.length;e++){var i=arguments[e];t.connect(i),t=i}return this},e.prototype.fan=function(){if(arguments.length>0)for(var t=0;t<arguments.length;t++)this.connect(arguments[t]);return this},AudioNode.prototype.chain=e.prototype.chain,AudioNode.prototype.fan=e.prototype.fan,e.prototype.defaultArg=function(t,e){if(this.isObject(t)&&this.isObject(e)){var i={};for(var n in t)i[n]=this.defaultArg(e[n],t[n]);for(var o in e)i[o]=this.defaultArg(t[o],e[o]);return i}return this.isUndef(t)?e:t},e.prototype.optionsObject=function(t,e,i){var n={};if(1===t.length&&this.isObject(t[0]))n=t[0];else for(var o=0;o<e.length;o++)n[e[o]]=t[o];return this.isUndef(i)?n:this.defaultArg(n,i)},e.prototype.isUndef=function(t){return void 0===t},e.prototype.isFunction=function(t){return"function"==typeof t},e.prototype.isNumber=function(t){return"number"==typeof t},e.prototype.isObject=function(t){return"[object Object]"===Object.prototype.toString.call(t)&&t.constructor===Object},e.prototype.isBoolean=function(t){return"boolean"==typeof t},e.prototype.isArray=function(t){return Array.isArray(t)},e.prototype.isString=function(t){return"string"==typeof t},e.noOp=function(){},e.prototype._readOnly=function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this._readOnly(t[e]);else Object.defineProperty(this,t,{writable:!1,enumerable:!0})},e.prototype._writable=function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this._writable(t[e]);else Object.defineProperty(this,t,{writable:!0})},e.State={Started:"started",Stopped:"stopped",Paused:"paused"},e.prototype.equalPowerScale=function(t){var e=.5*Math.PI;return Math.sin(t*e)},e.prototype.dbToGain=function(t){return Math.pow(2,t/6)},e.prototype.gainToDb=function(t){return Math.log(t)/Math.LN10*20},e.prototype.intervalToFrequencyRatio=function(t){return Math.pow(2,t/12)},e.prototype.now=function(){return e.context.now()},e.now=function(){return e.context.now()},e.extend=function(t,i){function n(){}e.prototype.isUndef(i)&&(i=e),n.prototype=i.prototype,t.prototype=new n,t.prototype.constructor=t,t._super=i},Object.defineProperty(e,"context",{get:function(){return t},set:function(i){t=e.Context&&i instanceof e.Context?i:new e.Context(i),e.Context&&e.Context.emit("init",t)}}),Object.defineProperty(e.prototype,"context",{get:function(){return e.context}}),e.setContext=function(t){e.context=t},Object.defineProperty(e.prototype,"blockTime",{get:function(){return 128/this.context.sampleRate}}),Object.defineProperty(e.prototype,"sampleTime",{get:function(){return 1/this.context.sampleRate}}),Object.defineProperty(e,"supported",{get:function(){var t=window.hasOwnProperty("AudioContext")||window.hasOwnProperty("webkitAudioContext"),e=window.hasOwnProperty("Promise"),i=window.hasOwnProperty("Worker");return t&&e&&i}}),e.version="r10",window.TONE_SILENCE_VERSION_LOGGING,e}()),function(t){!window.hasOwnProperty("AudioContext")&&window.hasOwnProperty("webkitAudioContext")&&(window.AudioContext=window.webkitAudioContext),t.Context=function(e){for(var i in t.Emitter.call(this),e||(e=new window.AudioContext),this._context=e,this._context)this._defineProperty(this._context,i);this._latencyHint="interactive",this._lookAhead=.1,this._updateInterval=this._lookAhead/3,this._computedUpdateInterval=0,this._worker=this._createWorker(),this._constants={}},t.extend(t.Context,t.Emitter),t.Emitter.mixin(t.Context),t.Context.prototype._defineProperty=function(t,e){this.isUndef(this[e])&&Object.defineProperty(this,e,{get:function(){return"function"==typeof t[e]?t[e].bind(t):t[e]}
24,set:function(i){t[e]=i}})},t.Context.prototype.now=function(){return this._context.currentTime},t.Context.prototype._createWorker=function(){window.URL=window.URL||window.webkitURL;var t=new Blob(["var timeoutTime = "+(1e3*this._updateInterval).toFixed(1)+";self.onmessage = function(msg){\ttimeoutTime = parseInt(msg.data);};function tick(){\tsetTimeout(tick, timeoutTime);\tself.postMessage('tick');}tick();"]),e=URL.createObjectURL(t),i=new Worker(e);return i.addEventListener("message",function(){this.emit("tick")}.bind(this)),i.addEventListener("message",function(){var t=this.now();if(this.isNumber(this._lastUpdate)){var e=t-this._lastUpdate;this._computedUpdateInterval=Math.max(e,.97*this._computedUpdateInterval)}this._lastUpdate=t}.bind(this)),i},t.Context.prototype.getConstant=function(t){if(this._constants[t])return this._constants[t];for(var e=this._context.createBuffer(1,128,this._context.sampleRate),i=e.getChannelData(0),n=0;n<i.length;n++)i[n]=t;var o=this._context.createBufferSource();return o.channelCount=1,o.channelCountMode="explicit",o.buffer=e,o.loop=!0,o.start(0),this._constants[t]=o,o},Object.defineProperty(t.Context.prototype,"lag",{get:function(){var t=this._computedUpdateInterval-this._updateInterval;return t=Math.max(t,0)}}),Object.defineProperty(t.Context.prototype,"lookAhead",{get:function(){return this._lookAhead},set:function(t){this._lookAhead=t}}),Object.defineProperty(t.Context.prototype,"updateInterval",{get:function(){return this._updateInterval},set:function(e){this._updateInterval=Math.max(e,t.prototype.blockTime),this._worker.postMessage(Math.max(1e3*e,1))}}),Object.defineProperty(t.Context.prototype,"latencyHint",{get:function(){return this._latencyHint},set:function(t){var e=t;if(this._latencyHint=t,this.isString(t))switch(t){case"interactive":e=.1,this._context.latencyHint=t;break;case"playback":e=.8,this._context.latencyHint=t;break;case"balanced":e=.25,this._context.latencyHint=t;break;case"fastest":e=.01}this.lookAhead=e,this.updateInterval=e/3}}),t.supported?(!function(){var e=AudioNode.prototype.connect,i=AudioNode.prototype.disconnect;function n(i,n,o){if(i.input)Array.isArray(i.input)?(t.prototype.isUndef(o)&&(o=0),this.connect(i.input[o])):this.connect(i.input,n,o);else try{i instanceof AudioNode?e.call(this,i,n,o):e.call(this,i,n)}catch(s){throw new Error("error connecting to node: "+i+"\n"+s)}}AudioNode.prototype.connect!==n&&(AudioNode.prototype.connect=n,AudioNode.prototype.disconnect=function(e,n,o){if(e&&e.input&&Array.isArray(e.input))t.prototype.isUndef(o)&&(o=0),this.disconnect(e.input[o],n,o);else if(e&&e.input)this.disconnect(e.input,n,o);else try{i.apply(this,arguments)}catch(s){throw new Error("error disconnecting node: "+e+"\n"+s)}})}(),t.context=new t.Context):console.warn("This browser does not support Tone.js"),t.Context}(i),n=function(e,i,n){const o=new window.AudioContext;return n.context.dispose(),n.setContext(o),t.prototype.getAudioContext=function(){return o},t.prototype.userStartAudio=function(i,n){var s=i;return i instanceof t.Element?s=i.elt:i instanceof Array&&i[0]instanceof t.Element&&(s=i.map(function(t){return t.elt})),e(o,s,n)},o}(e,0,i),o=function(e){var i=new function(){this.input=e.createGain(),this.output=e.createGain(),this.limiter=e.createDynamicsCompressor(),this.limiter.threshold.value=-3,this.limiter.ratio.value=20,this.limiter.knee.value=1,this.audiocontext=e,this.output.disconnect(),this.input.connect(this.limiter),this.limiter.connect(this.output),this.meter=e.createGain(),this.fftMeter=e.createGain(),this.output.connect(this.meter),this.output.connect(this.fftMeter),this.output.connect(this.audiocontext.destination),this.soundArray=[],this.parts=[],this.extensions=[]};return t.prototype.getMasterVolume=function(){return i.output.gain.value},t.prototype.masterVolume=function(t,e,n){if("number"==typeof t){e=e||0,n=n||0;var o=i.audiocontext.currentTime,s=i.output.gain.value;i.output.gain.cancelScheduledValues(o+n),i.output.gain.linearRampToValueAtTime(s,o+n),i.output.gain.linearRampToValueAtTime(t,o+n+e)}else{if(!t)return i.output.gain;t.connect(i.output.gain)}},t.prototype.soundOut=t.soundOut=i,t.soundOut._silentNode=i.audiocontext.createGain(),t.soundOut._silentNode.gain.value=0,t.soundOut._silentNode.connect(i.audiocontext.destination),i}(n),s=function(){var e=o;t.prototype.sampleRate=function(){return e.audiocontext.sampleRate},t.prototype.freqToMidi=function(t){var e=Math.log(t/440)/Math.log(2);return Math.round(12*e)+69};var i=t.prototype.midiToFreq=function(t){return 440*Math.pow(2,(t-69)/12)};function n(t,e,i){for(var n=i.length,o=0;o<n;
24o++)t.setUint8(e+o,i.charCodeAt(o))}return t.prototype.soundFormats=function(){e.extensions=[];for(var t=0;t<arguments.length;t++){if(arguments[t]=arguments[t].toLowerCase(),!(["mp3","wav","ogg","m4a","aac"].indexOf(arguments[t])>-1))throw arguments[t]+" is not a valid sound format!";e.extensions.push(arguments[t])}},t.prototype.disposeSound=function(){for(var t=0;t<e.soundArray.length;t++)e.soundArray[t].dispose()},t.prototype.registerMethod("remove",t.prototype.disposeSound),t.prototype._checkFileFormats=function(i){var n;if("string"==typeof i){var o=(n=i).split(".").pop();if(["mp3","wav","ogg","m4a","aac"].indexOf(o)>-1)if(t.prototype.isFileSupported(o))n=n;else for(var s=n.split("."),r=s[s.length-1],a=0;a<e.extensions.length;a++){var u=e.extensions[a];if(t.prototype.isFileSupported(u)){r="",2===s.length&&(r+=s[0]);for(a=1;a<=s.length-2;a++){r+="."+s[a]}n=r+=".",n=n+=u;break}}else for(a=0;a<e.extensions.length;a++){u=e.extensions[a];if(t.prototype.isFileSupported(u)){n=n+"."+u;break}}}else if("object"==typeof i)for(a=0;a<i.length;a++){u=i[a].split(".").pop();if(t.prototype.isFileSupported(u)){n=i[a];break}}return n},t.prototype._mathChain=function(t,e,i,n,o){for(var s in t.mathOps)t.mathOps[s]instanceof o&&(t.mathOps[s].dispose(),(i=s)<t.mathOps.length-1&&(n=t.mathOps[s+1]));return t.mathOps[i-1].disconnect(),t.mathOps[i-1].connect(e),e.connect(n),t.mathOps[i]=e,t},{convertToWav:function(t){var i,o=function(t,e){for(var i=t.length+e.length,n=new Float32Array(i),o=0,s=0;s<i;)n[s++]=t[o],n[s++]=e[o],o++;return n}(i=t.getChannelData(0),t.numberOfChannels>1?t.getChannelData(1):i),s=new window.ArrayBuffer(44+2*o.length),r=new window.DataView(s);n(r,0,"RIFF"),r.setUint32(4,36+2*o.length,!0),n(r,8,"WAVE"),n(r,12,"fmt "),r.setUint32(16,16,!0),r.setUint16(20,1,!0),r.setUint16(22,2,!0),r.setUint32(24,e.audiocontext.sampleRate,!0),r.setUint32(28,4*e.audiocontext.sampleRate,!0),r.setUint16(32,4,!0),r.setUint16(34,16,!0),n(r,36,"data"),r.setUint32(40,2*o.length,!0);for(var a=o.length,u=44,c=0;c<a;c++)r.setInt16(u,32767*o[c],!0),u+=2;return r},midiToFreq:i,noteToFreq:function(t){if("string"!=typeof t)return t;var e={A:21,B:23,C:24,D:26,E:28,F:29,G:31}[t[0].toUpperCase()];switch(e+=12*(~~t.slice(-1)-1),t[1]){case"#":e+=1;break;case"b":e-=1}return i(e)}}}(),r=function(t,e,i){var n,o,s=new Error;return s.name=t,s.originalStack=s.stack+e,n=s.stack+e,s.failedPath=i,o=(o=n.split("\n")).filter(function(t){return!t.match(/(p5.|native code|globalInit)/g)}),s.stack=o.join("\n"),s},void 0!==(a=o.audiocontext).createStereoPanner?(t.Panner=function(t,e){this.stereoPanner=this.input=a.createStereoPanner(),t.connect(this.stereoPanner),this.stereoPanner.connect(e)},t.Panner.prototype.pan=function(t,e){var i=e||0,n=a.currentTime+i;this.stereoPanner.pan.linearRampToValueAtTime(t,n)},t.Panner.prototype.inputChannels=function(){},t.Panner.prototype.connect=function(t){this.stereoPanner.connect(t)},t.Panner.prototype.disconnect=function(){this.stereoPanner&&this.stereoPanner.disconnect()}):(t.Panner=function(t,e,i){this.input=a.createGain(),t.connect(this.input),this.left=a.createGain(),this.right=a.createGain(),this.left.channelInterpretation="discrete",this.right.channelInterpretation="discrete",i>1?(this.splitter=a.createChannelSplitter(2),this.input.connect(this.splitter),this.splitter.connect(this.left,1),this.splitter.connect(this.right,0)):(this.input.connect(this.left),this.input.connect(this.right)),this.output=a.createChannelMerger(2),this.left.connect(this.output,0,1),this.right.connect(this.output,0,0),this.output.connect(e)},t.Panner.prototype.pan=function(t,e){var i=e||0,n=a.currentTime+i,o=(t+1)/2,s=Math.cos(o*Math.PI/2),r=Math.sin(o*Math.PI/2);this.left.gain.linearRampToValueAtTime(r,n),this.right.gain.linearRampToValueAtTime(s,n)},t.Panner.prototype.inputChannels=function(t){1===t?(this.input.disconnect(),this.input.connect(this.left),this.input.connect(this.right)):2===t&&(this.splitter,this.splitter=a.createChannelSplitter(2),this.input.disconnect(),this.input.connect(this.splitter),this.splitter.connect(this.left,1),this.splitter.connect(this.right,0))},t.Panner.prototype.connect=function(t){this.output.connect(t)},t.Panner.prototype.disconnect=function(){this.output&&this.output.disconnect()}),function(){var e=r,i=o,n=i.audiocontext,a=s.midiToFreq,u=s.convertToWav;
24t.SoundFile=function(e,n,o,s){if(void 0!==e){if("string"==typeof e||"string"==typeof e[0]){var r=t.prototype._checkFileFormats(e);this.url=r}else if("object"==typeof e&&!(window.File&&window.FileReader&&window.FileList&&window.Blob))throw"Unable to load file because the File API is not supported";e.file&&(e=e.file),this.file=e}this._onended=function(){},this._looping=!1,this._playing=!1,this._paused=!1,this._pauseTime=0,this._cues=[],this._cueIDCounter=0,this._lastPos=0,this._counterNode=null,this._scopeNode=null,this.bufferSourceNodes=[],this.bufferSourceNode=null,this.buffer=null,this.playbackRate=1,this.input=i.audiocontext.createGain(),this.output=i.audiocontext.createGain(),this.reversed=!1,this.startTime=0,this.endTime=null,this.pauseTime=0,this.mode="sustain",this.startMillis=null,this.panPosition=0,this.panner=new t.Panner(this.output,i.input,2),(this.url||this.file)&&this.load(n,o),i.soundArray.push(this),this._whileLoading="function"==typeof s?s:function(){},this._onAudioProcess=function(t){var e=t.inputBuffer.getChannelData(0);this._lastPos=e[e.length-1]||0,this._onTimeUpdate(self._lastPos)}.bind(this),this._clearOnEnd=function(t){const e=t.target,i=this;e._playing=!1,e.removeEventListener("ended",i._clearOnEnd),i._onended(i),i.bufferSourceNodes.forEach(function(t,e){!1===t._playing&&i.bufferSourceNodes.splice(e)}),0===i.bufferSourceNodes.length&&(i._playing=!1)}.bind(this)},t.prototype.registerPreloadMethod("loadSound",t.prototype),t.prototype.loadSound=function(e,i,n,o){window.location.origin.indexOf("file://")>-1&&"undefined"===window.cordova&&window.alert("This sketch may require a server to load external files. Please see http://bit.ly/1qcInwS");var s=this;return new t.SoundFile(e,function(){"function"==typeof i&&i.apply(s,arguments),"function"==typeof s._decrementPreload&&s._decrementPreload()},n,o)},t.SoundFile.prototype.load=function(t,i){var o=this,s=(new Error).stack;if(void 0!==this.url&&""!==this.url){var r=new XMLHttpRequest;r.addEventListener("progress",function(t){o._updateProgress(t)},!1),r.open("GET",this.url,!0),r.responseType="arraybuffer",r.onload=function(){if(200===r.status){if(!o.panner)return;n.decodeAudioData(r.response,function(e){o.panner&&(o.buffer=e,o.panner.inputChannels(e.numberOfChannels),t&&t(o))},function(){if(o.panner){var t=new e("decodeAudioData",s,o.url),n="AudioContext error at decodeAudioData for "+o.url;i?(t.msg=n,i(t)):console.error(n+"\n The error stack trace includes: \n"+t.stack)}})}else{if(!o.panner)return;var a=new e("loadSound",s,o.url),u="Unable to load "+o.url+". The request status was: "+r.status+" ("+r.statusText+")";i?(a.message=u,i(a)):console.error(u+"\n The error stack trace includes: \n"+a.stack)}},r.onerror=function(){var t=new e("loadSound",s,o.url),n="There was no response from the server at "+o.url+". Check the url and internet connectivity.";i?(t.message=n,i(t)):console.error(n+"\n The error stack trace includes: \n"+t.stack)},r.send()}else if(void 0!==this.file){var a=new FileReader;a.onload=function(){o.panner&&n.decodeAudioData(a.result,function(e){o.panner&&(o.buffer=e,o.panner.inputChannels(e.numberOfChannels),t&&t(o))})},a.onerror=function(t){o.panner&&onerror&&onerror(t)},a.readAsArrayBuffer(this.file)}},t.SoundFile.prototype._updateProgress=function(t){if(t.lengthComputable){var e=t.loaded/t.total*.99;this._whileLoading(e,t)}else this._whileLoading("size unknown")},t.SoundFile.prototype.isLoaded=function(){return!!this.buffer},t.SoundFile.prototype.play=function(t,e,n,o,s){if(this.output){var r,a,u=t||0;if(u<0&&(u=0),u+=i.audiocontext.currentTime,void 0!==e&&this.rate(e),void 0!==n&&this.setVolume(n),!this.buffer)throw"not ready to play file, buffer has yet to load. Try preload()";if(this._pauseTime=0,"restart"===this.mode&&this.buffer&&this.bufferSourceNode&&(this.bufferSourceNode.stop(u),this._counterNode.stop(u)),"untildone"!==this.mode||!this.isPlaying()){if(this.bufferSourceNode=this._initSourceNode(),delete this._counterNode,this._counterNode=this._initCounterNode(),o){if(!(o>=0&&o<this.buffer.duration))throw"start time out of range";r=o}else r=0;
24s&&(s=s<=this.buffer.duration-r?s:this.buffer.duration),this._paused?(this.bufferSourceNode.start(u,this.pauseTime,s),this._counterNode.start(u,this.pauseTime,s)):(this.bufferSourceNode.start(u,r,s),this._counterNode.start(u,r,s)),this._playing=!0,this._paused=!1,this.bufferSourceNodes.push(this.bufferSourceNode),this.bufferSourceNode._arrayIndex=this.bufferSourceNodes.length-1,this.bufferSourceNode.addEventListener("ended",this._clearOnEnd),this.bufferSourceNode.loop=this._looping,this._counterNode.loop=this._looping,!0===this._looping&&(a=s||r-1e-15,this.bufferSourceNode.loopStart=r,this.bufferSourceNode.loopEnd=a,this._counterNode.loopStart=r,this._counterNode.loopEnd=a)}}else console.warn("SoundFile.play() called after dispose")},t.SoundFile.prototype.playMode=function(t){var e=t.toLowerCase();if("restart"===e&&this.buffer&&this.bufferSourceNode)for(var n=0;n<this.bufferSourceNodes.length-1;n++){var o=i.audiocontext.currentTime;this.bufferSourceNodes[n].stop(o)}if("restart"!==e&&"sustain"!==e&&"untildone"!==e)throw'Invalid play mode. Must be either "restart" or "sustain"';this.mode=e},t.SoundFile.prototype.pause=function(t){var e=(t||0)+i.audiocontext.currentTime;this.isPlaying()&&this.buffer&&this.bufferSourceNode?(this.pauseTime=this.currentTime(),this.bufferSourceNode.stop(e),this._counterNode.stop(e),this._paused=!0,this._playing=!1,this._pauseTime=this.currentTime()):this._pauseTime=0},t.SoundFile.prototype.loop=function(t,e,i,n,o){this._looping=!0,this.play(t,e,i,n,o)},t.SoundFile.prototype.setLoop=function(t){if(!0===t)this._looping=!0;else{if(!1!==t)throw"Error: setLoop accepts either true or false";this._looping=!1}this.bufferSourceNode&&(this.bufferSourceNode.loop=this._looping,this._counterNode.loop=this._looping)},t.SoundFile.prototype.isLooping=function(){return!!this.bufferSourceNode&&(!0===this._looping&&!0===this.isPlaying())},t.SoundFile.prototype.isPlaying=function(){return this._playing},t.SoundFile.prototype.isPaused=function(){return this._paused},t.SoundFile.prototype.stop=function(t){var e=t||0;if("sustain"===this.mode||"untildone"===this.mode)this.stopAll(e),this._playing=!1,this.pauseTime=0,this._paused=!1;else if(this.buffer&&this.bufferSourceNode){var n=i.audiocontext.currentTime,o=e||0;this.pauseTime=0,this.bufferSourceNode.stop(n+o),this._counterNode.stop(n+o),this._playing=!1,this._paused=!1}},t.SoundFile.prototype.stopAll=function(t){var e=i.audiocontext.currentTime,n=t||0;if(this.buffer&&this.bufferSourceNode){for(var o in this.bufferSourceNodes){const t=this.bufferSourceNodes[o];if(t)try{t.stop(e+n)}catch(s){}}this._counterNode.stop(e+n),this._onended(this)}},t.SoundFile.prototype.setVolume=function(t,e,n){if("number"==typeof t){var o=e||0,s=n||0,r=i.audiocontext.currentTime,a=this.output.gain.value;this.output.gain.cancelScheduledValues(r+s),this.output.gain.linearRampToValueAtTime(a,r+s),this.output.gain.linearRampToValueAtTime(t,r+s+o)}else{if(!t)return this.output.gain;t.connect(this.output.gain)}},t.SoundFile.prototype.amp=t.SoundFile.prototype.setVolume,t.SoundFile.prototype.fade=t.SoundFile.prototype.setVolume,t.SoundFile.prototype.getVolume=function(){return this.output.gain.value},t.SoundFile.prototype.pan=function(t,e){this.panPosition=t,this.panner.pan(t,e)},t.SoundFile.prototype.getPan=function(){return this.panPosition},t.SoundFile.prototype.rate=function(t){var e=!1;if(void 0===t)return this.playbackRate;if(this.playbackRate=t,0===t?t=1e-13:t<0&&!this.reversed?(t=Math.abs(t),e=!0):t>0&&this.reversed&&(e=!0),this.bufferSourceNode){var n=i.audiocontext.currentTime;this.bufferSourceNode.playbackRate.cancelScheduledValues(n),this.bufferSourceNode.playbackRate.linearRampToValueAtTime(Math.abs(t),n),this._counterNode.playbackRate.cancelScheduledValues(n),this._counterNode.playbackRate.linearRampToValueAtTime(Math.abs(t),n)}return e&&this.reverseBuffer(),this.playbackRate},t.SoundFile.prototype.setPitch=function(t){var e=a(t)/a(60);this.rate(e)},t.SoundFile.prototype.getPlaybackRate=function(){return this.playbackRate},t.SoundFile.prototype.duration=function(){return this.buffer?this.buffer.duration:0},t.SoundFile.prototype.currentTime=function(){return this.reversed?Math.abs(this._lastPos-this.buffer.length)/n.sampleRate:this._lastPos/n.sampleRate},t.SoundFile.prototype.jump=function(t,e){if(t<0||t>this.buffer.duration)throw"jump time out of range";if(e>this.buffer.duration-t)throw"end time out of range";var i=t||0,n=e||void 0;this.isPlaying()&&this.stop(0),this.play(0,this.playbackRate,this.output.gain.value,i,n)},t.SoundFile.prototype.channels=function(){return this.buffer.numberOfChannels},t.SoundFile.prototype.sampleRate=function(){return this.buffer.sampleRate},t.SoundFile.prototype.frames=function(){return this.buffer.length},t.SoundFile.prototype.getPeaks=function(t){if(!this.buffer)throw"Cannot load peaks yet, buffer is not loaded";if(t||(t=5*window.width),this.buffer){for(var e=this.buffer,i=e.length/t,n=~~(i/10)||1,o=e.numberOfChannels,s=new Float32Array(Math.round(t)),r=0;r<o;r++)for(var a=e.getChannelData(r),u=0;u<t;u++){for(var c=~~(u*i),h=~~(c+i),p=0,l=c;l<h;l+=n){var f=a[l];f>p?p=f:-f>p&&(p=f)}(0===r||Math.abs(p)>s[u])&&(s[u]=p)}return s}},t.SoundFile.prototype.reverseBuffer=function(){if(!this.buffer)throw"SoundFile is not done loading";{var t=this._lastPos/n.sampleRate,e=this.getVolume();this.setVolume(0,.001);const o=this.buffer.numberOfChannels;for(var i=0;i<o;i++)this.buffer.getChannelData(i).reverse();this.reversed=!this.reversed,t&&this.jump(this.duration()-t),this.setVolume(e,.001)}},t.SoundFile.prototype.onended=function(t){return this._onended=t,this},t.SoundFile.prototype.add=function(){},t.SoundFile.prototype.dispose=function(){var t=i.audiocontext.currentTime,e=i.soundArray.indexOf(this);if(i.soundArray.splice(e,1),this.stop(t),this.buffer&&this.bufferSourceNode){for(var n=0;n<this.bufferSourceNodes.length-1;n++)if(null!==this.bufferSourceNodes[n]){this.bufferSourceNodes[n].disconnect();try{this.bufferSourceNodes[n].stop(t)}catch(o){console.warning("no buffer source node to dispose")}this.bufferSourceNodes[n]=null}if(this.isPlaying()){try{this._counterNode.stop(t)}catch(o){console.log(o)}this._counterNode=null}}this.output&&(this.output.disconnect(),this.output=null),this.panner&&(this.panner.disconnect(),this.panner=null)},t.SoundFile.prototype.connect=function(t){t?t.hasOwnProperty("input")?this.panner.connect(t.input):this.panner.connect(t):this.panner.connect(i.input)},t.SoundFile.prototype.disconnect=function(){this.panner&&this.panner.disconnect()},t.SoundFile.prototype.getLevel=function(){console.warn("p5.SoundFile.getLevel has been removed from the library. Use p5.Amplitude instead")},t.SoundFile.prototype.setPath=function(e,i){var n=t.prototype._checkFileFormats(e);this.url=n,this.load(i)},t.SoundFile.prototype.setBuffer=function(t){var e=t.length,i=t[0].length,o=n.createBuffer(e,i,n.sampleRate);t[0]instanceof Float32Array||(t[0]=new Float32Array(t[0]));for(var s=0;s<e;s++){o.getChannelData(s).set(t[s])}this.buffer=o,this.panner.inputChannels(e)};t.SoundFile.prototype._initCounterNode=function(){var e=n.currentTime,i=n.createBufferSource();return this._scopeNode&&(this._scopeNode.disconnect(),this._scopeNode.removeEventListener("audioprocess",this._onAudioProcess),delete this._scopeNode),this._scopeNode=n.createScriptProcessor(256,1,1),i.buffer=function(t){const e=t.length,i=n.createBuffer(1,t.length,n.sampleRate),o=i.getChannelData(0);for(var s=0;s<e;s++)o[s]=s;return i}(this.buffer),i.playbackRate.setValueAtTime(this.playbackRate,e),i.connect(this._scopeNode),this._scopeNode.connect(t.soundOut._silentNode),this._scopeNode.addEventListener("audioprocess",this._onAudioProcess),i},t.SoundFile.prototype._initSourceNode=function(){var t=n.createBufferSource();return t.buffer=this.buffer,t.playbackRate.value=this.playbackRate,t.connect(this.output),t}
24,t.SoundFile.prototype.processPeaks=function(t,e,i,n){var o=this.buffer.length,s=this.buffer.sampleRate,r=this.buffer,a=[],u=e||.9,c=i||.22,l=n||200,f=new window.OfflineAudioContext(1,o,s),d=f.createBufferSource();d.buffer=r;var m=f.createBiquadFilter();m.type="lowpass",d.connect(m),m.connect(f.destination),d.start(0),f.startRendering(),f.oncomplete=function(e){if(self.panner){var i=e.renderedBuffer,n=i.getChannelData(0);do{a=h(n,u),u-=.005}while(Object.keys(a).length<l&&u>=c);var o=function(t,i){var n=[];return t.forEach(function(t){try{var o=Math.abs(60/(t.interval/i));if(o=p(o),!n.some(function(e){if(e.tempo===o)return e.count+=t.count})){if(isNaN(o))return;n.push({tempo:Math.round(o),count:t.count})}}catch(e){throw e}}),n}(function(t){for(var e=[],i=Object.keys(t).sort(),n=0;n<i.length;n++)for(var o=0;o<10;o++){var s=t[i[n]],r=t[i[n+o]];if(s&&r){var a=s.sampleIndex,u=r.sampleIndex,c=u-a;c>0&&s.intervals.push(c);var h=e.some(function(t){if(t.interval===c)return t.count++,t});h||e.push({interval:c,count:1})}}return e}(a),i.sampleRate).sort(function(t,e){return e.count-t.count}).splice(0,5);this.tempo=o[0].tempo;var s=function(t,e,i,n){for(var o=[],s=Object.keys(t).sort(),r=0;r<s.length;r++)for(var a=s[r],u=t[a],c=0;c<u.intervals.length;c++){var h=Math.round(Math.abs(60/(u.intervals[c]/i)));h=p(h),Math.abs(h-e)<n&&o.push(u.sampleIndex/i)}return o=o.filter(function(t,e,i){if(i[e+1]-t>.01)return!0})}(a,o[0].tempo,i.sampleRate,5);t(s)}}};var c=function(t,e){this.sampleIndex=e,this.amplitude=t,this.tempos=[],this.intervals=[]};function h(t,e){for(var i={},n=t.length,o=0;o<n;o++){if(t[o]>e){var s=t[o],r=new c(s,o);i[o]=r,o+=6e3}o++}return i}function p(t){if(isFinite(t)&&0!==t){for(;t<90;)t*=2;for(;t>180&&t>90;)t/=2;return t}}var l=function(t,e,i,n){this.callback=t,this.time=e,this.id=i,this.val=n};t.SoundFile.prototype.addCue=function(t,e,i){var n=this._cueIDCounter++,o=new l(e,t,n,i);return this._cues.push(o),n},t.SoundFile.prototype.removeCue=function(t){for(var e=this._cues.length,i=0;i<e;i++){if(this._cues[i].id===t){this._cues.splice(i,1);break}}this._cues.length},t.SoundFile.prototype.clearCues=function(){this._cues=[]}
24,t.SoundFile.prototype._onTimeUpdate=function(t){for(var e=t/this.buffer.sampleRate,i=this._cues.length,n=0;n<i;n++){var o=this._cues[n],s=o.time,r=o.val;this._prevTime<s&&s<=e&&o.callback(r)}this._prevTime=e},t.SoundFile.prototype.save=function(e){const i=u(this.buffer);t.prototype.saveSound([i],e,"wav")},t.SoundFile.prototype.getBlob=function(){const t=u(this.buffer);return new Blob([t],{type:"audio/wav"})}}(),u=o,t.Amplitude=function(t){this.bufferSize=2048,this.audiocontext=u.audiocontext,this.processor=this.audiocontext.createScriptProcessor(this.bufferSize,2,1),this.input=this.processor,this.output=this.audiocontext.createGain(),this.smoothing=t||0,this.volume=0,this.average=0,this.stereoVol=[0,0],this.stereoAvg=[0,0],this.stereoVolNorm=[0,0],this.volMax=.001,this.normalize=!1,this.processor.onaudioprocess=this._audioProcess.bind(this),this.processor.connect(this.output),this.output.gain.value=0,this.output.connect(this.audiocontext.destination),u.meter.connect(this.processor),u.soundArray.push(this)},t.Amplitude.prototype.setInput=function(e,i){u.meter.disconnect(),i&&(this.smoothing=i),null==e?(console.log("Amplitude input source is not ready! Connecting to master output instead"),u.meter.connect(this.processor)):e instanceof t.Signal?e.output.connect(this.processor):e?(e.connect(this.processor),this.processor.disconnect(),this.processor.connect(this.output)):u.meter.connect(this.processor)},t.Amplitude.prototype.connect=function(t){t?t.hasOwnProperty("input")?this.output.connect(t.input):this.output.connect(t):this.output.connect(this.panner.connect(u.input))},t.Amplitude.prototype.disconnect=function(){this.output&&this.output.disconnect()},t.Amplitude.prototype._audioProcess=function(t){for(var e=0;e<t.inputBuffer.numberOfChannels;e++){for(var i,n=t.inputBuffer.getChannelData(e),o=n.length,s=0,r=0,a=0;a<o;a++)i=n[a],this.normalize?(s+=Math.max(Math.min(i/this.volMax,1),-1),r+=Math.max(Math.min(i/this.volMax,1),-1)*Math.max(Math.min(i/this.volMax,1),-1)):(s+=i,r+=i*i);var u=s/o,c=Math.sqrt(r/o);this.stereoVol[e]=Math.max(c,this.stereoVol[e]*this.smoothing),this.stereoAvg[e]=Math.max(u,this.stereoVol[e]*this.smoothing),this.volMax=Math.max(this.stereoVol[e],this.volMax)}var h=this,p=this.stereoVol.reduce(function(t,e,i){return h.stereoVolNorm[i-1]=Math.max(Math.min(h.stereoVol[i-1]/h.volMax,1),0),h.stereoVolNorm[i]=Math.max(Math.min(h.stereoVol[i]/h.volMax,1),0),t+e});this.volume=p/this.stereoVol.length,this.volNorm=Math.max(Math.min(this.volume/this.volMax,1),0)},t.Amplitude.prototype.getLevel=function(t){return void 0!==t?this.normalize?this.stereoVolNorm[t]:this.stereoVol[t]:this.normalize?this.volNorm:this.volume},t.Amplitude.prototype.toggleNormalize=function(t){this.normalize="boolean"==typeof t?t:!this.normalize},t.Amplitude.prototype.smooth=function(t){t>=0&&t<1?this.smoothing=t:console.log("Error: smoothing must be between 0 and 1")},t.Amplitude.prototype.dispose=function(){var t=u.soundArray.indexOf(this);u.soundArray.splice(t,1),this.input&&(this.input.disconnect(),delete this.input),this.output&&(this.output.disconnect(),delete this.output),delete this.processor},function(){var e=o;t.FFT=function(t,i){this.input=this.analyser=e.audiocontext.createAnalyser(),Object.defineProperties(this,{bins:{get:function(){return this.analyser.fftSize/2},set:function(t){this.analyser.fftSize=2*t},configurable:!0,enumerable:!0},smoothing:{get:function(){return this.analyser.smoothingTimeConstant},set:function(t){this.analyser.smoothingTimeConstant=t},configurable:!0,enumerable:!0}}),this.smooth(t),this.bins=i||1024,e.fftMeter.connect(this.analyser),this.freqDomain=new Uint8Array(this.analyser.frequencyBinCount),this.timeDomain=new Uint8Array(this.analyser.frequencyBinCount),this.bass=[20,140],this.lowMid=[140,400],this.mid=[400,2600],this.highMid=[2600,5200],this.treble=[5200,14e3],e.soundArray.push(this)},t.FFT.prototype.setInput=function(t){t?(t.output?t.output.connect(this.analyser):t.connect&&t.connect(this.analyser),e.fftMeter.disconnect()):e.fftMeter.connect(this.analyser)},t.FFT.prototype.waveform=function(){for(var e,i,n=0;n<arguments.length;n++)"number"==typeof arguments[n]&&(e=arguments[n],this.analyser.fftSize=2*e),"string"==typeof arguments[n]&&(i=arguments[n]);if(i&&!t.prototype._isSafari())return s(this,this.timeDomain),this.analyser.getFloatTimeDomainData(this.timeDomain),this.timeDomain;r(this,this.timeDomain),this.analyser.getByteTimeDomainData(this.timeDomain);for(var o=new Array,a=0;a<this.timeDomain.length;a++){var u=t.prototype.map(this.timeDomain[a],0,255,-1,1);o.push(u)}return o}
24,t.FFT.prototype.analyze=function(){for(var t,e=0;e<arguments.length;e++)"number"==typeof arguments[e]&&(this.bins=arguments[e],this.analyser.fftSize=2*this.bins),"string"==typeof arguments[e]&&(t=arguments[e]);if(t&&"db"===t.toLowerCase())return i(this),this.analyser.getFloatFrequencyData(this.freqDomain),this.freqDomain;n(this,this.freqDomain),this.analyser.getByteFrequencyData(this.freqDomain);var o=Array.apply([],this.freqDomain);return o.length,this.analyser.fftSize,o.constructor,Array,o},t.FFT.prototype.getEnergy=function(t,i){var n=e.audiocontext.sampleRate/2;if("bass"===t?(t=this.bass[0],i=this.bass[1]):"lowMid"===t?(t=this.lowMid[0],i=this.lowMid[1]):"mid"===t?(t=this.mid[0],i=this.mid[1]):"highMid"===t?(t=this.highMid[0],i=this.highMid[1]):"treble"===t&&(t=this.treble[0],i=this.treble[1]),"number"!=typeof t)throw"invalid input for getEnergy()";if(i){if(t&&i){if(t>i){var o=i;i=t,t=o}for(var s=Math.round(t/n*this.freqDomain.length),r=Math.round(i/n*this.freqDomain.length),a=0,u=0,c=s;c<=r;c++)a+=this.freqDomain[c],u+=1;return a/u}throw"invalid input for getEnergy()"}var h=Math.round(t/n*this.freqDomain.length);return this.freqDomain[h]},t.FFT.prototype.getFreq=function(t,e){return console.log("getFreq() is deprecated. Please use getEnergy() instead."),this.getEnergy(t,e)},t.FFT.prototype.getCentroid=function(){for(var t=e.audiocontext.sampleRate/2,i=0,n=0,o=0;o<this.freqDomain.length;o++)i+=o*this.freqDomain[o],n+=this.freqDomain[o];var s=0;return 0!==n&&(s=i/n),s*(t/this.freqDomain.length)},t.FFT.prototype.smooth=function(t){return void 0!==t&&(this.smoothing=t),this.smoothing},t.FFT.prototype.dispose=function(){var t=e.soundArray.indexOf(this);e.soundArray.splice(t,1),this.analyser&&(this.analyser.disconnect(),delete this.analyser)},t.FFT.prototype.linAverages=function(t){t=t||16;for(var e=this.freqDomain,i=e.length,n=Math.floor(i/t),o=new Array(t),s=0,r=0;r<i;r++)o[s]=void 0!==o[s]?(o[s]+e[r])/2:e[r],r%n==n-1&&s++;return o},t.FFT.prototype.logAverages=function(t){for(var i=e.audiocontext.sampleRate/2,n=this.freqDomain,o=n.length,s=new Array(t.length),r=0,a=0;a<o;a++){Math.round(a*i/this.freqDomain.length)>t[r].hi&&r++,s[r]=void 0!==s[r]?(s[r]+n[a])/2:n[a]}return s},t.FFT.prototype.getOctaveBands=function(t,i){t=t||3;var n=[],o={lo:(i=i||15.625)/Math.pow(2,1/(2*t)),ctr:i,hi:i*Math.pow(2,1/(2*t))};n.push(o);for(var s=e.audiocontext.sampleRate/2;o.hi<s;){var r={};r.lo=o.hi,r.ctr=o.ctr*Math.pow(2,1/t),r.hi=r.ctr*Math.pow(2,1/(2*t)),n.push(r),o=r}return n};var i=function(t){t.freqDomain instanceof Float32Array==!1&&(t.freqDomain=new Float32Array(t.analyser.frequencyBinCount))},n=function(t){t.freqDomain instanceof Uint8Array==!1&&(t.freqDomain=new Uint8Array(t.analyser.frequencyBinCount))},s=function(t){t.timeDomain instanceof Float32Array==!1&&(t.timeDomain=new Float32Array(t.analyser.frequencyBinCount))},r=function(t){t.timeDomain instanceof Uint8Array==!1&&(t.timeDomain=new Uint8Array(t.analyser.frequencyBinCount))}}(),function(t){"use strict";t.SignalBase=function(){},t.extend(t.SignalBase),t.SignalBase.prototype.connect=function(e,i,n){return t.Signal&&t.Signal===e.constructor||t.Param&&t.Param===e.constructor||t.TimelineSignal&&t.TimelineSignal===e.constructor?(e._param.cancelScheduledValues(0),e._param.value=0,e.overridden=!0):e instanceof AudioParam&&(e.cancelScheduledValues(0),e.value=0),t.prototype.connect.call(this,e,i,n),this},t.SignalBase}(i),function(t){"use strict";t.WaveShaper=function(t,e){this._shaper=this.input=this.output=this.context.createWaveShaper(),this._curve=null,Array.isArray(t)?this.curve=t:isFinite(t)||this.isUndef(t)?this._curve=new Float32Array(this.defaultArg(t,1024)):this.isFunction(t)&&(this._curve=new Float32Array(this.defaultArg(e,1024)),this.setMap(t))},t.extend(t.WaveShaper,t.SignalBase),t.WaveShaper.prototype.setMap=function(t){for(var e=0,i=this._curve.length;e<i;e++){var n=e/(i-1)*2-1;this._curve[e]=t(n,e)}return this._shaper.curve=this._curve,this},Object.defineProperty(t.WaveShaper.prototype,"curve",{get:function(){return this._shaper.curve},set:function(t){this._curve=new Float32Array(t),this._shaper.curve=this._curve}}),Object.defineProperty(t.WaveShaper.prototype,"oversample",{get:function(){return this._shaper.oversample},set:function(t){if(-1===["none","2x","4x"].indexOf(t))throw new RangeError("Tone.WaveShaper: oversampling must be either 'none', '2x', or '4x'");this._shaper.oversample=t}}),t.WaveShaper.prototype.dispose=function(){return t.prototype.dispose.call(this),this._shaper.disconnect(),this._shaper=null,this._curve=null,this},t.WaveShaper}(i),(c=i).TimeBase=function(t,e){if(!(this instanceof c.TimeBase))return new c.TimeBase(t,e);if(this._expr=this._noOp,t instanceof c.TimeBase)this.copy(t);else if(!this.isUndef(e)||this.isNumber(t)){e=this.defaultArg(e,this._defaultUnits);var i=this._primaryExpressions[e].method;this._expr=i.bind(this,t)}else this.isString(t)?this.set(t):this.isUndef(t)&&(this._expr=this._defaultExpr())},c.extend(c.TimeBase),c.TimeBase.prototype.set=function(t){return this._expr=this._parseExprString(t),this},c.TimeBase.prototype.clone=function(){var t=new this.constructor;return t.copy(this),t},c.TimeBase.prototype.copy=function(t){var e=t._expr();return this.set(e)},c.TimeBase.prototype._primaryExpressions={n:{regexp:/^(\d+)n/i,method:function(t){return 1===(t=parseInt(t))?this._beatsToUnits(this._timeSignature()):this._beatsToUnits(4/t)}},t:{regexp:/^(\d+)t/i,method:function(t){return t=parseInt(t),this._beatsToUnits(8/(3*parseInt(t)))}},m:{regexp:/^(\d+)m/i,method:function(t){return this._beatsToUnits(parseInt(t)*this._timeSignature())}},i:{regexp:/^(\d+)i/i,method:function(t){return this._ticksToUnits(parseInt(t))}},hz:{regexp:/^(\d+(?:\.\d+)?)hz/i,method:function(t){return this._frequencyToUnits(parseFloat(t))}},tr:{regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method:function(t,e,
24i){var n=0;return t&&"0"!==t&&(n+=this._beatsToUnits(this._timeSignature()*parseFloat(t))),e&&"0"!==e&&(n+=this._beatsToUnits(parseFloat(e))),i&&"0"!==i&&(n+=this._beatsToUnits(parseFloat(i)/4)),n}},s:{regexp:/^(\d+(?:\.\d+)?s)/,method:function(t){return this._secondsToUnits(parseFloat(t))}},samples:{regexp:/^(\d+)samples/,method:function(t){return parseInt(t)/this.context.sampleRate}},default:{regexp:/^(\d+(?:\.\d+)?)/,method:function(t){return this._primaryExpressions[this._defaultUnits].method.call(this,t)}}},c.TimeBase.prototype._binaryExpressions={"+":{regexp:/^\+/,precedence:2,method:function(t,e){return t()+e()}},"-":{regexp:/^\-/,precedence:2,method:function(t,e){return t()-e()}},"*":{regexp:/^\*/,precedence:1,method:function(t,e){return t()*e()}},"/":{regexp:/^\//,precedence:1,method:function(t,e){return t()/e()}}},c.TimeBase.prototype._unaryExpressions={neg:{regexp:/^\-/,method:function(t){return-t()}}},c.TimeBase.prototype._syntaxGlue={"(":{regexp:/^\(/},")":{regexp:/^\)/}},c.TimeBase.prototype._tokenize=function(t){for(var e=-1,i=[];t.length>0;){var n=o(t=t.trim(),this);i.push(n),t=t.substr(n.value.length)}function o(t,e){for(var i=["_binaryExpressions","_unaryExpressions","_primaryExpressions","_syntaxGlue"],n=0;n<i.length;n++){var o=e[i[n]];for(var s in o){var r=o[s],a=r.regexp,u=t.match(a);if(null!==u)return{method:r.method,precedence:r.precedence,regexp:r.regexp,value:u[0]}}}throw new SyntaxError("Tone.TimeBase: Unexpected token "+t)}return{next:function(){return i[++e]},peek:function(){return i[e+1]}}},c.TimeBase.prototype._matchGroup=function(t,e,i){if(!this.isUndef(t))for(var n in e){var o=e[n];if(o.regexp.test(t.value)){if(this.isUndef(i))return o;if(o.precedence===i)return o}}return!1},c.TimeBase.prototype._parseBinary=function(t,e){var i;this.isUndef(e)&&(e=2),i=e<0?this._parseUnary(t):this._parseBinary(t,e-1);for(var n=t.peek();n&&this._matchGroup(n,this._binaryExpressions,e);)i=(n=t.next()).method.bind(this,i,this._parseBinary(t,e-1)),n=t.peek();return i},c.TimeBase.prototype._parseUnary=function(t){var e,i;e=t.peek();var n=this._matchGroup(e,this._unaryExpressions);return n?(e=t.next(),i=this._parseUnary(t),n.method.bind(this,i)):this._parsePrimary(t)},c.TimeBase.prototype._parsePrimary=function(t){var e,i;if(e=t.peek(),this.isUndef(e))throw new SyntaxError("Tone.TimeBase: Unexpected end of expression");if(this._matchGroup(e,this._primaryExpressions)){var n=(e=t.next()).value.match(e.regexp);return e.method.bind(this,n[1],n[2],n[3])}if(e&&"("===e.value){if(t.next(),i=this._parseBinary(t),!(e=t.next())||")"!==e.value)throw new SyntaxError("Expected )");return i}throw new SyntaxError("Tone.TimeBase: Cannot process token "+e.value)},c.TimeBase.prototype._parseExprString=function(t){this.isString(t)||(t=t.toString());var e=this._tokenize(t);return this._parseBinary(e)},c.TimeBase.prototype._noOp=function(){return 0},c.TimeBase.prototype._defaultExpr=function(){return this._noOp},c.TimeBase.prototype._defaultUnits="s",c.TimeBase.prototype._frequencyToUnits=function(t){return 1/t},c.TimeBase.prototype._beatsToUnits=function(t){return 60/c.Transport.bpm.value*t},c.TimeBase.prototype._secondsToUnits=function(t){return t},c.TimeBase.prototype._ticksToUnits=function(t){return t*(this._beatsToUnits(1)/c.Transport.PPQ)},c.TimeBase.prototype._timeSignature=function(){return c.Transport.timeSignature},c.TimeBase.prototype._pushExpr=function(t,e,i){return t instanceof c.TimeBase||(t=new this.constructor(t,i)),this._expr=this._binaryExpressions[e].method.bind(this,this._expr,t._expr),this},c.TimeBase.prototype.add=function(t,e){return this._pushExpr(t,"+",e)},c.TimeBase.prototype.sub=function(t,e){return this._pushExpr(t,"-",e)},c.TimeBase.prototype.mult=function(t,e){return this._pushExpr(t,"*",e)},c.TimeBase.prototype.div=function(t,e){return this._pushExpr(t,"/",e)},c.TimeBase.prototype.valueOf=function(){return this._expr()},c.TimeBase.prototype.dispose=function(){this._expr=null},c.TimeBase,function(t){t.Time=function(e,i){if(!(this instanceof t.Time))return new t.Time(e,i);this._plusNow=!1,t.TimeBase.call(this,e,i)},t.extend(t.Time,t.TimeBase),t.Time.prototype._unaryExpressions=Object.create(t.TimeBase.prototype._unaryExpressions),t.Time.prototype._unaryExpressions.quantize={regexp:/^@/,method:function(e){return t.Transport.nextSubdivision(e())}},t.Time.prototype._unaryExpressions.now={regexp:/^\+/,method:function(t){return this._plusNow=!0,t()}},t.Time.prototype.quantize=function(t,e){return e=this.defaultArg(e,1),this._expr=function(t,e,
24i){return t=t(),e=e.toSeconds(),t+(Math.round(t/e)*e-t)*i}.bind(this,this._expr,new this.constructor(t),e),this},t.Time.prototype.addNow=function(){return this._plusNow=!0,this},t.Time.prototype._defaultExpr=function(){return this._plusNow=!0,this._noOp},t.Time.prototype.copy=function(e){return t.TimeBase.prototype.copy.call(this,e),this._plusNow=e._plusNow,this},t.Time.prototype.toNotation=function(){var t=this.toSeconds(),e=this._toNotationHelper(t,["1m","2n","4n","8n","16n","32n","64n","128n"]),i=this._toNotationHelper(t,["1m","2n","2t","4n","4t","8n","8t","16n","16t","32n","32t","64n","64t","128n"]);return i.split("+").length<e.split("+").length?i:e},t.Time.prototype._toNotationHelper=function(t,e){for(var i=this._notationToUnits(e[e.length-1]),n="",o=0;o<e.length;o++){var s=this._notationToUnits(e[o]),r=t/s;if(1-r%1<1e-6&&(r+=1e-6),(r=Math.floor(r))>0){if(n+=1===r?e[o]:r.toString()+"*"+e[o],(t-=r*s)<i)break;n+=" + "}}return""===n&&(n="0"),n},t.Time.prototype._notationToUnits=function(t){for(var e=this._primaryExpressions,i=[e.n,e.t,e.m],n=0;n<i.length;n++){var o=i[n],s=t.match(o.regexp);if(s)return o.method.call(this,s[1])}},t.Time.prototype.toBarsBeatsSixteenths=function(){var t=this._beatsToUnits(1),e=this.toSeconds()/t,i=Math.floor(e/this._timeSignature()),n=e%1*4;return e=Math.floor(e)%this._timeSignature(),(n=n.toString()).length>3&&(n=parseFloat(n).toFixed(3)),[i,e,n].join(":")},t.Time.prototype.toTicks=function(){var e=this._beatsToUnits(1),i=this.valueOf()/e;return Math.floor(i*t.Transport.PPQ)},t.Time.prototype.toSamples=function(){return this.toSeconds()*this.context.sampleRate},t.Time.prototype.toFrequency=function(){return 1/this.toSeconds()},t.Time.prototype.toSeconds=function(){return this.valueOf()},t.Time.prototype.toMilliseconds=function(){return 1e3*this.toSeconds()},t.Time.prototype.valueOf=function(){return this._expr()+(this._plusNow?this.now():0)},t.Time}(i),function(t){t.Frequency=function(e,i){if(!(this instanceof t.Frequency))return new t.Frequency(e,i);t.TimeBase.call(this,e,i)},t.extend(t.Frequency,t.TimeBase),t.Frequency.prototype._primaryExpressions=Object.create(t.TimeBase.prototype._primaryExpressions),t.Frequency.prototype._primaryExpressions.midi={regexp:/^(\d+(?:\.\d+)?midi)/,method:function(t){return this.midiToFrequency(t)}},t.Frequency.prototype._primaryExpressions.note={regexp:/^([a-g]{1}(?:b|#|x|bb)?)(-?[0-9]+)/i,method:function(t,i){var n=e[t.toLowerCase()]+12*(parseInt(i)+1);return this.midiToFrequency(n)}},t.Frequency.prototype._primaryExpressions.tr={regexp:/^(\d+(?:\.\d+)?):(\d+(?:\.\d+)?):?(\d+(?:\.\d+)?)?/,method:function(t,e,i){var n=1;return t&&"0"!==t&&(n*=this._beatsToUnits(this._timeSignature()*parseFloat(t))),e&&"0"!==e&&(n*=this._beatsToUnits(parseFloat(e))),i&&"0"!==i&&(n*=this._beatsToUnits(parseFloat(i)/4)),n}},t.Frequency.prototype.transpose=function(t){return this._expr=function(t,e){return t()*this.intervalToFrequencyRatio(e)}.bind(this,this._expr,t),this},t.Frequency.prototype.harmonize=function(t){return this._expr=function(t,e){for(var i=t(),n=[],o=0;o<e.length;o++)n[o]=i*this.intervalToFrequencyRatio(e[o]);return n}.bind(this,this._expr,t),this},t.Frequency.prototype.toMidi=function(){return this.frequencyToMidi(this.valueOf())},t.Frequency.prototype.toNote=function(){var e=this.valueOf(),n=Math.log(e/t.Frequency.A4)/Math.LN2,o=Math.round(12*n)+57,s=Math.floor(o/12);return s<0&&(o+=-12*s),i[o%12]+s.toString()},t.Frequency.prototype.toSeconds=function(){return 1/this.valueOf()},t.Frequency.prototype.toFrequency=function(){return this.valueOf()},t.Frequency.prototype.toTicks=function(){var e=this._beatsToUnits(1),i=this.valueOf()/e;return Math.floor(i*t.Transport.PPQ)},t.Frequency.prototype._frequencyToUnits=function(t){return t},t.Frequency.prototype._ticksToUnits=function(e){return 1/(60*e/(t.Transport.bpm.value*t.Transport.PPQ))},t.Frequency.prototype._beatsToUnits=function(e){return 1/t.TimeBase.prototype._beatsToUnits.call(this,e)},t.Frequency.prototype._secondsToUnits=function(t){return 1/t},t.Frequency.prototype._defaultUnits="hz";var e={cbb:-2,cb:-1,c:0,"c#":1,cx:2,dbb:0,db:1,d:2,"d#":3,dx:4,ebb:2,eb:3,e:4,"e#":5,ex:6,fbb:3,fb:4,f:5,"f#":6,fx:7,gbb:5,gb:6,g:7,"g#":8,gx:9,abb:7,ab:8,a:9,"a#":10,ax:11,bbb:9,bb:10,b:11,"b#":12,bx:13},i=["C","C#","D","D#","E","F","F#","G","G#","A","A#","B"];t.Frequency.A4=440,t.Frequency.prototype.midiToFrequency=function(e){return t.Frequency.A4*Math.pow(2,(e-69)/12)},t.Frequency.prototype.frequencyToMidi=function(e){return 69+12*Math.log(e/t.Frequency.A4)/Math.LN2},t.Frequency}(i),function(t){t.TransportTime=function(e,i){if(!(this instanceof t.TransportTime))return new t.TransportTime(e,i);t.Time.call(this,e,i)},t.extend(t.TransportTime,t.Time),t.TransportTime.prototype._unaryExpressions=Object.create(t.Time.prototype._unaryExpressions),t.TransportTime.prototype._unaryExpressions.quantize={regexp:/^@/,method:function(e){var i=this._secondsToTicks(e()),n=Math.ceil(t.Transport.ticks/i);return this._ticksToUnits(n*i)}},t.TransportTime.prototype._secondsToTicks=function(e){var i=e/this._beatsToUnits(1);return Math.round(i*t.Transport.PPQ)},t.TransportTime.prototype.valueOf=function(){return this._secondsToTicks(this._expr())+(this._plusNow?t.Transport.ticks:0)},t.TransportTime.prototype.toTicks=function(){return this.valueOf()},t.TransportTime.prototype.toSeconds=function(){return this._expr()+(this._plusNow?t.Transport.seconds:0)},t.TransportTime.prototype.toFrequency=function(){return 1/this.toSeconds()},t.TransportTime}(i),function(t){t.Type={Default:"number",Time:"time",Frequency:"frequency",TransportTime:"transportTime",Ticks:"ticks",NormalRange:"normalRange",AudioRange:"audioRange",Decibels:"db",Interval:"interval",BPM:"bpm",Positive:"positive",Cents:"cents",Degrees:"degrees",MIDI:"midi",BarsBeatsSixteenths:"barsBeatsSixteenths",Samples:"samples",Hertz:"hertz",Note:"note",Milliseconds:"milliseconds",Seconds:"seconds",Notation:"notation"},t.prototype.toSeconds=function(e){return this.isNumber(e)?e:this.isUndef(e)?this.now():this.isString(e)?new t.Time(e).toSeconds():e instanceof t.TimeBase?e.toSeconds():void 0},t.prototype.toFrequency=function(e){return this.isNumber(e)?e:this.isString(e)||this.isUndef(e)?new t.Frequency(e).valueOf():e instanceof t.TimeBase?e.toFrequency():void 0},t.prototype.toTicks=function(e){return this.isNumber(e)||this.isString(e)?new t.TransportTime(e).toTicks():this.isUndef(e)?t.Transport.ticks:e instanceof t.TimeBase?e.toTicks():void 0}}(i),function(t){"use strict";t.Param=function(){var e=this.optionsObject(arguments,["param","units","convert"],t.Param.defaults);this._param=this.input=e.param,this.units=e.units,this.convert=e.convert,this.overridden=!1,this._lfo=null,this.isObject(e.lfo)?this.value=e.lfo:this.isUndef(e.value)||(this.value=e.value)},t.extend(t.Param),t.Param.defaults={units:t.Type.Default,convert:!0,param:void 0},Object.defineProperty(t.Param.prototype,"value",{get:function(){return this._toUnits(this._param.value)},set:function(e){if(this.isObject(e)){if(this.isUndef(t.LFO))throw new Error("Include 'Tone.LFO' to use an LFO as a Param value.");this._lfo&&this._lfo.dispose(),this._lfo=new t.LFO(e).start(),this._lfo.connect(this.input)}else{var i=this._fromUnits(e);this._param.cancelScheduledValues(0),this._param.value=i}}}),t.Param.prototype._fromUnits=function(e){if(!this.convert&&!this.isUndef(this.convert))return e;switch(this.units){case t.Type.Time:return this.toSeconds(e);case t.Type.Frequency:return this.toFrequency(e);case t.Type.Decibels:return this.dbToGain(e);
24case t.Type.NormalRange:return Math.min(Math.max(e,0),1);case t.Type.AudioRange:return Math.min(Math.max(e,-1),1);case t.Type.Positive:return Math.max(e,0);default:return e}},t.Param.prototype._toUnits=function(e){if(!this.convert&&!this.isUndef(this.convert))return e;switch(this.units){case t.Type.Decibels:return this.gainToDb(e);default:return e}},t.Param.prototype._minOutput=1e-5,t.Param.prototype.setValueAtTime=function(t,e){return t=this._fromUnits(t),(e=this.toSeconds(e))<=this.now()+this.blockTime?this._param.value=t:this._param.setValueAtTime(t,e),this},t.Param.prototype.setRampPoint=function(t){t=this.defaultArg(t,this.now());var e=this._param.value;return 0===e&&(e=this._minOutput),this._param.setValueAtTime(e,t),this},t.Param.prototype.linearRampToValueAtTime=function(t,e){return t=this._fromUnits(t),this._param.linearRampToValueAtTime(t,this.toSeconds(e)),this},t.Param.prototype.exponentialRampToValueAtTime=function(t,e){return t=this._fromUnits(t),t=Math.max(this._minOutput,t),this._param.exponentialRampToValueAtTime(t,this.toSeconds(e)),this},t.Param.prototype.exponentialRampToValue=function(t,e,i){return i=this.toSeconds(i),this.setRampPoint(i),this.exponentialRampToValueAtTime(t,i+this.toSeconds(e)),this},t.Param.prototype.linearRampToValue=function(t,e,i){return i=this.toSeconds(i),this.setRampPoint(i),this.linearRampToValueAtTime(t,i+this.toSeconds(e)),this},t.Param.prototype.setTargetAtTime=function(t,e,i){return t=this._fromUnits(t),t=Math.max(this._minOutput,t),i=Math.max(this._minOutput,i),this._param.setTargetAtTime(t,this.toSeconds(e),i),this},t.Param.prototype.setValueCurveAtTime=function(t,e,i){for(var n=0;n<t.length;n++)t[n]=this._fromUnits(t[n]);return this._param.setValueCurveAtTime(t,this.toSeconds(e),this.toSeconds(i)),this},t.Param.prototype.cancelScheduledValues=function(t){return this._param.cancelScheduledValues(this.toSeconds(t)),this},t.Param.prototype.rampTo=function(e,i,n){return i=this.defaultArg(i,0),this.units===t.Type.Frequency||this.units===t.Type.BPM||this.units===t.Type.Decibels?this.exponentialRampToValue(e,i,n):this.linearRampToValue(e,i,n),this},Object.defineProperty(t.Param.prototype,"lfo",{get:function(){return this._lfo}}),t.Param.prototype.dispose=function(){return t.prototype.dispose.call(this),this._param=null,this._lfo&&(this._lfo.dispose(),this._lfo=null),this},t.Param}(i),function(t){"use strict";window.GainNode&&!AudioContext.prototype.createGain&&(AudioContext.prototype.createGain=AudioContext.prototype.createGainNode),t.Gain=function(){var e=this.optionsObject(arguments,["gain","units"],t.Gain.defaults);this.input=this.output=this._gainNode=this.context.createGain(),this.gain=new t.Param({param:this._gainNode.gain,units:e.units,value:e.gain,convert:e.convert}),this._readOnly("gain")},t.extend(t.Gain),t.Gain.defaults={gain:1,convert:!0},t.Gain.prototype.dispose=function(){t.Param.prototype.dispose.call(this),this._gainNode.disconnect(),this._gainNode=null,this._writable("gain"),this.gain.dispose(),this.gain=null},t.prototype.createInsOuts=function(e,i){1===e?this.input=new t.Gain:e>1&&(this.input=new Array(e)),1===i?this.output=new t.Gain:i>1&&(this.output=new Array(e))},t.Gain}(i),h=function(t){"use strict";return t.Signal=function(){var e=this.optionsObject(arguments,["value","units"],t.Signal.defaults);this.output=this._gain=this.context.createGain(),e.param=this._gain.gain,t.Param.call(this,e),this.input=this._param=this._gain.gain,this.context.getConstant(1).chain(this._gain)},t.extend(t.Signal,t.Param),t.Signal.defaults={value:0,units:t.Type.Default,convert:!0},t.Signal.prototype.connect=t.SignalBase.prototype.connect,t.Signal.prototype.dispose=function(){return t.Param.prototype.dispose.call(this),this._param=null,this._gain.disconnect(),this._gain=null,this},t.Signal}(i),p=function(t){"use strict";return t.Add=function(e){this.createInsOuts(2,0),this._sum=this.input[0]=this.input[1]=this.output=new t.Gain,this._param=this.input[1]=new t.Signal(e),this._param.connect(this._sum)},t.extend(t.Add,t.Signal),t.Add.prototype.dispose=function(){return t.prototype.dispose.call(this),this._sum.dispose(),this._sum=null,this._param.dispose(),this._param=null,this},t.Add}(i),l=function(t){"use strict";return t.Multiply=function(e){this.createInsOuts(2,0),this._mult=this.input[0]=this.output=new t.Gain,this._param=this.input[1]=this.output.gain,this._param.value=this.defaultArg(e,0)},t.extend(t.Multiply,t.Signal),t.Multiply.prototype.dispose=function(){return t.prototype.dispose.call(this),this._mult.dispose(),this._mult=null,this._param=null,this},t.Multiply}(i),f=function(t){"use strict";return t.Scale=function(e,i){this._outputMin=this.defaultArg(e,0),this._outputMax=this.defaultArg(i,1),this._scale=this.input=new t.Multiply(1),this._add=this.output=new t.Add(0),this._scale.connect(this._add),this._setRange()},t.extend(t.Scale,t.SignalBase),Object.defineProperty(t.Scale.prototype,"min",{get:function(){return this._outputMin},set:function(t){this._outputMin=t,this._setRange()}}),Object.defineProperty(t.Scale.prototype,"max",{get:function(){return this._outputMax},set:function(t){this._outputMax=t,this._setRange()}}),t.Scale.prototype._setRange=function(){this._add.value=this._outputMin,this._scale.value=this._outputMax-this._outputMin},t.Scale.prototype.dispose=function(){return t.prototype.dispose.call(this),this._add.dispose(),this._add=null,this._scale.dispose(),this._scale=null,this},t.Scale}(i),d=h,m=p,y=l,v=f,t.Signal=function(t){return new d(t)},d.prototype.fade=d.prototype.linearRampToValueAtTime,y.prototype.fade=d.prototype.fade,m.prototype.fade=d.prototype.fade,v.prototype.fade=d.prototype.fade,d.prototype.setInput=function(t){t.connect(this)},y.prototype.setInput=d.prototype.setInput,m.prototype.setInput=d.prototype.setInput,v.prototype.setInput=d.prototype.setInput,d.prototype.add=function(t){var e=new m(t);return this.connect(e),e},y.prototype.add=d.prototype.add,m.prototype.add=d.prototype.add,v.prototype.add=d.prototype.add,d.prototype.mult=function(t){var e=new y(t);return this.connect(e),e},y.prototype.mult=d.prototype.mult,m.prototype.mult=d.prototype.mult,v.prototype.mult=d.prototype.mult,d.prototype.scale=function(e,i,n,o){var s,r;4===arguments.length?(s=t.prototype.map(n,e,i,0,1)-.5,r=t.prototype.map(o,e,i,0,1)-.5):(s=arguments[0],r=arguments[1]);var a=new v(s,r);return this.connect(a),a},y.prototype.scale=d.prototype.scale,m.prototype.scale=d.prototype.scale,v.prototype.scale=d.prototype.scale,function(){var e=o,i=p,n=l,s=f;t.Oscillator=function(i,n){if("string"==typeof i){var o=n;n=i,i=o}if("number"==typeof n){o=n;n=i,i=o}this.started=!1,this.phaseAmount=void 0,this.oscillator=e.audiocontext.createOscillator(),this.f=i||440,this.oscillator.type=n||"sine",this.oscillator.frequency.setValueAtTime(this.f,e.audiocontext.currentTime),this.output=e.audiocontext.createGain(),this._freqMods=[],this.output.gain.value=.5,this.output.gain.setValueAtTime(.5,e.audiocontext.currentTime),this.oscillator.connect(this.output),this.panPosition=0,this.connection=e.input,this.panner=new t.Panner(this.output,this.connection,1),this.mathOps=[this.output],e.soundArray.push(this)},t.Oscillator.prototype.start=function(t,i){if(this.started){var n=e.audiocontext.currentTime;this.stop(n)}if(!this.started){var o=i||this.f,s=this.oscillator.type;for(var r in this.oscillator&&(this.oscillator.disconnect(),delete this.oscillator),this.oscillator=e.audiocontext.createOscillator(),this.oscillator.frequency.value=Math.abs(o),this.oscillator.type=s,this.oscillator.connect(this.output),t=t||0,this.oscillator.start(t+e.audiocontext.currentTime),this.freqNode=this.oscillator.frequency,this._freqMods)void 0!==this._freqMods[r].connect&&this._freqMods[r].connect(this.oscillator.frequency);this.started=!0}},t.Oscillator.prototype.stop=function(t){if(this.started){var i=t||0,n=e.audiocontext.currentTime;this.oscillator.stop(i+n),this.started=!1}},t.Oscillator.prototype.amp=function(t,i,n){if("number"==typeof t){i=i||0,n=n||0;var o=e.audiocontext.currentTime;this.output.gain.linearRampToValueAtTime(t,o+n+i)}else{if(!t)return this.output.gain;t.connect(this.output.gain)}},t.Oscillator.prototype.fade=t.Oscillator.prototype.amp,t.Oscillator.prototype.getAmp=function(){return this.output.gain.value},t.Oscillator.prototype.freq=function(t,i,n){if("number"!=typeof t||isNaN(t)){if(!t)return this.oscillator.frequency;t.output&&(t=t.output),t.connect(this.oscillator.frequency),this._freqMods.push(t)}else{this.f=t;var o=e.audiocontext.currentTime;n=n||0,i=i||0;0===i?this.oscillator.frequency.setValueAtTime(t,n+o):t>0?this.oscillator.frequency.exponentialRampToValueAtTime(t,n+i+o):this.oscillator.frequency.linearRampToValueAtTime(t,n+i+o),this.phaseAmount&&this.phase(this.phaseAmount)}},t.Oscillator.prototype.getFreq=function(){return this.oscillator.frequency.value},t.Oscillator.prototype.setType=function(t){this.oscillator.type=t},t.Oscillator.prototype.getType=function(){return this.oscillator.type},t.Oscillator.prototype.connect=function(t){t?t.hasOwnProperty("input")?(this.panner.connect(t.input),this.connection=t.input):(this.panner.connect(t),this.connection=t):this.panner.connect(e.input)},t.Oscillator.prototype.disconnect=function(){this.output&&this.output.disconnect(),this.panner&&(this.panner.disconnect(),this.output&&this.output.connect(this.panner)),this.oscMods=[]},t.Oscillator.prototype.pan=function(t,e){this.panPosition=t,this.panner.pan(t,e)},t.Oscillator.prototype.getPan=function(){return this.panPosition},t.Oscillator.prototype.dispose=function(){var t=e.soundArray.indexOf(this);if(e.soundArray.splice(t,1),this.oscillator){var i=e.audiocontext.currentTime;this.stop(i),this.disconnect(),this.panner=null,this.oscillator=null}this.osc2&&this.osc2.dispose()},t.Oscillator.prototype.phase=function(i){var n=t.prototype.map(i,0,1,0,1/this.f),o=e.audiocontext.currentTime;this.phaseAmount=i,this.dNode||(this.dNode=e.audiocontext.createDelay(),this.oscillator.disconnect(),this.oscillator.connect(this.dNode),this.dNode.connect(this.output)),this.dNode.delayTime.setValueAtTime(n,o)};
24var r=function(t,e,i,n,o){var s=t.oscillator;for(var r in t.mathOps)t.mathOps[r]instanceof o&&(s.disconnect(),t.mathOps[r].dispose(),(i=r)<t.mathOps.length-2&&(n=t.mathOps[r+1]));return i===t.mathOps.length-1&&t.mathOps.push(n),r>0&&(s=t.mathOps[r-1]),s.disconnect(),s.connect(e),e.connect(n),t.mathOps[i]=e,t};t.Oscillator.prototype.add=function(t){var e=new i(t),n=this.mathOps.length-1,o=this.output;return r(this,e,n,o,i)},t.Oscillator.prototype.mult=function(t){var e=new n(t),i=this.mathOps.length-1,o=this.output;return r(this,e,i,o,n)},t.Oscillator.prototype.scale=function(e,i,n,o){var a,u;4===arguments.length?(a=t.prototype.map(n,e,i,0,1)-.5,u=t.prototype.map(o,e,i,0,1)-.5):(a=arguments[0],u=arguments[1]);var c=new s(a,u),h=this.mathOps.length-1,p=this.output;return r(this,c,h,p,s)},t.SinOsc=function(e){t.Oscillator.call(this,e,"sine")},t.SinOsc.prototype=Object.create(t.Oscillator.prototype),t.TriOsc=function(e){t.Oscillator.call(this,e,"triangle")},t.TriOsc.prototype=Object.create(t.Oscillator.prototype),t.SawOsc=function(e){t.Oscillator.call(this,e,"sawtooth")},t.SawOsc.prototype=Object.create(t.Oscillator.prototype),t.SqrOsc=function(e){t.Oscillator.call(this,e,"square")},t.SqrOsc.prototype=Object.create(t.Oscillator.prototype)}(),function(t){"use strict";t.Timeline=function(){var e=this.optionsObject(arguments,["memory"],t.Timeline.defaults);this._timeline=[],this._toRemove=[],this._iterating=!1,this.memory=e.memory},t.extend(t.Timeline),t.Timeline.defaults={memory:1/0},Object.defineProperty(t.Timeline.prototype,"length",{get:function(){return this._timeline.length}}),t.Timeline.prototype.add=function(t){if(this.isUndef(t.time))throw new Error("Tone.Timeline: events must have a time attribute");if(this._timeline.length){var e=this._search(t.time);this._timeline.splice(e+1,0,t)}else this._timeline.push(t);if(this.length>this.memory){var i=this.length-this.memory;this._timeline.splice(0,i)}return this},t.Timeline.prototype.remove=function(t){if(this._iterating)this._toRemove.push(t);else{var e=this._timeline.indexOf(t);-1!==e&&this._timeline.splice(e,1)}return this},t.Timeline.prototype.get=function(t){var e=this._search(t);return-1!==e?this._timeline[e]:null},t.Timeline.prototype.peek=function(){return this._timeline[0]},t.Timeline.prototype.shift=function(){return this._timeline.shift()},t.Timeline.prototype.getAfter=function(t){var e=this._search(t);return e+1<this._timeline.length?this._timeline[e+1]:null},t.Timeline.prototype.getBefore=function(t){var e=this._timeline.length;if(e>0&&this._timeline[e-1].time<t)return this._timeline[e-1];var i=this._search(t);return i-1>=0?this._timeline[i-1]:null},t.Timeline.prototype.cancel=function(t){if(this._timeline.length>1){var e=this._search(t);if(e>=0)if(this._timeline[e].time===t){for(var i=e;i>=0&&this._timeline[i].time===t;i--)e=i;this._timeline=this._timeline.slice(0,e)}else this._timeline=this._timeline.slice(0,e+1);else this._timeline=[]}else 1===this._timeline.length&&this._timeline[0].time>=t&&(this._timeline=[]);return this},t.Timeline.prototype.cancelBefore=function(t){if(this._timeline.length){var e=this._search(t);e>=0&&(this._timeline=this._timeline.slice(e+1))}return this},t.Timeline.prototype._search=function(t){var e=0,i=this._timeline.length,n=i;if(i>0&&this._timeline[i-1].time<=t)return i-1;for(;e<n;){var o=Math.floor(e+(n-e)/2),s=this._timeline[o],r=this._timeline[o+1];if(s.time===t){for(var a=o;a<this._timeline.length;a++){this._timeline[a].time===t&&(o=a)}return o}if(s.time<t&&r.time>t)return o;s.time>t?n=o:s.time<t&&(e=o+1)}return-1},t.Timeline.prototype._iterate=function(t,e,i){this._iterating=!0,e=this.defaultArg(e,0),i=this.defaultArg(i,this._timeline.length-1);for(var n=e;n<=i;n++)t(this._timeline[n]);if(this._iterating=!1,this._toRemove.length>0){for(var o=0;o<this._toRemove.length;o++){var s=this._timeline.indexOf(this._toRemove[o]);-1!==s&&this._timeline.splice(s,1)}this._toRemove=[]}},t.Timeline.prototype.forEach=function(t){return this._iterate(t),this},t.Timeline.prototype.forEachBefore=function(t,e){var i=this._search(t);return-1!==i&&this._iterate(e,0,i),this},t.Timeline.prototype.forEachAfter=function(t,e){var i=this._search(t);return this._iterate(e,i+1),this},t.Timeline.prototype.forEachFrom=function(t,e){for(var i=this._search(t);i>=0&&this._timeline[i].time>=t;)i--;return this._iterate(e,i+1),this},t.Timeline.prototype.forEachAtTime=function(t,e){var i=this._search(t);return-1!==i&&this._iterate(function(i){i.time===t&&e(i)},0,i),this},t.Timeline.prototype.dispose=function(){t.prototype.dispose.call(this),this._timeline=null,this._toRemove=null},t.Timeline}(i),_=function(t){"use strict";return t.TimelineSignal=function(){var e=this.optionsObject(arguments,["value","units"],t.Signal.defaults);this._events=new t.Timeline(10),t.Signal.apply(this,e),e.param=this._param,t.Param.call(this,e),this._initial=this._fromUnits(this._param.value)},t.extend(t.TimelineSignal,t.Param),t.TimelineSignal.Type={Linear:"linear",Exponential:"exponential",Target:"target",Curve:"curve",Set:"set"},Object.defineProperty(t.TimelineSignal.prototype,"value",{get:function(){var t=this.now(),e=this.getValueAtTime(t);return this._toUnits(e)},set:function(t){var e=this._fromUnits(t);this._initial=e,this.cancelScheduledValues(),this._param.value=e}}),t.TimelineSignal.prototype.setValueAtTime=function(e,i){return e=this._fromUnits(e),i=this.toSeconds(i),this._events.add({type:t.TimelineSignal.Type.Set,value:e,time:i}),this._param.setValueAtTime(e,i),this},t.TimelineSignal.prototype.linearRampToValueAtTime=function(e,i){return e=this._fromUnits(e),i=this.toSeconds(i),this._events.add({type:t.TimelineSignal.Type.Linear,value:e,time:i}),this._param.linearRampToValueAtTime(e,i),this}
24,t.TimelineSignal.prototype.exponentialRampToValueAtTime=function(e,i){i=this.toSeconds(i);var n=this._searchBefore(i);n&&0===n.value&&this.setValueAtTime(this._minOutput,n.time),e=this._fromUnits(e);var o=Math.max(e,this._minOutput);return this._events.add({type:t.TimelineSignal.Type.Exponential,value:o,time:i}),e<this._minOutput?(this._param.exponentialRampToValueAtTime(this._minOutput,i-this.sampleTime),this.setValueAtTime(0,i)):this._param.exponentialRampToValueAtTime(e,i),this},t.TimelineSignal.prototype.setTargetAtTime=function(e,i,n){return e=this._fromUnits(e),e=Math.max(this._minOutput,e),n=Math.max(this._minOutput,n),i=this.toSeconds(i),this._events.add({type:t.TimelineSignal.Type.Target,value:e,time:i,constant:n}),this._param.setTargetAtTime(e,i,n),this},t.TimelineSignal.prototype.setValueCurveAtTime=function(e,i,n,o){o=this.defaultArg(o,1);for(var s=new Array(e.length),r=0;r<s.length;r++)s[r]=this._fromUnits(e[r])*o;i=this.toSeconds(i),n=this.toSeconds(n),this._events.add({type:t.TimelineSignal.Type.Curve,value:s,time:i,duration:n}),this._param.setValueAtTime(s[0],i);for(var a=1;a<s.length;a++){var u=i+a/(s.length-1)*n;this._param.linearRampToValueAtTime(s[a],u)}return this},t.TimelineSignal.prototype.cancelScheduledValues=function(t){return t=this.toSeconds(t),this._events.cancel(t),this._param.cancelScheduledValues(t),this},t.TimelineSignal.prototype.setRampPoint=function(e){e=this.toSeconds(e);var i=this._toUnits(this.getValueAtTime(e)),n=this._searchBefore(e);if(n&&n.time===e)this.cancelScheduledValues(e+this.sampleTime);else if(n&&n.type===t.TimelineSignal.Type.Curve&&n.time+n.duration>e)this.cancelScheduledValues(e),this.linearRampToValueAtTime(i,e);else{var o=this._searchAfter(e);o&&(this.cancelScheduledValues(e),o.type===t.TimelineSignal.Type.Linear?this.linearRampToValueAtTime(i,e):o.type===t.TimelineSignal.Type.Exponential&&this.exponentialRampToValueAtTime(i,e)),this.setValueAtTime(i,e)}return this},t.TimelineSignal.prototype.linearRampToValueBetween=function(t,e,i){return this.setRampPoint(e),this.linearRampToValueAtTime(t,i),this},t.TimelineSignal.prototype.exponentialRampToValueBetween=function(t,e,i){return this.setRampPoint(e),this.exponentialRampToValueAtTime(t,i),this},t.TimelineSignal.prototype._searchBefore=function(t){return this._events.get(t)},t.TimelineSignal.prototype._searchAfter=function(t){return this._events.getAfter(t)},t.TimelineSignal.prototype.getValueAtTime=function(e){e=this.toSeconds(e);var i=this._searchAfter(e),n=this._searchBefore(e),o=this._initial;if(null===n)o=this._initial;else if(n.type===t.TimelineSignal.Type.Target){var s,r=this._events.getBefore(n.time);s=null===r?this._initial:r.value,o=this._exponentialApproach(n.time,s,n.value,n.constant,e)}else o=n.type===t.TimelineSignal.Type.Curve?this._curveInterpolate(n.time,n.value,n.duration,e):null===i?n.value:i.type===t.TimelineSignal.Type.Linear?this._linearInterpolate(n.time,n.value,i.time,i.value,e):i.type===t.TimelineSignal.Type.Exponential?this._exponentialInterpolate(n.time,n.value,i.time,i.value,e):n.value;return o},t.TimelineSignal.prototype.connect=t.SignalBase.prototype.connect,t.TimelineSignal.prototype._exponentialApproach=function(t,e,i,n,o){return i+(e-i)*Math.exp(-(o-t)/n)},t.TimelineSignal.prototype._linearInterpolate=function(t,e,i,n,o){return e+(o-t)/(i-t)*(n-e)},t.TimelineSignal.prototype._exponentialInterpolate=function(t,e,i,n,o){return(e=Math.max(this._minOutput,e))*Math.pow(n/e,(o-t)/(i-t))},t.TimelineSignal.prototype._curveInterpolate=function(t,e,i,n){var o=e.length;if(n>=t+i)return e[o-1];if(n<=t)return e[0];var s=(n-t)/i,r=Math.floor((o-1)*s),a=Math.ceil((o-1)*s),u=e[r],c=e[a];return a===r?u:this._linearInterpolate(r,u,a,c,s*(o-1))},t.TimelineSignal.prototype.dispose=function(){t.Signal.prototype.dispose.call(this),t.Param.prototype.dispose.call(this),this._events.dispose(),this._events=null},t.TimelineSignal}(i),function(){var e=o,i=p,n=l,s=f,r=_;t.Envelope=function(t,i,n,o,s,a){this.aTime=t||.1,this.aLevel=i||1,this.dTime=n||.5,this.dLevel=o||0,this.rTime=s||0,this.rLevel=a||0,this._rampHighPercentage=.98,this._rampLowPercentage=.02,this.output=e.audiocontext.createGain(),this.control=new r,this._init(),this.control.connect(this.output),this.connection=null,this.mathOps=[this.control],this.isExponential=!1,this.sourceToClear=null,this.wasTriggered=!1,e.soundArray.push(this)},t.Envelope.prototype._init=function(){var t=e.audiocontext.currentTime;this.control.setTargetAtTime(1e-5,t,.001),this._setRampAD(this.aTime,this.dTime)}
24,t.Envelope.prototype.set=function(t,e,i,n,o,s){this.aTime=t,this.aLevel=e,this.dTime=i||0,this.dLevel=n||0,this.rTime=o||0,this.rLevel=s||0,this._setRampAD(t,i)},t.Envelope.prototype.setADSR=function(t,e,i,n){this.aTime=t,this.dTime=e||0,this.sPercent=i||0,this.dLevel=void 0!==i?i*(this.aLevel-this.rLevel)+this.rLevel:0,this.rTime=n||0,this._setRampAD(t,e)},t.Envelope.prototype.setRange=function(t,e){this.aLevel=t||1,this.rLevel=e||0},t.Envelope.prototype._setRampAD=function(t,e){this._rampAttackTime=this.checkExpInput(t),this._rampDecayTime=this.checkExpInput(e);var i=1;i=Math.log(1/this.checkExpInput(1-this._rampHighPercentage)),this._rampAttackTC=t/this.checkExpInput(i),i=Math.log(1/this._rampLowPercentage),this._rampDecayTC=e/this.checkExpInput(i)},t.Envelope.prototype.setRampPercentages=function(t,e){this._rampHighPercentage=this.checkExpInput(t),this._rampLowPercentage=this.checkExpInput(e);var i=1;i=Math.log(1/this.checkExpInput(1-this._rampHighPercentage)),this._rampAttackTC=this._rampAttackTime/this.checkExpInput(i),i=Math.log(1/this._rampLowPercentage),this._rampDecayTC=this._rampDecayTime/this.checkExpInput(i)},t.Envelope.prototype.setInput=function(){for(var t=0;t<arguments.length;t++)this.connect(arguments[t])},t.Envelope.prototype.setExp=function(t){this.isExponential=t},t.Envelope.prototype.checkExpInput=function(t){return t<=0&&(t=1e-8),t},t.Envelope.prototype.play=function(t,e,i){var n=e||0;i=i||0;t&&this.connection!==t&&this.connect(t),this.triggerAttack(t,n),this.triggerRelease(t,n+this.aTime+this.dTime+i)},t.Envelope.prototype.triggerAttack=function(t,i){var n=e.audiocontext.currentTime+(i||0);this.lastAttack=n,this.wasTriggered=!0,t&&this.connection!==t&&this.connect(t);var o=this.control.getValueAtTime(n);!0===this.isExponential?this.control.exponentialRampToValueAtTime(this.checkExpInput(o),n):this.control.linearRampToValueAtTime(o,n),n+=this.aTime,!0===this.isExponential?(this.control.exponentialRampToValueAtTime(this.checkExpInput(this.aLevel),n),o=this.checkExpInput(this.control.getValueAtTime(n)),this.control.cancelScheduledValues(n),this.control.exponentialRampToValueAtTime(o,n)):(this.control.linearRampToValueAtTime(this.aLevel,n),o=this.control.getValueAtTime(n),this.control.cancelScheduledValues(n),this.control.linearRampToValueAtTime(o,n)),n+=this.dTime,!0===this.isExponential?(this.control.exponentialRampToValueAtTime(this.checkExpInput(this.dLevel),n),o=this.checkExpInput(this.control.getValueAtTime(n)),this.control.cancelScheduledValues(n),this.control.exponentialRampToValueAtTime(o,n)):(this.control.linearRampToValueAtTime(this.dLevel,n),o=this.control.getValueAtTime(n),this.control.cancelScheduledValues(n),this.control.linearRampToValueAtTime(o,n))},t.Envelope.prototype.triggerRelease=function(t,i){if(this.wasTriggered){var n=e.audiocontext.currentTime+(i||0);t&&this.connection!==t&&this.connect(t);var o=this.control.getValueAtTime(n);!0===this.isExponential?this.control.exponentialRampToValueAtTime(this.checkExpInput(o),n):this.control.linearRampToValueAtTime(o,n),n+=this.rTime,!0===this.isExponential?(this.control.exponentialRampToValueAtTime(this.checkExpInput(this.rLevel),n),o=this.checkExpInput(this.control.getValueAtTime(n)),this.control.cancelScheduledValues(n),this.control.exponentialRampToValueAtTime(o,n)):(this.control.linearRampToValueAtTime(this.rLevel,n),o=this.control.getValueAtTime(n),this.control.cancelScheduledValues(n),this.control.linearRampToValueAtTime(o,n)),this.wasTriggered=!1}},t.Envelope.prototype.ramp=function(t,i,n,o){var s=e.audiocontext.currentTime+(i||0),r=this.checkExpInput(n),a=void 0!==o?this.checkExpInput(o):void 0;t&&this.connection!==t&&this.connect(t);var u=this.checkExpInput(this.control.getValueAtTime(s));r>u?(this.control.setTargetAtTime(r,s,this._rampAttackTC),s+=this._rampAttackTime):r<u&&(this.control.setTargetAtTime(r,s,this._rampDecayTC),s+=this._rampDecayTime),void 0!==a&&(a>r?this.control.setTargetAtTime(a,s,this._rampAttackTC):a<r&&this.control.setTargetAtTime(a,s,this._rampDecayTC))},t.Envelope.prototype.connect=function(i){this.connection=i,(i instanceof t.Oscillator||i instanceof t.SoundFile||i instanceof t.AudioIn||i instanceof t.Reverb||i instanceof t.Noise||i instanceof t.Filter||i instanceof t.Delay)&&(i=i.output.gain),i instanceof AudioParam&&i.setValueAtTime(0,e.audiocontext.currentTime),i instanceof t.Signal&&i.setValue(0),this.output.connect(i)},t.Envelope.prototype.disconnect=function(){this.output&&this.output.disconnect()},t.Envelope.prototype.add=function(e){var n=new i(e),o=this.mathOps.length,s=this.output;return t.prototype._mathChain(this,n,o,s,i)},t.Envelope.prototype.mult=function(e){var i=new n(e),o=this.mathOps.length,s=this.output;return t.prototype._mathChain(this,i,o,s,n)},t.Envelope.prototype.scale=function(e,i,n,o){var r=new s(e,i,n,o),a=this.mathOps.length,u=this.output;return t.prototype._mathChain(this,r,a,u,s)},t.Envelope.prototype.dispose=function(){var t=e.soundArray.indexOf(this);e.soundArray.splice(t,1),this.disconnect(),this.control&&(this.control.dispose(),this.control=null);for(var i=1;i<this.mathOps.length;i++)this.mathOps[i].dispose()},t.Env=function(e,i,n,o,s,r){console.warn("WARNING: p5.Env is now deprecated and may be removed in future versions. Please use the new p5.Envelope instead."),t.Envelope.call(this,e,i,n,o,s,r)},t.Env.prototype=Object.create(t.Envelope.prototype)}(),function(){var e=o;function i(){for(var t=e.audiocontext,i=t.createBuffer(1,2048,t.sampleRate),n=i.getChannelData(0),o=0;o<2048;o++)n[o]=1;var s=t.createBufferSource();return s.buffer=i,s.loop=!0,s}t.Pulse=function(n,o){t.Oscillator.call(this,n,"sawtooth"),this.w=o||0,this.osc2=new t.SawOsc(n),this.dNode=e.audiocontext.createDelay(),this.dcOffset=i(),this.dcGain=e.audiocontext.createGain(),this.dcOffset.connect(this.dcGain),this.dcGain.connect(this.output),this.f=n||440;var s=this.w/this.oscillator.frequency.value;this.dNode.delayTime.value=s,this.dcGain.gain.value=1.7*(.5-this.w),this.osc2.disconnect(),this.osc2.panner.disconnect(),this.osc2.amp(-1),this.osc2.output.connect(this.dNode),this.dNode.connect(this.output),this.output.gain.value=1,this.output.connect(this.panner)},t.Pulse.prototype=Object.create(t.Oscillator.prototype),t.Pulse.prototype.width=function(e){if("number"==typeof e){if(e<=1&&e>=0){this.w=e;var i=this.w/this.oscillator.frequency.value;this.dNode.delayTime.value=i}this.dcGain.gain.value=1.7*(.5-this.w)}else{e.connect(this.dNode.delayTime);var n=new t.SignalAdd(-.5);n.setInput(e),(n=(n=n.mult(-1)).mult(1.7)).connect(this.dcGain.gain)}},t.Pulse.prototype.start=function(t,n){var o=e.audiocontext.currentTime,s=n||0;if(!this.started){var r=t||this.f,a=this.oscillator.type;this.oscillator=e.audiocontext.createOscillator(),this.oscillator.frequency.setValueAtTime(r,o),this.oscillator.type=a,this.oscillator.connect(this.output),this.oscillator.start(s+o),this.osc2.oscillator=e.audiocontext.createOscillator(),this.osc2.oscillator.frequency.setValueAtTime(r,s+o),this.osc2.oscillator.type=a,this.osc2.oscillator.connect(this.osc2.output),this.osc2.start(s+o),this.freqNode=[this.oscillator.frequency,this.osc2.oscillator.frequency],this.dcOffset=i(),this.dcOffset.connect(this.dcGain),this.dcOffset.start(s+o),void 0!==this.mods&&void 0!==this.mods.frequency&&(this.mods.frequency.connect(this.freqNode[0]),this.mods.frequency.connect(this.freqNode[1])),this.started=!0,this.osc2.started=!0}},t.Pulse.prototype.stop=function(t){if(this.started){var i=t||0,n=e.audiocontext.currentTime;this.oscillator.stop(i+n),this.osc2.oscillator&&this.osc2.oscillator.stop(i+n),this.dcOffset.stop(i+n),this.started=!1,this.osc2.started=!1}},t.Pulse.prototype.freq=function(t,i,n){if("number"==typeof t){this.f=t;var o=e.audiocontext.currentTime,s=(i=i||0,n=n||0,this.oscillator.frequency.value);this.oscillator.frequency.cancelScheduledValues(o),this.oscillator.frequency.setValueAtTime(s,o+n),this.oscillator.frequency.exponentialRampToValueAtTime(t,n+i+o),this.osc2.oscillator.frequency.cancelScheduledValues(o),this.osc2.oscillator.frequency.setValueAtTime(s,o+n),this.osc2.oscillator.frequency.exponentialRampToValueAtTime(t,n+i+o),this.freqMod&&(this.freqMod.output.disconnect(),this.freqMod=null)}else t.output&&(t.output.disconnect(),t.output.connect(this.oscillator.frequency),t.output.connect(this.osc2.oscillator.frequency),this.freqMod=t)}}(),function(){var e=o;t.Noise=function(e){var o;t.Oscillator.call(this),delete this.f,delete this.freq,delete this.oscillator,o="brown"===e?s:"pink"===e?n:i,this.buffer=o},t.Noise.prototype=Object.create(t.Oscillator.prototype);var i=function(){for(var t=2*e.audiocontext.sampleRate,i=e.audiocontext.createBuffer(1,t,e.audiocontext.sampleRate),n=i.getChannelData(0),o=0;o<t;o++)n[o]=2*Math.random()-1;return i.type="white",i}(),n=function(){var t,i,n,o,s,r,a,u=2*e.audiocontext.sampleRate,c=e.audiocontext.createBuffer(1,u,e.audiocontext.sampleRate),h=c.getChannelData(0);t=i=n=o=s=r=a=0;for(var p=0;p<u;p++){var l=2*Math.random()-1;t=.99886*t+.0555179*l,i=.99332*i+.0750759*l,n=.969*n+.153852*l,o=.8665*o+.3104856*l,s=.55*s+.5329522*l,r=-.7616*r-.016898*l,h[p]=t+i+n+o+s+r+a+.5362*l,h[p]*=.11,a=.115926*l}return c.type="pink",c}(),s=function(){for(var t=2*e.audiocontext.sampleRate,i=e.audiocontext.createBuffer(1,t,e.audiocontext.sampleRate),n=i.getChannelData(0),o=0,s=0;s<t;s++){var r=2*Math.random()-1;n[s]=(o+.02*r)/1.02,o=n[s],n[s]*=3.5}return i.type="brown",i}();t.Noise.prototype.setType=function(t){switch(t){case"white":this.buffer=i;break;case"pink":this.buffer=n;break;case"brown":this.buffer=s;break;default:this.buffer=i}if(this.started){var o=e.audiocontext.currentTime;this.stop(o),this.start(o+.01)}},t.Noise.prototype.getType=function(){return this.buffer.type},t.Noise.prototype.start=function(){this.started&&this.stop(),this.noise=e.audiocontext.createBufferSource(),this.noise.buffer=this.buffer,this.noise.loop=!0,this.noise.connect(this.output);var t=e.audiocontext.currentTime;this.noise.start(t),this.started=!0},t.Noise.prototype.stop=function(){var t=e.audiocontext.currentTime;this.noise&&(this.noise.stop(t),this.started=!1)},t.Noise.prototype.dispose=function(){var t=e.audiocontext.currentTime,i=e.soundArray.indexOf(this);e.soundArray.splice(i,1),this.noise&&(this.noise.disconnect(),this.stop(t)),this.output&&this.output.disconnect(),this.panner&&this.panner.disconnect(),this.output=null,this.panner=null,this.buffer=null,this.noise=null}}(),function(){var e=o;e.inputSources=[],t.AudioIn=function(i){this.input=e.audiocontext.createGain(),this.output=e.audiocontext.createGain(),this.stream=null,this.mediaStream=null,this.currentSource=null,this.enabled=!1,this.amplitude=new t.Amplitude,this.output.connect(this.amplitude.input),window.MediaStreamTrack&&window.navigator.mediaDevices&&window.navigator.mediaDevices.getUserMedia||(i?i():window.alert("This browser does not support MediaStreamTrack and mediaDevices")),e.soundArray.push(this)},t.AudioIn.prototype.start=function(t,i){var n=this;this.stream&&this.stop();
24var o=e.inputSources[n.currentSource],s={audio:{sampleRate:e.audiocontext.sampleRate,echoCancellation:!1}};e.inputSources[this.currentSource]&&(s.audio.deviceId=o.deviceId),window.navigator.mediaDevices.getUserMedia(s).then(function(i){n.stream=i,n.enabled=!0,n.mediaStream=e.audiocontext.createMediaStreamSource(i),n.mediaStream.connect(n.output),n.amplitude.setInput(n.output),t&&t()}).catch(function(t){i?i(t):console.error(t)})},t.AudioIn.prototype.stop=function(){this.stream&&(this.stream.getTracks().forEach(function(t){t.stop()}),this.mediaStream.disconnect(),delete this.mediaStream,delete this.stream)},t.AudioIn.prototype.connect=function(t){t?t.hasOwnProperty("input")?this.output.connect(t.input):t.hasOwnProperty("analyser")?this.output.connect(t.analyser):this.output.connect(t):this.output.connect(e.input)},t.AudioIn.prototype.disconnect=function(){this.output&&(this.output.disconnect(),this.output.connect(this.amplitude.input))},t.AudioIn.prototype.getLevel=function(t){return t&&(this.amplitude.smoothing=t),this.amplitude.getLevel()},t.AudioIn.prototype.amp=function(t,i){if(i){var n=i||0,o=this.output.gain.value;this.output.gain.cancelScheduledValues(e.audiocontext.currentTime),this.output.gain.setValueAtTime(o,e.audiocontext.currentTime),this.output.gain.linearRampToValueAtTime(t,n+e.audiocontext.currentTime)}else this.output.gain.cancelScheduledValues(e.audiocontext.currentTime),this.output.gain.setValueAtTime(t,e.audiocontext.currentTime)},t.AudioIn.prototype.getSources=function(t,i){return new Promise(function(n,o){window.navigator.mediaDevices.enumerateDevices().then(function(i){e.inputSources=i.filter(function(t){return"audioinput"===t.kind}),n(e.inputSources),t&&t(e.inputSources)}).catch(function(t){o(t),i?i(t):console.error("This browser does not support MediaStreamTrack.getSources()")})})},t.AudioIn.prototype.setSource=function(t){e.inputSources.length>0&&t<e.inputSources.length?(this.currentSource=t,console.log("set source to ",e.inputSources[this.currentSource])):console.log("unable to set input source"),this.stream&&this.stream.active&&this.start()},t.AudioIn.prototype.dispose=function(){var t=e.soundArray.indexOf(this);e.soundArray.splice(t,1),this.stop(),this.output&&this.output.disconnect(),this.amplitude&&this.amplitude.disconnect(),delete this.amplitude,delete this.output}}(),function(t){"use strict";t.Negate=function(){this._multiply=this.input=this.output=new t.Multiply(-1)},t.extend(t.Negate,t.SignalBase),t.Negate.prototype.dispose=function(){return t.prototype.dispose.call(this),this._multiply.dispose(),this._multiply=null,this},t.Negate}(i),function(t){"use strict";t.Subtract=function(e){this.createInsOuts(2,0),this._sum=this.input[0]=this.output=new t.Gain,this._neg=new t.Negate,this._param=this.input[1]=new t.Signal(e),this._param.chain(this._neg,this._sum)},t.extend(t.Subtract,t.Signal),t.Subtract.prototype.dispose=function(){return t.prototype.dispose.call(this),this._neg.dispose(),this._neg=null,this._sum.disconnect(),this._sum=null,this._param.dispose(),this._param=null,this},t.Subtract}(i),function(t){"use strict";t.GreaterThanZero=function(){this._thresh=this.output=new t.WaveShaper(function(t){return t<=0?0:1},127),this._scale=this.input=new t.Multiply(1e4),this._scale.connect(this._thresh)},t.extend(t.GreaterThanZero,t.SignalBase),t.GreaterThanZero.prototype.dispose=function(){return t.prototype.dispose.call(this),this._scale.dispose(),this._scale=null,this._thresh.dispose(),this._thresh=null,this},t.GreaterThanZero}(i),function(t){"use strict";t.GreaterThan=function(e){this.createInsOuts(2,0),this._param=this.input[0]=new t.Subtract(e),this.input[1]=this._param.input[1],this._gtz=this.output=new t.GreaterThanZero,this._param.connect(this._gtz)},t.extend(t.GreaterThan,t.Signal),t.GreaterThan.prototype.dispose=function(){return t.prototype.dispose.call(this),this._param.dispose(),this._param=null,this._gtz.dispose(),this._gtz=null,this},t.GreaterThan}(i),function(t){"use strict";t.Abs=function(){this._abs=this.input=this.output=new t.WaveShaper(function(t){return 0===t?0:Math.abs(t)},127)},t.extend(t.Abs,t.SignalBase),t.Abs.prototype.dispose=function(){return t.prototype.dispose.call(this),this._abs.dispose(),this._abs=null,this},t.Abs}(i),function(t){"use strict";t.Modulo=function(e){this.createInsOuts(1,0),this._shaper=new t.WaveShaper(Math.pow(2,16)),this._multiply=new t.Multiply,this._subtract=this.output=new t.Subtract,this._modSignal=new t.Signal(e),this.input.fan(this._shaper,this._subtract),this._modSignal.connect(this._multiply,0,0),this._shaper.connect(this._multiply,0,1),this._multiply.connect(this._subtract,0,1),this._setWaveShaper(e)},t.extend(t.Modulo,t.SignalBase),t.Modulo.prototype._setWaveShaper=function(t){this._shaper.setMap(function(e){return Math.floor((e+1e-4)/t)})},Object.defineProperty(t.Modulo.prototype,"value",{get:function(){return this._modSignal.value},set:function(t){this._modSignal.value=t,this._setWaveShaper(t)}}),t.Modulo.prototype.dispose=function(){return t.prototype.dispose.call(this),this._shaper.dispose(),this._shaper=null,this._multiply.dispose(),this._multiply=null,this._subtract.dispose(),this._subtract=null,this._modSignal.dis
24pose(),this._modSignal=null,this},t.Modulo}(i),function(t){"use strict";t.Pow=function(e){this._exp=this.defaultArg(e,1),this._expScaler=this.input=this.output=new t.WaveShaper(this._expFunc(this._exp),8192)},t.extend(t.Pow,t.SignalBase),Object.defineProperty(t.Pow.prototype,"value",{get:function(){return this._exp},set:function(t){this._exp=t,this._expScaler.setMap(this._expFunc(this._exp))}}),t.Pow.prototype._expFunc=function(t){return function(e){return Math.pow(Math.abs(e),t)}},t.Pow.prototype.dispose=function(){return t.prototype.dispose.call(this),this._expScaler.dispose(),this._expScaler=null,this},t.Pow}(i),function(t){"use strict";t.AudioToGain=function(){this._norm=this.input=this.output=new t.WaveShaper(function(t){return(t+1)/2})},t.extend(t.AudioToGain,t.SignalBase),t.AudioToGain.prototype.dispose=function(){return t.prototype.dispose.call(this),this._norm.dispose(),this._norm=null,this},t.AudioToGain}(i),function(t){"use strict";function e(t,e,i){var n=new t;return i._eval(e[0]).connect(n,0,0),i._eval(e[1]).connect(n,0,1),n}function i(t,e,i){var n=new t;return i._eval(e[0]).connect(n,0,0),n}function n(t){return t?parseFloat(t):void 0}function o(t){return t&&t.args?parseFloat(t.args):void 0}t.Expr=function(){var t=this._replacements(Array.prototype.slice.call(arguments)),e=this._parseInputs(t);this._nodes=[],this.input=new Array(e);for(var i=0;i<e;i++)this.input[i]=this.context.createGain();var n,o=this._parseTree(t);try{n=this._eval(o)}catch(s){throw this._disposeNodes(),new Error("Tone.Expr: Could evaluate expression: "+t)}this.output=n},t.extend(t.Expr,t.SignalBase),t.Expr._Expressions={value:{signal:{regexp:/^\d+\.\d+|^\d+/,method:function(e){return new t.Signal(n(e))}},input:{regexp:/^\$\d/,method:function(t,e){return e.input[n(t.substr(1))]}}},glue:{"(":{regexp:/^\(/},")":{regexp:/^\)/},",":{regexp:/^,/}},func:{abs:{regexp:/^abs/,method:i.bind(this,t.Abs)},mod:{regexp:/^mod/,method:function(e,i){var n=o(e[1]),s=new t.Modulo(n);return i._eval(e[0]).connect(s),s}},pow:{regexp:/^pow/,method:function(e,i){var n=o(e[1]),s=new t.Pow(n);return i._eval(e[0]).connect(s),s}},a2g:{regexp:/^a2g/,method:function(e,i){var n=new t.AudioToGain;return i._eval(e[0]).connect(n),n}}},binary:{"+":{regexp:/^\+/,precedence:1,method:e.bind(this,t.Add)},"-":{regexp:/^\-/,precedence:1,method:function(n,o){return 1===n.length?i(t.Negate,n,o):e(t.Subtract,n,o)}},"*":{regexp:/^\*/,precedence:0,method:e.bind(this,t.Multiply)}},unary:{"-":{regexp:/^\-/,method:i.bind(this,t.Negate)},"!":{regexp:/^\!/,method:i.bind(this,t.NOT)}}},t.Expr.prototype._parseInputs=function(t){var e=t.match(/\$\d/g),i=0;if(null!==e)for(var n=0;n<e.length;n++){var o=parseInt(e[n].substr(1))+1;i=Math.max(i,o)}return i},t.Expr.prototype._replacements=function(t){for(var e=t.shift(),i=0;i<t.length;i++)e=e.replace(/\%/i,t[i]);return e},t.Expr.prototype._tokenize=function(e){for(var i=-1,n=[];e.length>0;){var o=s(e=e.trim());n.push(o),e=e.substr(o.value.length)}function s(e){for(var i in t.Expr._Expressions){var n=t.Expr._Expressions[i];for(var o in n){var s=n[o],r=s.regexp,a=e.match(r);if(null!==a)return{type:i,value:a[0],method:s.method}}}throw new SyntaxError("Tone.Expr: Unexpected token "+e)}return{next:function(){return n[++i]},peek:function(){return n[i+1]}}},t.Expr.prototype._parseTree=function(e){var i=this._tokenize(e),n=this.isUndef.bind(this);function o(t,e){return!n(t)&&"glue"===t.type&&t.value===e}function s(e,i,o){var s=t.Expr._Expressions[i];if(!n(e))for(var r in s){var a=s[r];if(a.regexp.test(e.value)){if(n(o))return!0;if(a.precedence===o)return!0}}return!1}function r(t){var e;n(t)&&(t=5),e=t<0?function t(){var e,a;e=i.peek();if(s(e,"unary"))return e=i.next(),a=t(),{operator:e.value,method:e.method,args:[a]};return function(){var t,e;if(t=i.peek(),n(t))throw new SyntaxError("Tone.Expr: Unexpected termination of expression");if("func"===t.type)return function(t){var e=[];if(!o(i.next(),"("))throw new SyntaxError('Tone.Expr: Expected ( in a function call "'+t.value+'"');o(i.peek(),")")||(e=function(){var t,e=[];for(;t=r(),!n(t)&&(e.push(t),o(i.peek(),","));)i.next();return e}());if(!o(i.next(),")"))throw new SyntaxError('Tone.Expr: Expected ) in a function call "'+t.value+'"');return{method:t.method,args:e,name:name}}(t=i.next());if("value"===t.type)return{method:(t=i.next()).method,args:t.value};if(o(t,"(")){if(i.next(),e=r(),!o(t=i.next(),")"))throw new SyntaxError("Expected )");return e}throw new SyntaxError("Tone.Expr: Parse error, cannot process token "+t.value)}()}():r(t-1);for(var a=i.peek();s(a,"binary",t);)e={operator:(a=i.next()).value,method:a.method,args:[e,r(t-1)]},a=i.peek();return e}return r()},t.Expr.prototype._eval=function(t){if(!this.isUndef(t)){var e=t.method(t.args,this);return this._nodes.push(e),e}},t.Expr.prototype._disposeNodes=function(){for(var t=0;t<this._nodes.length;t++){var e=this._nodes[t];this.isFunction(e.dispose)?e.dispose():this.isFunction(e.disconnect)&&e.disconnect(),e=null,this._nodes[t]=null}this._nodes=null},t.Expr.prototype.dispose=function(){t.prototype.dispose.call(this),this._disposeNodes()},t.Expr}(i),function(t){"use strict";t.EqualPowerGain=function(){this._eqPower=this.input=this.output=new t.WaveShaper(function(t){return Math.abs(t)<.001?0:this.equalPowerScale(t)}.bind(this),4096)},t.extend(t.EqualPowerGain,t.SignalBase),t.EqualPowerGain.prototype.dispose=function(){return t.prototype.dispose.call(this),this._eqPower.dis
24pose(),this._eqPower=null,this},t.EqualPowerGain}(i),g=function(t){"use strict";return t.CrossFade=function(e){this.createInsOuts(2,1),this.a=this.input[0]=new t.Gain,this.b=this.input[1]=new t.Gain,this.fade=new t.Signal(this.defaultArg(e,.5),t.Type.NormalRange),this._equalPowerA=new t.EqualPowerGain,this._equalPowerB=new t.EqualPowerGain,this._invert=new t.Expr("1 - $0"),this.a.connect(this.output),this.b.connect(this.output),this.fade.chain(this._equalPowerB,this.b.gain),this.fade.chain(this._invert,this._equalPowerA,this.a.gain),this._readOnly("fade")},t.extend(t.CrossFade),t.CrossFade.prototype.dispose=function(){return t.prototype.dispose.call(this),this._writable("fade"),this._equalPowerA.dispose(),this._equalPowerA=null,this._equalPowerB.dispose(),this._equalPowerB=null,this.fade.dispose(),this.fade=null,this._invert.dispose(),this._invert=null,this.a.dispose(),this.a=null,this.b.dispose(),this.b=null,this},t.CrossFade}(i),T=function(){var e=o,i=g;return t.Effect=function(){this.ac=e.audiocontext,this.input=this.ac.createGain(),this.output=this.ac.createGain(),this._drywet=new i(1),this.wet=this.ac.createGain(),this.input.connect(this._drywet.a),this.wet.connect(this._drywet.b),this._drywet.connect(this.output),this.connect(),e.soundArray.push(this)},t.Effect.prototype.amp=function(t,i,n){i=i||0,n=n||0;var o=e.audiocontext.currentTime,s=this.output.gain.value;this.output.gain.cancelScheduledValues(o),this.output.gain.linearRampToValueAtTime(s,o+n+.001),this.output.gain.linearRampToValueAtTime(t,o+n+i+.001)},t.Effect.prototype.chain=function(){if(arguments.length>0){this.connect(arguments[0]);for(var t=1;t<arguments.length;t+=1)arguments[t-1].connect(arguments[t])}return this},t.Effect.prototype.drywet=function(t){return void 0!==t&&(this._drywet.fade.value=t),this._drywet.fade.value},t.Effect.prototype.connect=function(e){var i=e||t.soundOut.input;
24this.output.connect(i.input?i.input:i)},t.Effect.prototype.disconnect=function(){this.output&&this.output.disconnect()},t.Effect.prototype.dispose=function(){var t=e.soundArray.indexOf(this);e.soundArray.splice(t,1),this.input&&(this.input.disconnect(),delete this.input),this.output&&(this.output.disconnect(),delete this.output),this._drywet&&(this._drywet.disconnect(),delete this._drywet),this.wet&&(this.wet.disconnect(),delete this.wet),this.ac=void 0},t.Effect}(),x=T,t.Filter=function(t){x.call(this),this.biquad=this.ac.createBiquadFilter(),this.input.connect(this.biquad),this.biquad.connect(this.wet),t&&this.setType(t),this._on=!0,this._untoggledType=this.biquad.type},t.Filter.prototype=Object.create(x.prototype),t.Filter.prototype.process=function(t,e,i,n){t.connect(this.input),this.set(e,i,n)},t.Filter.prototype.set=function(t,e,i){t&&this.freq(t,i),e&&this.res(e,i)},t.Filter.prototype.freq=function(t,e){var i=e||0;return t<=0&&(t=1),"number"==typeof t?(this.biquad.frequency.cancelScheduledValues(this.ac.currentTime+.01+i),this.biquad.frequency.exponentialRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.biquad.frequency),this.biquad.frequency.value},t.Filter.prototype.res=function(t,e){var i=e||0;return"number"==typeof t?(this.biquad.Q.value=t,this.biquad.Q.cancelScheduledValues(this.ac.currentTime+.01+i),this.biquad.Q.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.biquad.Q),this.biquad.Q.value},t.Filter.prototype.gain=function(t,e){var i=e||0;return"number"==typeof t?(this.biquad.gain.value=t,this.biquad.gain.cancelScheduledValues(this.ac.currentTime+.01+i),this.biquad.gain.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.biquad.gain),this.biquad.gain.value},t.Filter.prototype.toggle=function(){return this._on=!this._on,!0===this._on?this.biquad.type=this._untoggledType:!1===this._on&&(this.biquad.type="allpass"),this._on},t.Filter.prototype.setType=function(t){this.biquad.type=t,this._untoggledType=this.biquad.type},t.Filter.prototype.dispose=function(){x.prototype.dispose.apply(this),this.biquad&&(this.biquad.disconnect(),delete this.biquad)},t.LowPass=function(){t.Filter.call(this,"lowpass")},t.LowPass.prototype=Object.create(t.Filter.prototype),t.HighPass=function(){t.Filter.call(this,"highpass")},t.HighPass.prototype=Object.create(t.Filter.prototype),t.BandPass=function(){t.Filter.call(this,"bandpass")},t.BandPass.prototype=Object.create(t.Filter.prototype),b=t.Filter,S=function(){var e=b,i=o,n=function(t,i){e.call(this,"peaking"),this.disconnect(),this.set(t,i),this.biquad.gain.value=0,delete this.input,delete this.output,delete this._drywet,delete this.wet};return(n.prototype=Object.create(e.prototype)).amp=function(){console.warn("`amp()` is not available for p5.EQ bands. Use `.gain()`")},n.prototype.drywet=function(){console.warn("`drywet()` is not available for p5.EQ bands.")},n.prototype.connect=function(e){var i=e||t.soundOut.input;
24this.biquad?this.biquad.connect(i.input?i.input:i):this.output.connect(i.input?i.input:i)},n.prototype.disconnect=function(){this.biquad&&this.biquad.disconnect()},n.prototype.dispose=function(){var t=i.soundArray.indexOf(this);i.soundArray.splice(t,1),this.disconnect(),delete this.biquad},n}(),function(){var e=T,i=S;t.EQ=function(t){var i,n,o;e.call(this),i=3===(t=3===t||8===t?t:3)?Math.pow(2,3):2,this.bands=[];for(var s=0;s<t;s++)s===t-1?(n=21e3,o=.01):0===s?(n=100,o=.1):1===s?(n=3===t?360*i:360,o=1):(n=this.bands[s-1].freq()*i,o=1),this.bands[s]=this._newBand(n,o),s>0?this.bands[s-1].connect(this.bands[s].biquad):this.input.connect(this.bands[s].biquad);this.bands[t-1].connect(this.output)},t.EQ.prototype=Object.create(e.prototype),t.EQ.prototype.process=function(t){t.connect(this.input)},t.EQ.prototype.set=function(){if(arguments.length===2*this.bands.length)for(var t=0;t<arguments.length;t+=2)this.bands[t/2].freq(arguments[t]),this.bands[t/2].gain(arguments[t+1]);else console.error("Argument mismatch. .set() should be called with "+2*this.bands.length+" arguments. (one frequency and gain value pair for each band of the eq)")},t.EQ.prototype._newBand=function(t,e){return new i(t,e)},t.EQ.prototype.dispose=function(){if(e.prototype.dispose.apply(this),this.bands){for(;this.bands.length>0;)this.bands.pop().dispose();delete this.bands}},t.EQ}(),function(){var e=T;t.Panner3D=function(){e.call(this),this.panner=this.ac.createPanner(),this.panner.panningModel="HRTF",this.panner.distanceModel="linear",this.panner.connect(this.output),this.input.connect(this.panner)},t.Panner3D.prototype=Object.create(e.prototype),t.Panner3D.prototype.process=function(t){t.connect(this.input)},t.Panner3D.prototype.set=function(t,e,i,n){return this.positionX(t,n),this.positionY(e,n),this.positionZ(i,n),[this.panner.positionX.value,this.panner.positionY.value,this.panner.positionZ.value]},t.Panner3D.prototype.positionX=function(t,e){var i=e||0;return"number"==typeof t?(this.panner.positionX.value=t,this.panner.positionX.cancelScheduledValues(this.ac.currentTime+.01+i),this.panner.positionX.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.panner.positionX),this.panner.positionX.value},t.Panner3D.prototype.positionY=function(t,e){var i=e||0;return"number"==typeof t?(this.panner.positionY.value=t,this.panner.positionY.cancelScheduledValues(this.ac.currentTime+.01+i),this.panner.positionY.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.panner.positionY),this.panner.positionY.value},t.Panner3D.prototype.positionZ=function(t,e){var i=e||0;return"number"==typeof t?(this.panner.positionZ.value=t,this.panner.positionZ.cancelScheduledValues(this.ac.currentTime+.01+i),this.panner.positionZ.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.panner.positionZ),this.panner.positionZ.value},t.Panner3D.prototype.orient=function(t,e,i,n){return this.orientX(t,n),this.orientY(e,n),this.orientZ(i,n),[this.panner.orientationX.value,this.panner.orientationY.value,this.panner.orientationZ.value]},t.Panner3D.prototype.orientX=function(t,e){var i=e||0;return"number"==typeof t?(this.panner.orientationX.value=t,this.panner.orientationX.cancelScheduledValues(this.ac.currentTime+.01+i),this.panner.orientationX.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.panner.orientationX),this.panner.orientationX.value},t.Panner3D.prototype.orientY=function(t,e){var i=e||0;return"number"==typeof t?(this.panner.orientationY.value=t,this.panner.orientationY.cancelScheduledValues(this.ac.currentTime+.01+i),this.panner.orientationY.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.panner.orientationY),this.panner.orientationY.value},t.Panner3D.prototype.orientZ=function(t,e){var i=e||0;return"number"==typeof t?(this.panner.orientationZ.value=t,this.panner.orientationZ.cancelScheduledValues(this.ac.currentTime+.01+i),this.panner.orientationZ.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.panner.orientationZ),this.panner.orientationZ.value},t.Panner3D.prototype.setFalloff=function(t,e){this.maxDist(t),this.rolloff(e)},t.Panner3D.prototype.maxDist=function(t){return"number"==typeof t&&(this.panner.maxDistance=t),this.panner.maxDistance},t.Panner3D.prototype.rolloff=function(t){return"number"==typeof t&&(this.panner.rolloffFactor=t),this.panner.rolloffFactor},t.Panner3D.dispose=function(){e.prototype.dispose.apply(this),this.panner&&(this.panner.disconnect(),delete this.panner)},t.Panner3D}(),function(){var e=o;t.Listener3D=function(t){this.ac=e.audiocontext,this.listener=this.ac.listener},t.Listener3D.prototype.process=function(t){t.connect(this.input)}
24,t.Listener3D.prototype.position=function(t,e,i,n){return this.positionX(t,n),this.positionY(e,n),this.positionZ(i,n),[this.listener.positionX.value,this.listener.positionY.value,this.listener.positionZ.value]},t.Listener3D.prototype.positionX=function(t,e){var i=e||0;return"number"==typeof t?(this.listener.positionX.value=t,this.listener.positionX.cancelScheduledValues(this.ac.currentTime+.01+i),this.listener.positionX.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.listener.positionX),this.listener.positionX.value},t.Listener3D.prototype.positionY=function(t,e){var i=e||0;return"number"==typeof t?(this.listener.positionY.value=t,this.listener.positionY.cancelScheduledValues(this.ac.currentTime+.01+i),this.listener.positionY.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.listener.positionY),this.listener.positionY.value},t.Listener3D.prototype.positionZ=function(t,e){var i=e||0;return"number"==typeof t?(this.listener.positionZ.value=t,this.listener.positionZ.cancelScheduledValues(this.ac.currentTime+.01+i),this.listener.positionZ.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.listener.positionZ),this.listener.positionZ.value},t.Listener3D.prototype.orient=function(t,e,i,n,o,s,r){return 3===arguments.length||4===arguments.length?(r=arguments[3],this.orientForward(t,e,i,r)):6!==arguments.length&&7!==arguments||(this.orientForward(t,e,i),this.orientUp(n,o,s,r)),[this.listener.forwardX.value,this.listener.forwardY.value,this.listener.forwardZ.value,this.listener.upX.value,this.listener.upY.value,this.listener.upZ.value]},t.Listener3D.prototype.orientForward=function(t,e,i,n){return this.forwardX(t,n),this.forwardY(e,n),this.forwardZ(i,n),[this.listener.forwardX,this.listener.forwardY,this.listener.forwardZ]},t.Listener3D.prototype.orientUp=function(t,e,i,n){return this.upX(t,n),this.upY(e,n),this.upZ(i,n),[this.listener.upX,this.listener.upY,this.listener.upZ]},t.Listener3D.prototype.forwardX=function(t,e){var i=e||0;return"number"==typeof t?(this.listener.forwardX.value=t,this.listener.forwardX.cancelScheduledValues(this.ac.currentTime+.01+i),this.listener.forwardX.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.listener.forwardX),this.listener.forwardX.value},t.Listener3D.prototype.forwardY=function(t,e){var i=e||0;return"number"==typeof t?(this.listener.forwardY.value=t,this.listener.forwardY.cancelScheduledValues(this.ac.currentTime+.01+i),this.listener.forwardY.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.listener.forwardY),this.listener.forwardY.value},t.Listener3D.prototype.forwardZ=function(t,e){var i=e||0;return"number"==typeof t?(this.listener.forwardZ.value=t,this.listener.forwardZ.cancelScheduledValues(this.ac.currentTime+.01+i),this.listener.forwardZ.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.listener.forwardZ),this.listener.forwardZ.value},t.Listener3D.prototype.upX=function(t,e){var i=e||0;return"number"==typeof t?(this.listener.upX.value=t,this.listener.upX.cancelScheduledValues(this.ac.currentTime+.01+i),this.listener.upX.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.listener.upX),this.listener.upX.value},t.Listener3D.prototype.upY=function(t,e){var i=e||0;return"number"==typeof t?(this.listener.upY.value=t,this.listener.upY.cancelScheduledValues(this.ac.currentTime+.01+i),this.listener.upY.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.listener.upY),this.listener.upY.value},t.Listener3D.prototype.upZ=function(t,e){var i=e||0;return"number"==typeof t?(this.listener.upZ.value=t,this.listener.upZ.cancelScheduledValues(this.ac.currentTime+.01+i),this.listener.upZ.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):t&&t.connect(this.listener.upZ),this.listener.upZ.value},t.Listener3D}(),function(){var e=b,i=T;t.Delay=function(){i.call(this),this._split=this.ac.createChannelSplitter(2),this._merge=this.ac.createChannelMerger(2),this._leftGain=this.ac.createGain(),this._rightGain=this.ac.createGain(),this.leftDelay=this.ac.createDelay(),this.rightDelay=this.ac.createDelay(),this._leftFilter=new e,this._rightFilter=new e,this._leftFilter.disconnect(),this._rightFilter.disconnect(),this._leftFilter.biquad.frequency.setValueAtTime(1200,this.ac.currentTime),this._rightFilter.biquad.frequency.setValueAtTime(1200,this.ac.currentTime),this._leftFilter.biquad.Q.setValueAtTime(.3,this.ac.currentTime),this._rightFilter.biquad.Q.setValueAtTime(.3,this.ac.currentTime),this.input.connect(this._split),this.leftDelay.connect(this._leftGain),this.rightDelay.connect(this._rightGain),this._leftGain.connect(this._leftFilter.input),this._rightGain.connect(this._rightFilter.input),this._merge.connect(this.wet),this._leftFilter.biquad.gain.setValueAtTime(1,this.ac.currentTime),this._rightFilter.biquad.gain.setValueAtTime(1,this.ac.currentTime),this.setType(0),this._maxDelay=this.leftDelay.delayTime.maxValue,this.feedback(.5)},t.Delay.prototype=Object.create(i.prototype),t.Delay.prototype.process=function(t,e,
24i,n){var o=i||0,s=e||0;if(o>=1)throw new Error("Feedback value will force a positive feedback loop.");if(s>=this._maxDelay)throw new Error("Delay Time exceeds maximum delay time of "+this._maxDelay+" second.");t.connect(this.input),this.leftDelay.delayTime.setValueAtTime(s,this.ac.currentTime),this.rightDelay.delayTime.setValueAtTime(s,this.ac.currentTime),this._leftGain.gain.value=o,this._rightGain.gain.value=o,n&&(this._leftFilter.freq(n),this._rightFilter.freq(n))},t.Delay.prototype.delayTime=function(t){"number"!=typeof t?(t.connect(this.leftDelay.delayTime),t.connect(this.rightDelay.delayTime)):(this.leftDelay.delayTime.cancelScheduledValues(this.ac.currentTime),this.rightDelay.delayTime.cancelScheduledValues(this.ac.currentTime),this.leftDelay.delayTime.linearRampToValueAtTime(t,this.ac.currentTime),this.rightDelay.delayTime.linearRampToValueAtTime(t,this.ac.currentTime))},t.Delay.prototype.feedback=function(t){if(t&&"number"!=typeof t)t.connect(this._leftGain.gain),t.connect(this._rightGain.gain);else{if(t>=1)throw new Error("Feedback value will force a positive feedback loop.");"number"==typeof t&&(this._leftGain.gain.value=t,this._rightGain.gain.value=t)}return this._leftGain.gain.value},t.Delay.prototype.filter=function(t,e){this._leftFilter.set(t,e),this._rightFilter.set(t,e)},t.Delay.prototype.setType=function(t){switch(1===t&&(t="pingPong"),this._split.disconnect(),this._leftFilter.disconnect(),this._rightFilter.disconnect(),this._split.connect(this.leftDelay,0),this._split.connect(this.rightDelay,1),t){case"pingPong":this._rightFilter.setType(this._leftFilter.biquad.type),this._leftFilter.output.connect(this._merge,0,0),this._rightFilter.output.connect(this._merge,0,1),this._leftFilter.output.connect(this.rightDelay),this._rightFilter.output.connect(this.leftDelay);break;default:this._leftFilter.output.connect(this._merge,0,0),this._rightFilter.output.connect(this._merge,0,1),this._leftFilter.output.connect(this.leftDelay),this._rightFilter.output.connect(this.rightDelay)}},t.Delay.prototype.dispose=function(){i.prototype.dispose.apply(this),this._split.disconnect(),this._leftFilter.dispose(),this._rightFilter.dispose(),this._merge.disconnect(),this._leftGain.disconnect(),this._rightGain.disconnect(),this.leftDelay.disconnect(),this.rightDelay.disconnect(),this._split=void 0,this._leftFilter=void 0,this._rightFilter=void 0,this._merge=void 0,this._leftGain=void 0,this._rightGain=void 0,this.leftDelay=void 0,this.rightDelay=void 0}}(),function(){var e=r,i=T;t.Reverb=function(){i.call(this),this._initConvolverNode(),this.input.gain.value=.5,this._seconds=3,this._decay=2,this._reverse=!1,this._buildImpulse()},t.Reverb.prototype=Object.create(i.prototype),t.Reverb.prototype._initConvolverNode=function(){this.convolverNode=this.ac.createConvolver(),this.input.connect(this.convolverNode),this.convolverNode.connect(this.wet)},t.Reverb.prototype._teardownConvolverNode=function(){this.convolverNode&&(this.convolverNode.disconnect(),delete this.convolverNode)},t.Reverb.prototype._setBuffer=function(t){this._teardownConvolverNode(),this._initConvolverNode(),this.convolverNode.buffer=t},t.Reverb.prototype.process=function(t,e,i,n){t.connect(this.input);var o=!1;e&&(this._seconds=e,o=!0),i&&(this._decay=i),n&&(this._reverse=n),o&&this._buildImpulse()},t.Reverb.prototype.set=function(t,e,i){var n=!1;t&&(this._seconds=t,n=!0),e&&(this._decay=e),i&&(this._reverse=i),n&&this._buildImpulse()},t.Reverb.prototype._buildImpulse=function(){var t,e,i=this.ac.sampleRate,n=i*this._seconds,o=this._decay,s=this.ac.createBuffer(2,n,i),r=s.getChannelData(0),a=s.getChannelData(1);for(e=0;e<n;e++)t=this._reverse?n-e:e,r[e]=(2*Math.random()-1)*Math.pow(1-t/n,o),a[e]=(2*Math.random()-1)*Math.pow(1-t/n,o);this._setBuffer(s)},t.Reverb.prototype.dispose=function(){i.prototype.dispose.apply(this),this._teardownConvolverNode()},t.Convolver=function(e,i,n){t.Reverb.call(this),this._initConvolverNode(),this.input.gain.value=.5,e?(this.impulses=[],this._loadBuffer(e,i,n)):(this._seconds=3,this._decay=2,this._reverse=!1,this._buildImpulse())},t.Convolver.prototype=Object.create(t.Reverb.prototype),t.prototype.registerPreloadMethod("createConvolver",t.prototype),t.prototype.createConvolver=function(e,i,n){window.location.origin.indexOf("file://")>-1&&"undefined"===window.cordova&&alert("This sketch may require a server to load external files. Please see http://bit.ly/1qcInwS");var o=this,s=new t.Convolver(e,function(t){"function"==typeof i&&i(t),"function"==typeof o._decrementPreload&&o._decrementPreload()},n);return s.impulses=[],s},t.Convolver.prototype._loadBuffer=function(i,n,o){i=t.prototype._checkFileFormats(i);var s=this,r=(new Error).stack,a=t.prototype.getAudioContext(),u=new XMLHttpRequest;u.open("GET",i,!0),u.responseType="arraybuffer",u.onload=function(){if(200===u.status)a.decodeAudioData(u.response,function(t){var e={},o=i.split("/");e.name=o[o.length-1],e.audioBuffer=t,s.impulses.push(e),s._setBuffer(e.audioBuffer),n&&n(e)},function(){var t=new e("decodeAudioData",r,s.url),i="AudioContext error at decodeAudioData for "+s.url;o?(t.msg=i,o(t)):console.error(i+"\n The error stack trace includes: \n"+t.stack)});else{var t=new e("loadConvolver",r,s.url),c="Unable to load "+s.url+". The request status was: "+u.status+" ("+u.statusText+")";o?(t.message=c,o(t)):console.error(c+"\n The error stack trace includes: \n"+t.stack)}},u.onerror=function(){var t=new e("loadConvolver",r,s.url),i="There was no response from the server at "+s.url+". Check the url and internet connectivity.";o?(t.message=i,o(t)):console.error(i+"\n The error stack trace includes: \n"+t.stack)},u.send()},t.Convolver.prototype.set=null,t.Convolver.prototype.process=function(t){t.connect(this.input)},t.Convolver.prototype.impulses=[],t.Convolver.prototype.addImpulse=function(t,e,
24i){window.location.origin.indexOf("file://")>-1&&"undefined"===window.cordova&&alert("This sketch may require a server to load external files. Please see http://bit.ly/1qcInwS"),this._loadBuffer(t,e,i)},t.Convolver.prototype.resetImpulse=function(t,e,i){window.location.origin.indexOf("file://")>-1&&"undefined"===window.cordova&&alert("This sketch may require a server to load external files. Please see http://bit.ly/1qcInwS"),this.impulses=[],this._loadBuffer(t,e,i)},t.Convolver.prototype.toggleImpulse=function(t){if("number"==typeof t&&t<this.impulses.length&&this._setBuffer(this.impulses[t].audioBuffer),"string"==typeof t)for(var e=0;e<this.impulses.length;e++)if(this.impulses[e].name===t){this._setBuffer(this.impulses[e].audioBuffer);break}},t.Convolver.prototype.dispose=function(){for(var e in t.Reverb.prototype.dispose.apply(this),this.impulses)this.impulses[e]&&(this.impulses[e]=null)}}(),function(t){"use strict";t.TimelineState=function(e){t.Timeline.call(this),this._initial=e},t.extend(t.TimelineState,t.Timeline),t.TimelineState.prototype.getValueAtTime=function(t){var e=this.get(t);return null!==e?e.state:this._initial},t.TimelineState.prototype.setStateAtTime=function(t,e){this.add({state:t,time:e})},t.TimelineState}(i),w=function(t){"use strict";return t.Clock=function(){t.Emitter.call(this);var e=this.optionsObject(arguments,["callback","frequency"],t.Clock.defaults);this.callback=e.callback,this._nextTick=0,this._lastState=t.State.Stopped,this.frequency=new t.TimelineSignal(e.frequency,t.Type.Frequency),this._readOnly("frequency"),this.ticks=0,this._state=new t.TimelineState(t.State.Stopped),this._boundLoop=this._loop.bind(this),this.context.on("tick",this._boundLoop)},t.extend(t.Clock,t.Emitter),t.Clock.defaults={callback:t.noOp,frequency:1,lookAhead:"auto"},Object.defineProperty(t.Clock.prototype,"state",{get:function(){return this._state.getValueAtTime(this.now())}}),t.Clock.prototype.start=function(e,i){return e=this.toSeconds(e),this._state.getValueAtTime(e)!==t.State.Started&&this._state.add({state:t.State.Started,time:e,offset:i}),this},t.Clock.prototype.stop=function(e){return e=this.toSeconds(e),this._state.cancel(e),this._state.setStateAtTime(t.State.Stopped,e),this},t.Clock.prototype.pause=function(e){return e=this.toSeconds(e),this._state.getValueAtTime(e)===t.State.Started&&this._state.setStateAtTime(t.State.Paused,e),this},t.Clock.prototype._loop=function(){for(var e=this.now()+this.context.lookAhead+this.context.updateInterval+2*this.context.lag;e>this._nextTick&&this._state;){var i=this._state.getValueAtTime(this._nextTick);if(i!==this._lastState){this._lastState=i;var n=this._state.get(this._nextTick);i===t.State.Started?(this._nextTick=n.time,this.isUndef(n.offset)||(this.ticks=n.offset),this.emit("start",n.time,this.ticks)):i===t.State.Stopped?(this.ticks=0,this.emit("stop",n.time)):i===t.State.Paused&&this.emit("pause",n.time)}var o=this._nextTick;this.frequency&&(this._nextTick+=1/this.frequency.getValueAtTime(this._nextTick),i===t.State.Started&&(this.callback(o),this.ticks++))}},t.Clock.prototype.getStateAtTime=function(t){return t=this.toSeconds(t),this._state.getValueAtTime(t)},t.Clock.prototype.dispose=function(){t.Emitter.prototype.dispose.call(this),this.context.off("tick",this._boundLoop),this._writable("frequency"),this.frequency.dispose(),this.frequency=null,this._boundLoop=null,this._nextTick=1/0,this.callback=null,this._state.dispose(),this._state=null},t.Clock}(i),function(){var e=o,i=w;t.Metro=function(){this.clock=new i({callback:this.ontick.bind(this)}),this.syncedParts=[],this.bpm=120,this._init(),this.prevTick=0,this.tatumTime=0,this.tickCallback=function(){}},t.Metro.prototype.ontick=function(t){var i=t-this.prevTick,n=t-e.audiocontext.currentTime;if(!(i-this.tatumTime<=-.02)){this.prevTick=t;var o=this;this.syncedParts.forEach(function(t){t.isPlaying&&(t.incrementStep(n),t.phrases.forEach(function(t){var e=t.sequence,i=o.metroTicks%e.length;0!==e[i]&&(o.metroTicks<e.length||!t.looping)&&t.callback(n,e[i])}))}),this.metroTicks+=1,this.tickCallback(n)}},t.Metro.prototype.setBPM=function(t,i){var n=60/(t*this.tatums),o=e.audiocontext.currentTime;this.tatumTime=n;i=i||0;this.clock.frequency.setValueAtTime(this.clock.frequency.value,o),this.clock.frequency.linearRampToValueAtTime(t,o+i),this.bpm=t},t.Metro.prototype.getBPM=function(){return this.clock.getRate()/this.tatums*60}
24,t.Metro.prototype._init=function(){this.metroTicks=0},t.Metro.prototype.resetSync=function(t){this.syncedParts=[t]},t.Metro.prototype.pushSync=function(t){this.syncedParts.push(t)},t.Metro.prototype.start=function(t){var i=t||0,n=e.audiocontext.currentTime;this.clock.start(n+i),this.setBPM(this.bpm)},t.Metro.prototype.stop=function(t){var i=t||0,n=e.audiocontext.currentTime;this.clock.stop(n+i)},t.Metro.prototype.beatLength=function(t){this.tatums=1/t/4}}(),function(){var e=o,i=120;function n(t){t.currentPart++,t.currentPart>=t.parts.length?(t.scoreStep=0,t.onended()):(t.scoreStep=0,t.parts[t.currentPart-1].stop(),t.parts[t.currentPart].start())}t.prototype.setBPM=function(t,n){for(var o in i=t,e.parts)e.parts[o]&&e.parts[o].setBPM(t,n)},t.Phrase=function(t,e,i){this.phraseStep=0,this.name=t,this.callback=e,this.sequence=i},t.Part=function(n,o){this.length=n||0,this.partStep=0,this.phrases=[],this.isPlaying=!1,this.noLoop(),this.tatums=o||.0625,this.metro=new t.Metro,this.metro._init(),this.metro.beatLength(this.tatums),this.metro.setBPM(i),e.parts.push(this),this.callback=function(){}},t.Part.prototype.setBPM=function(t,e){this.metro.setBPM(t,e)},t.Part.prototype.getBPM=function(){return this.metro.getBPM()},t.Part.prototype.start=function(t){if(!this.isPlaying){this.isPlaying=!0,this.metro.resetSync(this);var e=t||0;this.metro.start(e)}},t.Part.prototype.loop=function(t){this.looping=!0,this.onended=function(){this.partStep=0};var e=t||0;this.start(e)},t.Part.prototype.noLoop=function(){this.looping=!1,this.onended=function(){this.stop()}},t.Part.prototype.stop=function(t){this.partStep=0,this.pause(t)},t.Part.prototype.pause=function(t){this.isPlaying=!1;var e=t||0;this.metro.stop(e)},t.Part.prototype.addPhrase=function(e,i,n){var o;if(3===arguments.length)o=new t.Phrase(e,i,n);else{if(!(arguments[0]instanceof t.Phrase))throw"invalid input. addPhrase accepts name, callback, array or a p5.Phrase";o=arguments[0]}this.phrases.push(o),o.sequence.length>this.length&&(this.length=o.sequence.length)},t.Part.prototype.removePhrase=function(t){for(var e in this.phrases)this.phrases[e].name===t&&this.phrases.splice(e,1)},t.Part.prototype.getPhrase=function(t){for(var e in this.phrases)if(this.phrases[e].name===t)return this.phrases[e]},t.Part.prototype.replaceSequence=function(t,e){for(var i in this.phrases)this.phrases[i].name===t&&(this.phrases[i].sequence=e)},t.Part.prototype.incrementStep=function(t){this.partStep<this.length-1?(this.callback(t),this.partStep+=1):this.looping||this.partStep!==this.length-1||(console.log("done"),this.onended())},t.Part.prototype.onStep=function(t){this.callback=t},t.Score=function(){this.parts=[],this.currentPart=0;var t=this;for(var e in arguments)arguments[e]&&this.parts[e]&&(this.parts[e]=arguments[e],this.parts[e].nextPart=this.parts[e+1],this.parts[e].onended=function(){t.resetPart(e),n(t)});this.looping=!1},t.Score.prototype.onended=function(){this.looping?this.parts[0].start():this.parts[this.parts.length-1].onended=function(){this.stop(),this.resetParts()},this.currentPart=0},t.Score.prototype.start=function(){this.parts[this.currentPart].start(),this.scoreStep=0},t.Score.prototype.stop=function(){this.parts[this.currentPart].stop(),this.currentPart=0,this.scoreStep=0},t.Score.prototype.pause=function(){this.parts[this.currentPart].stop()},t.Score.prototype.loop=function(){this.looping=!0,this.start()},t.Score.prototype.noLoop=function(){this.looping=!1},t.Score.prototype.resetParts=function(){var t=this;this.parts.forEach(function(e){t.resetParts[e]})},t.Score.prototype.resetPart=function(t){for(var e in this.parts[t].stop(),this.parts[t].partStep=0,this.parts[t].phrases)this.parts[t]&&(this.parts[t].phrases[e].phraseStep=0)},t.Score.prototype.setBPM=function(t,e){for(var i in this.parts)this.parts[i]&&this.parts[i].setBPM(t,e)}}(),function(){var e=o,i=w;t.SoundLoop=function(t,n){this.callback=t,this.musicalTimeMode="number"!=typeof this._interval,this._interval=n||1,this._timeSignature=4,this._bpm=60,this.isPlaying=!1,this.maxIterations=1/0;var o=this;this.clock=new i({callback:function(t){var i=t-e.audiocontext.currentTime;i>0&&o.iterations<=o.maxIterations&&o.callback(i)},frequency:this._calcFreq()})},t.SoundLoop.prototype.start=function(t){var i=t||0,n=e.audiocontext.currentTime;this.isPlaying||(this.clock.start(n+i),this.isPlaying=!0)},t.SoundLoop.prototype.stop=function(t){var i=t||0,n=e.audiocontext.currentTime;this.isPlaying&&(this.clock.stop(n+i),this.isPlaying=!1)},t.SoundLoop.prototype.pause=function(t){var i=t||0,n=e.audiocontext.currentTime;this.isPlaying&&(this.clock.pause(n+i),this.isPlaying=!1)},t.SoundLoop.prototype.syncedStart=function(t,i){var n=i||0,o=e.audiocontext.currentTime;if(t.isPlaying){if(t.isPlaying){var s=t.clock._nextTick-e.audiocontext.currentTime;this.clock.start(o+s),this.isPlaying=!0}}else t.clock.start(o+n),t.isPlaying=!0,this.clock.start(o+n),this.isPlaying=!0},t.SoundLoop.prototype._update=function(){this.clock.frequency.value=this._calcFreq()},t.SoundLoop.prototype._calcFreq=function(){return"number"==typeof this._interval?(this.musicalTimeMode=!1,1/this._interval):"string"==typeof this._interval?(this.musicalTimeMode=!0,this._bpm/60/this._convertNotation(this._interval)*(this._timeSignature/4)):void 0},t.SoundLoop.prototype._convertNotation=function(t){var e=t.slice(-1);switch(t=Number(t.slice(0,-1)),e){case"m":return this._measure(t);case"n":return this._note(t);default:console.warn("Specified interval is not formatted correctly. See Tone.js timing reference for more info: https://github.com/Tonejs/Tone.js/wiki/Time")}},t.SoundLoop.prototype._measure=function(t){return t*this._timeSignature},t.SoundLoop.prototype._note=function(t){return this._timeSignature/t},Object.defineProperty(t.SoundLoop.prototype,"bpm",{get:function(){return this._bpm},set:function(t){this.musicalTimeMode||console.warn('Changing the BPM in "seconds" mode has no effect. BPM is only relevant in musicalTimeMode when the interval is specified as a string ("2n", "4n", "1m"...etc)'),this._bpm=t,this._update()}}),Object.defineProperty(t.SoundLoop.prototype,"timeSignature",{get:function(){return this._timeSignature},set:function(t){this.musicalTimeMode||console.warn('Changing the timeSignature in "seconds" mode has no effect. BPM is only relevant in musicalTimeMode when the interval is specified as a string ("2n", "4n", "1m"...etc)'),this._timeSignature=t,this._update()}}),Object.defineProperty(t.SoundLoop.prototype,"interval",{get:function(){return this._interval},set:function(t){this.musicalTimeMode="Number"!=typeof t,this._interval=t,this._update()}}),Object.defineProperty(t.SoundLoop.prototype,"iterations",{get:function(){return this.clock.ticks}}),t.SoundLoop}(),function(){"use strict";var e=T;t.Compressor=function(){e.call(this),this.compressor=this.ac.createDynamicsCompressor(),this.input.connect(this.compressor),this.compressor.connect(this.wet)},t.Compressor.prototype=Object.create(e.prototype),t.Compressor.prototype.process=function(t,e,
24i,n,o,s){t.connect(this.input),this.set(e,i,n,o,s)},t.Compressor.prototype.set=function(t,e,i,n,o){void 0!==t&&this.attack(t),void 0!==e&&this.knee(e),void 0!==i&&this.ratio(i),void 0!==n&&this.threshold(n),void 0!==o&&this.release(o)},t.Compressor.prototype.attack=function(t,e){var i=e||0;return"number"==typeof t?(this.compressor.attack.value=t,this.compressor.attack.cancelScheduledValues(this.ac.currentTime+.01+i),this.compressor.attack.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):void 0!==t&&t.connect(this.compressor.attack),this.compressor.attack.value},t.Compressor.prototype.knee=function(t,e){var i=e||0;return"number"==typeof t?(this.compressor.knee.value=t,this.compressor.knee.cancelScheduledValues(this.ac.currentTime+.01+i),this.compressor.knee.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):void 0!==t&&t.connect(this.compressor.knee),this.compressor.knee.value},t.Compressor.prototype.ratio=function(t,e){var i=e||0;return"number"==typeof t?(this.compressor.ratio.value=t,this.compressor.ratio.cancelScheduledValues(this.ac.currentTime+.01+i),this.compressor.ratio.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):void 0!==t&&t.connect(this.compressor.ratio),this.compressor.ratio.value},t.Compressor.prototype.threshold=function(t,e){var i=e||0;return"number"==typeof t?(this.compressor.threshold.value=t,this.compressor.threshold.cancelScheduledValues(this.ac.currentTime+.01+i),this.compressor.threshold.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):void 0!==t&&t.connect(this.compressor.threshold),this.compressor.threshold.value},t.Compressor.prototype.release=function(t,e){var i=e||0;return"number"==typeof t?(this.compressor.release.value=t,this.compressor.release.cancelScheduledValues(this.ac.currentTime+.01+i),this.compressor.release.linearRampToValueAtTime(t,this.ac.currentTime+.02+i)):"undefined"!=typeof number&&t.connect(this.compressor.release),this.compressor.release.value},t.Compressor.prototype.reduction=function(){return this.compressor.reduction.value},t.Compressor.prototype.dispose=function(){e.prototype.dispose.apply(this),this.compressor&&(this.compressor.disconnect(),delete this.compressor)},t.Compressor}(),function(){var e=o,i=s.convertToWav,n=e.audiocontext;t.SoundRecorder=function(){this.input=n.createGain(),this.output=n.createGain(),this.recording=!1,this.bufferSize=1024,this._channels=2,this._clear(),this._jsNode=n.createScriptProcessor(this.bufferSize,this._channels,2),this._jsNode.onaudioprocess=this._audioprocess.bind(this),this._callback=function(){},this._jsNode.connect(t.soundOut._silentNode),this.setInput(),e.soundArray.push(this)},t.SoundRecorder.prototype.setInput=function(e){this.input.disconnect(),this.input=null,this.input=n.createGain(),this.input.connect(this._jsNode),this.input.connect(this.output),e?e.connect(this.input):t.soundOut.output.connect(this.input)},t.SoundRecorder.prototype.record=function(t,e,i){this.recording=!0,e&&(this.sampleLimit=Math.round(e*n.sampleRate)),t&&i?this._callback=function(){this.buffer=this._getBuffer(),t.setBuffer(this.buffer),i()}:t&&(this._callback=function(){this.buffer=this._getBuffer(),t.setBuffer(this.buffer)})},t.SoundRecorder.prototype.stop=function(){this.recording=!1,this._callback(),this._clear()},t.SoundRecorder.prototype._clear=function(){this._leftBuffers=[],this._rightBuffers=[],this.recordedSamples=0,this.sampleLimit=null},t.SoundRecorder.prototype._audioprocess=function(t){if(!1!==this.recording&&!0===this.recording)if(this.sampleLimit&&this.recordedSamples>=this.sampleLimit)this.stop();else{var e=t.inputBuffer.getChannelData(0),i=t.inputBuffer.getChannelData(1);this._leftBuffers.push(new Float32Array(e)),this._rightBuffers.push(new Float32Array(i)),this.recordedSamples+=this.bufferSize}},t.SoundRecorder.prototype._getBuffer=function(){var t=[];return t.push(this._mergeBuffers(this._leftBuffers)),t.push(this._mergeBuffers(this._rightBuffers)),t}
24,t.SoundRecorder.prototype._mergeBuffers=function(t){for(var e=new Float32Array(this.recordedSamples),i=0,n=t.length,o=0;o<n;o++){var s=t[o];e.set(s,i),i+=s.length}return e},t.SoundRecorder.prototype.dispose=function(){this._clear();var t=e.soundArray.indexOf(this);e.soundArray.splice(t,1),this._callback=function(){},this.input&&this.input.disconnect(),this.input=null,this._jsNode=null},t.prototype.saveSound=function(e,n){const o=i(e.buffer);t.prototype.writeFile([o],n,"wav")}}(),t.PeakDetect=function(t,e,i,n){this.framesPerPeak=n||20,this.framesSinceLastPeak=0,this.decayRate=.95,this.threshold=i||.35,this.cutoff=0,this.cutoffMult=1.5,this.energy=0,this.penergy=0,this.currentValue=0,this.isDetected=!1,this.f1=t||40,this.f2=e||2e4,this._onPeak=function(){}},t.PeakDetect.prototype.update=function(t){var e=this.energy=t.getEnergy(this.f1,this.f2)/255;e>this.cutoff&&e>this.threshold&&e-this.penergy>0?(this._onPeak(),this.isDetected=!0,this.cutoff=e*this.cutoffMult,this.framesSinceLastPeak=0):(this.isDetected=!1,this.framesSinceLastPeak<=this.framesPerPeak?this.framesSinceLastPeak++:(this.cutoff*=this.decayRate,this.cutoff=Math.max(this.cutoff,this.threshold))),this.currentValue=e,this.penergy=e},t.PeakDetect.prototype.onPeak=function(t,e){var i=this;i._onPeak=function(){t(i.energy,e)}},function(){var e=o;t.Gain=function(){this.ac=e.audiocontext,this.input=this.ac.createGain(),this.output=this.ac.createGain(),this.input.gain.value=.5,this.input.connect(this.output),e.soundArray.push(this)},t.Gain.prototype.setInput=function(t){t.connect(this.input)},t.Gain.prototype.connect=function(e){var i=e||t.soundOut.input;
24this.output.connect(i.input?i.input:i)},t.Gain.prototype.disconnect=function(){this.output&&this.output.disconnect()},t.Gain.prototype.amp=function(t,i,n){i=i||0,n=n||0;var o=e.audiocontext.currentTime,s=this.output.gain.value;this.output.gain.cancelScheduledValues(o),this.output.gain.linearRampToValueAtTime(s,o+n),this.output.gain.linearRampToValueAtTime(t,o+n+i)},t.Gain.prototype.dispose=function(){var t=e.soundArray.indexOf(this);e.soundArray.splice(t,1),this.output&&(this.output.disconnect(),delete this.output),this.input&&(this.input.disconnect(),delete this.input)}}(),A=function(){var e=o;return t.AudioVoice=function(){this.ac=e.audiocontext,this.output=this.ac.createGain(),this.connect(),e.soundArray.push(this)},t.AudioVoice.prototype.play=function(t,e,i,n){},t.AudioVoice.prototype.triggerAttack=function(t,e,i){},t.AudioVoice.prototype.triggerRelease=function(t){},t.AudioVoice.prototype.amp=function(t,e){},t.AudioVoice.prototype.connect=function(t){var i=t||e.input;this.output.connect(i.input?i.input:i)},t.AudioVoice.prototype.disconnect=function(){this.output.disconnect()},t.AudioVoice.prototype.dispose=function(){this.output&&(this.output.disconnect(),delete this.output)},t.AudioVoice}(),function(){var e=o,i=A,n=s.noteToFreq;t.MonoSynth=function(){i.call(this),this.oscillator=new t.Oscillator,this.env=new t.Envelope,this.env.setRange(1,0),this.env.setExp(!0),this.setADSR(.02,.25,.05,.35),this.oscillator.disconnect(),this.oscillator.connect(this.output),this.env.disconnect(),this.env.setInput(this.output.gain),this.oscillator.output.gain.value=1,this.oscillator.start(),this.connect(),e.soundArray.push(this)},t.MonoSynth.prototype=Object.create(t.AudioVoice.prototype),t.MonoSynth.prototype.play=function(t,e,i,n){this.triggerAttack(t,e,~~i),this.triggerRelease(~~i+(n||.15))},t.MonoSynth.prototype.triggerAttack=function(t,e,i){i=~~i;var o=n(t),s=e||.1;this.oscillator.freq(o,0,i),this.env.ramp(this.output.gain,i,s)},t.MonoSynth.prototype.triggerRelease=function(t){t=t||0;this.env.ramp(this.output.gain,t,0)},t.MonoSynth.prototype.setADSR=function(t,e,i,n){this.env.setADSR(t,e,i,n)},Object.defineProperties(t.MonoSynth.prototype,{attack:{get:function(){return this.env.aTime},set:function(t){this.env.setADSR(t,this.env.dTime,this.env.sPercent,this.env.rTime)}},decay:{get:function(){return this.env.dTime},set:function(t){this.env.setADSR(this.env.aTime,t,this.env.sPercent,this.env.rTime)}},sustain:{get:function(){return this.env.sPercent},set:function(t){this.env.setADSR(this.env.aTime,this.env.dTime,t,this.env.rTime)}},release:{get:function(){return this.env.rTime},set:function(t){this.env.setADSR(this.env.aTime,this.env.dTime,this.env.sPercent,t)}}}),t.MonoSynth.prototype.amp=function(t,e){var i=e||0;return void 0!==t&&this.oscillator.amp(t,i),this.oscillator.amp().value},t.MonoSynth.prototype.connect=function(t){var i=t||e.input;
24this.output.connect(i.input?i.input:i)},t.MonoSynth.prototype.disconnect=function(){this.output&&this.output.disconnect()},t.MonoSynth.prototype.dispose=function(){i.prototype.dispose.apply(this),this.env&&this.env.dispose(),this.oscillator&&this.oscillator.dispose()}}(),function(){var e=o,i=_,n=s.noteToFreq;t.PolySynth=function(n,o){this.audiovoices=[],this.notes={},this._newest=0,this._oldest=0,this.maxVoices=o||8,this.AudioVoice=void 0===n?t.MonoSynth:n,this._voicesInUse=new i(0),this.output=e.audiocontext.createGain(),this.connect(),this._allocateVoices(),e.soundArray.push(this)},t.PolySynth.prototype._allocateVoices=function(){for(var t=0;t<this.maxVoices;t++)this.audiovoices.push(new this.AudioVoice),this.audiovoices[t].disconnect(),this.audiovoices[t].connect(this.output)},t.PolySynth.prototype.play=function(t,e,i,n){n=n||1;this.noteAttack(t,e,i),this.noteRelease(t,i+n)},t.PolySynth.prototype.noteADSR=function(t,i,n,o,s,r){var a=e.audiocontext.currentTime+(r=r||0);this.audiovoices[this.notes[t].getValueAtTime(a)].setADSR(i,n,o,s)},t.PolySynth.prototype.setADSR=function(t,e,i,n){this.audiovoices.forEach(function(o){o.setADSR(t,e,i,n)})},t.PolySynth.prototype.noteAttack=function(o,s,r){r=~~r;var a,u=e.audiocontext.currentTime+r,c=n(o),h=s||.1;if(this.notes[c]&&null!==this.notes[c].getValueAtTime(u)&&this.noteRelease(c,0),this._voicesInUse.getValueAtTime(u)<this.maxVoices)a=Math.max(~~this._voicesInUse.getValueAtTime(u),0);else{a=this._oldest;var p=t.prototype.freqToMidi(this.audiovoices[this._oldest].oscillator.freq().value);this.noteRelease(p),this._oldest=(this._oldest+1)%(this.maxVoices-1)}this.notes[c]=new i,this.notes[c].setValueAtTime(a,u);var l=null===this._voicesInUse._searchBefore(u)?0:this._voicesInUse._searchBefore(u).value;if(this._voicesInUse.setValueAtTime(l+1,u),this._updateAfter(u,1),this._newest=a,"number"==typeof h){var f=1/this._voicesInUse.getValueAtTime(u)*2;h=h>f?f:h}this.audiovoices[a].triggerAttack(c,h,r)},t.PolySynth.prototype._updateAfter=function(t,e){if(null!==this._voicesInUse._searchAfter(t)){this._voicesInUse._searchAfter(t).value+=e;var i=this._voicesInUse._searchAfter(t).time;this._updateAfter(i,e)}},t.PolySynth.prototype.noteRelease=function(t,i){var o=e.audiocontext.currentTime,s=i||0,r=o+s;if(t){var a=n(t);if(this.notes[a]&&null!==this.notes[a].getValueAtTime(r)){var u=Math.max(~~this._voicesInUse.getValueAtTime(r).value,1);this._voicesInUse.setValueAtTime(u-1,r),u>0&&this._updateAfter(r,-1),this.audiovoices[this.notes[a].getValueAtTime(r)].triggerRelease(s),this.notes[a].dispose(),delete this.notes[a],this._newest=0===this._newest?0:(this._newest-1)%(this.maxVoices-1)}else console.warn("Cannot release a note that is not already playing")}else for(var c in this.audiovoices.forEach(function(t){t.triggerRelease(s)}),this._voicesInUse.setValueAtTime(0,r),this.notes)this.notes[c].dispose(),delete this.notes[c]},t.PolySynth.prototype.connect=function(t){var i=t||e.input;
24this.output.connect(i.input?i.input:i)},t.PolySynth.prototype.disconnect=function(){this.output&&this.output.disconnect()},t.PolySynth.prototype.dispose=function(){this.audiovoices.forEach(function(t){t.dispose()}),this.output&&(this.output.disconnect(),delete this.output)}}(),function(){var e=T;function i(t){for(var e,i="number"==typeof t?t:50,n=new Float32Array(44100),o=Math.PI/180,s=0;s<44100;++s)e=2*s/44100-1,n[s]=(3+i)*e*20*o/(Math.PI+i*Math.abs(e));return n}t.Distortion=function(n,o){if(e.call(this),void 0===n&&(n=.25),"number"!=typeof n)throw new Error("amount must be a number");if(void 0===o&&(o="2x"),"string"!=typeof o)throw new Error("oversample must be a String");var s=t.prototype.map(n,0,1,0,2e3);this.waveShaperNode=this.ac.createWaveShaper(),this.amount=s,this.waveShaperNode.curve=i(s),this.waveShaperNode.oversample=o,this.input.connect(this.waveShaperNode),this.waveShaperNode.connect(this.wet)},t.Distortion.prototype=Object.create(e.prototype),t.Distortion.prototype.process=function(t,e,i){t.connect(this.input),this.set(e,i)},t.Distortion.prototype.set=function(e,n){if(e){var o=t.prototype.map(e,0,1,0,2e3);this.amount=o,this.waveShaperNode.curve=i(o)}n&&(this.waveShaperNode.oversample=n)},t.Distortion.prototype.getAmount=function(){return this.amount},t.Distortion.prototype.getOversample=function(){return this.waveShaperNode.oversample},t.Distortion.prototype.dispose=function(){e.prototype.dispose.apply(this),this.waveShaperNode&&(this.waveShaperNode.disconnect(),this.waveShaperNode=null)}}()});
25},{"../p5":"8rnl"}],"Muio":[function(require,module,exports) {
26"use strict";var t=e(require("p5"));function e(t){return t&&t.__esModule?t:{default:t}}t.default.prototype.getReductionRate=function(t,e){if(t&&e)return e.width>t.width?t.width/e.width:1},t.default.prototype.drawAutosizing=function(t,e,i,d){if(t&&e){var u=e.width>t.width?t.width/e.width:1,r=e.width*u,o=e.height*u;return t.image(e,i,d,r,o),u}},module.exports=t.default;
27},{"p5":"8rnl"}],"bNr3":[function(require,module,exports) {
28"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function n(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var i=function(){function t(n,i,r,o){e(this,t),this.x=n,this.y=i,this.speed=r>40?r:40,this.enable=!0,this.beanPosition=o}return n(t,[{key:"update",value:function(){this.x-=this.speed,this.y-=this.speed}}]),t}();exports.default=i;
29},{}],"9sd9":[function(require,module,exports) {
30module.exports="edamame_shell1-min.1c499a58.png";
31},{}],"QBeO":[function(require,module,exports) {
32module.exports="edamame_shell2-min.e3cac671.png";
33},{}],"5J8/":[function(require,module,exports) {
34module.exports="edamame_shell3-min.d2187187.png";
35},{}],"BQzT":[function(require,module,exports) {
36module.exports="edamame_shell4-min.d9bf2f82.png";
37},{}],"m2/P":[function(require,module,exports) {
38module.exports="edamame_bean_left-min.c991ec12.png";
39},{}],"33Vd":[function(require,module,exports) {
40module.exports="edamame_bean_right-min.1ddea57f.png";
41},{}],"DPyV":[function(require,module,exports) {
42module.exports="swish2_1.bbf2b0d0.mp3";
43},{}],"QdeU":[function(require,module,exports) {
44"use strict";require("../style/style.scss"),require("p5/lib/addons/p5.sound");var e=u(require("./p5.extend")),i=u(require("./bean")),t=u(require("../assets/edamame_shell1-min.png")),a=u(require("../assets/edamame_shell2-min.png")),n=u(require("../assets/edamame_shell3-min.png")),s=u(require("../assets/edamame_shell4-min.png")),d=u(require("../assets/edamame_bean_left-min.png")),r=u(require("../assets/edamame_bean_right-min.png")),o=u(require("../assets/swish2_1.mp3"));function u(e){return e&&e.__esModule?e:{default:e}}var h=function(e){var u,h,w,g=[],l=[],c=0,f=[],m=!1;e.preload=function(){g.push(e.loadImage(t.default)),g.push(e.loadImage(a.default)),g.push(e.loadImage(n.default)),g.push(e.loadImage(s.default)),l.push(e.loadImage(d.default)),l.push(e.loadImage(r.default)),w=e.loadSound(o.default)},e.setup=function(){e.createCanvas(e.windowWidth,e.windowHeight),e.frameRate(30),e.imageMode(e.CENTER),(u=e.createGraphics(e.windowWidth,e.windowHeight)).noStroke(),u.imageMode(e.CENTER),h=e.getReductionRate(u,g[0])},e.draw=function(){u.background(255),f.forEach(function(e,i,t){e.update(
44);var a=1===e.beanPosition?l[0]:l[1],n=a.width*h,s=a.height*h;u.image(a,e.x,e.y,n,s),(e.x+n<0||e.x>u.width||e.y+s<0||e.y>u.height)&&t.splice(i,1)});var i=g[0];e.existsBean(1)&&e.existsBean(2)?i=g[3]:e.existsBean(1)?i=g[1]:e.existsBean(2)&&(i=g[2]),u.image(i,e.windowWidth/2,e.windowHeight/2,i.width*h,i.height*h),e.image(u,e.windowWidth/2,e.windowHeight/2),e.mouseIsPressed?(0===c&&(c=Date.now()),Date.now()-c>500&&e.fire()):c=0},e.fire=function(){e.isPressing(1)&&!e.existsBean(1)&&(f.push(new i.default((e.windowWidth-30)/2,(e.windowHeight+30)/2,u.width/20,1)),e.vibrate(100),w.play()),e.isPressing(2)&&!e.existsBean(2)&&(f.push(new i.default((e.windowWidth+110)/2,(e.windowHeight-90)/2,u.width/20,2)),e.vibrate(100),w.play())},e.vibrate=function(e){try{window.navigator.vibrate(e)}catch(i){}},e.existsBean=function(e){var i=!1;return f.forEach(function(t){t.beanPosition!==e||(i=!0)}),i},e.isPressing=function(i){var t=1===i?{x:(e.windowWidth-30)/2,y:(e.windowHeight+30)/2,rad:90*h/2}:{x:(e.windowWidth+110)/2,y:(e.windowHeight-90)/2,rad:90*h/2};if(e.isPC()&&e.getDistance(e.mouseX,e.mouseY,t.x,t.y)<t.rad)return!0;for(var a=0;a<e.touches.length;a++){var n=e.touches[a];if(e.getDistance(n.x,n.y,t.x,t.y)<t.rad)return!0}return!1},e.touchStarted=function(){m||(w.play(),w.stop(),m=!0)},e.windowResized=function(){e.resizeCanvas(e.windowWidth,e.windowHeight),u.resizeCanvas(e.windowWidth,e.windowHeight),h=e.getReductionRate(u,g[0])},e.isPC=function(){return!navigator.userAgent.match(/(iPhone|iPad|iPod|Android)/i)},e.getDistance=function(e,i,t,a){return Math.sqrt(Math.pow(t-e,2)+Math.pow(a-i,2))}};new e.default(h);
45},{"../style/style.scss":"4A+K","p5/lib/addons/p5.sound":"CUYq","./p5.extend":"Muio","./bean":"bNr3","../assets/edamame_shell1-min.png":"9sd9","../assets/edamame_shell2-min.png":"QBeO","../assets/edamame_shell3-min.png":"5J8/","../assets/edamame_shell4-min.png":"BQzT","../assets/edamame_bean_left-min.png":"m2/P","../assets/edamame_bean_right-min.png":"33Vd","../assets/swish2_1.mp3":"DPyV"}]},{},["QdeU"], null)

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.