From 9ba6d2193141d95641cc9cb21b961b716afa8b7c Mon Sep 17 00:00:00 2001 From: joelpryde Date: Tue, 25 Nov 2014 18:39:32 -0500 Subject: [PATCH] make nodejs sample use p5 --- .gitignore | 2 +- Samples/NodeJSSample/web/application.js | 109 ------------------ .../lib/tcpServer.js | 0 .../lib/webServer.js | 0 .../package.json | 0 .../server.bat | 0 .../server.js | 0 .../web/Logo.png | Bin Samples/P5NodeJSSample/web/application.js | 20 ++++ .../web/servers.html | 8 +- Samples/P5NodeJSSample/web/sketch.js | 45 ++++++++ .../web/styles.css | 0 .../web/vendor/jquery.min.js | 0 .../web/vendor/jquery.timeago.js | 0 Samples/P5NodeJSSample/web/vendor/p5.min.js | 5 + 15 files changed, 78 insertions(+), 111 deletions(-) delete mode 100644 Samples/NodeJSSample/web/application.js rename Samples/{NodeJSSample => P5NodeJSSample}/lib/tcpServer.js (100%) rename Samples/{NodeJSSample => P5NodeJSSample}/lib/webServer.js (100%) rename Samples/{NodeJSSample => P5NodeJSSample}/package.json (100%) rename Samples/{NodeJSSample => P5NodeJSSample}/server.bat (100%) rename Samples/{NodeJSSample => P5NodeJSSample}/server.js (100%) rename Samples/{NodeJSSample => P5NodeJSSample}/web/Logo.png (100%) create mode 100644 Samples/P5NodeJSSample/web/application.js rename Samples/{NodeJSSample => P5NodeJSSample}/web/servers.html (95%) create mode 100644 Samples/P5NodeJSSample/web/sketch.js rename Samples/{NodeJSSample => P5NodeJSSample}/web/styles.css (100%) rename Samples/{NodeJSSample => P5NodeJSSample}/web/vendor/jquery.min.js (100%) rename Samples/{NodeJSSample => P5NodeJSSample}/web/vendor/jquery.timeago.js (100%) create mode 100644 Samples/P5NodeJSSample/web/vendor/p5.min.js diff --git a/.gitignore b/.gitignore index 3f05f93..d5206b6 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ # Node modules -Samples/NodeJSSample/node_modules/ +Samples/P5NodeJSSample/node_modules/ # Compiled Object files *.slo diff --git a/Samples/NodeJSSample/web/application.js b/Samples/NodeJSSample/web/application.js deleted file mode 100644 index 93607fc..0000000 --- a/Samples/NodeJSSample/web/application.js +++ /dev/null @@ -1,109 +0,0 @@ -var socket = io.connect( jQuery.data( $("head")[0], "data").server_url ); -$.timeago.settings.strings.seconds = "%d seconds"; - -// -// DO ACTUAL STARTUP -// -socket.on('connect', function(){}); - -function blobToImage(imageData) { - if (Blob && 'undefined' != typeof URL) { - var blob = new Blob([imageData], {type: 'image/png'}); - return URL.createObjectURL(blob); - } else if (imageData.base64) { - return 'data:image/bmp;base64,' + imageData.data; - } else { - return 'about:blank'; - } -} - -// update depth buffer -var timeSinceUpdateDepth = 0; -socket.on('updateDepth', function(data) { - //console.log("updating depth"); - var canvas = document.getElementById('depthCanvas'); - var context = canvas.getContext('2d'); - context.clearRect(0, 0, canvas.width, canvas.height); - - var imgArray = new Uint8Array(data.buffer); - //console.log("updating depth image: " + imgArray.length); - var imgW = 512, imgH = 424; - var imgPixels = context.getImageData(0, 0, imgW, imgH); - - var d = 0; - for(var y = 0; y < imgPixels.height; y++){ - for(var x = 0; x < imgPixels.width; x++){ - var i = (y * 4) * imgPixels.width + x * 4; - var avg = imgArray[y*imgPixels.width + x]; - //avg = d%255; - - imgPixels.data[i] = avg; - imgPixels.data[i + 1] = avg; - imgPixels.data[i + 2] = avg; - imgPixels.data[i + 3] = 255; - } - } - context.putImageData(imgPixels, 0, 0); - timeSinceUpdateDepth = 0; -}); - -// update clients list -var timeSinceUpdateBodies = 0; -socket.on('updateBodies', function(data) { - //console.log("updating bodies"); - - var canvas = document.getElementById('bodyCanvas'); - var context = canvas.getContext('2d'); - context.clearRect(0, 0, canvas.width, canvas.height); - var radius = 5; - - for (var b in data.bodies) { - if (data.bodyTrackingIds[b] != 0) { - for (var i in data.bodies[b]) { - $('#joint_x_' + i).html(data.bodies[b][i].x); - $('#joint_y_' + i).html(data.bodies[b][i].y); - $('#joint_z_' + i).html(data.bodies[b][i].z); - - context.beginPath(); - context.arc(data.bodies[b][i].x * canvas.width/2 + canvas.width/2.0, - (1.0-data.bodies[b][i].y) * canvas.height/2, radius, 0, 2 * Math.PI, false); - context.closePath() - context.fillStyle = 'blue'; - context.fill(); - context.lineWidth = 2; - context.strokeStyle = '#ffffff'; - context.stroke(); - } - } - } - - /* - //console.log(data.bodyCount); - if (data.bodyCount > 0) - { - console.log("x: " + data.bodies[0][0].x + - "y: " + data.bodies[0][0].y + - "z: " + data.bodies[0][0].z); - }*/ - timeSinceUpdateBodies = 0; -}); - -function clearCanvas(canvasName) { - var canvas = document.getElementById(canvasName); - var context = canvas.getContext('2d'); - context.clearRect(0, 0, canvas.width, canvas.height); -} - -// send updated parameters on an interval -setInterval( - function() { - /* - if (timeSinceUpdateDepth > 0.2) - clearCanvas('depthCanvas'); - if (timeSinceUpdateBodies > 0.2) - clearCanvas('bodyCanvas'); - timeSinceUpdateDepth += 1000.0/30.0; - timeSinceUpdateBodies += 1000.0/30.0; - */ - }, -1000.0/30.0); \ No newline at end of file diff --git a/Samples/NodeJSSample/lib/tcpServer.js b/Samples/P5NodeJSSample/lib/tcpServer.js similarity index 100% rename from Samples/NodeJSSample/lib/tcpServer.js rename to Samples/P5NodeJSSample/lib/tcpServer.js diff --git a/Samples/NodeJSSample/lib/webServer.js b/Samples/P5NodeJSSample/lib/webServer.js similarity index 100% rename from Samples/NodeJSSample/lib/webServer.js rename to Samples/P5NodeJSSample/lib/webServer.js diff --git a/Samples/NodeJSSample/package.json b/Samples/P5NodeJSSample/package.json similarity index 100% rename from Samples/NodeJSSample/package.json rename to Samples/P5NodeJSSample/package.json diff --git a/Samples/NodeJSSample/server.bat b/Samples/P5NodeJSSample/server.bat similarity index 100% rename from Samples/NodeJSSample/server.bat rename to Samples/P5NodeJSSample/server.bat diff --git a/Samples/NodeJSSample/server.js b/Samples/P5NodeJSSample/server.js similarity index 100% rename from Samples/NodeJSSample/server.js rename to Samples/P5NodeJSSample/server.js diff --git a/Samples/NodeJSSample/web/Logo.png b/Samples/P5NodeJSSample/web/Logo.png similarity index 100% rename from Samples/NodeJSSample/web/Logo.png rename to Samples/P5NodeJSSample/web/Logo.png diff --git a/Samples/P5NodeJSSample/web/application.js b/Samples/P5NodeJSSample/web/application.js new file mode 100644 index 0000000..636bd2a --- /dev/null +++ b/Samples/P5NodeJSSample/web/application.js @@ -0,0 +1,20 @@ +var socket = io.connect( jQuery.data( $("head")[0], "data").server_url ); +$.timeago.settings.strings.seconds = "%d seconds"; + +// +// DO ACTUAL STARTUP +// +socket.on('connect', function(){}); + +// update depth buffer +var timeSinceUpdateDepth = 0; +socket.on('updateDepth', function(data) { + var imgArray = new Uint8Array(data.buffer); + updateDepth(imgArray); +}); + +// update clients list +var timeSinceUpdateBodies = 0; +socket.on('updateBodies', function(data) { + updateBodies(data); +}); \ No newline at end of file diff --git a/Samples/NodeJSSample/web/servers.html b/Samples/P5NodeJSSample/web/servers.html similarity index 95% rename from Samples/NodeJSSample/web/servers.html rename to Samples/P5NodeJSSample/web/servers.html index ceb2b3b..ad27b74 100644 --- a/Samples/NodeJSSample/web/servers.html +++ b/Samples/P5NodeJSSample/web/servers.html @@ -2,6 +2,7 @@ + + + + + + diff --git a/Samples/P5NodeJSSample/web/sketch.js b/Samples/P5NodeJSSample/web/sketch.js new file mode 100644 index 0000000..bae24a6 --- /dev/null +++ b/Samples/P5NodeJSSample/web/sketch.js @@ -0,0 +1,45 @@ +var img; +var bodyData; + +function setup() { + createCanvas(512, 424); + img = createImage(512, 424); +} + +function updateDepth(imgArray) { + img.loadPixels(); + for(var x = 0; x < 512; x++) { + for(var y = 0; y < 424; y++) { + var avg = imgArray[y*512 + x]; + img.set(x, y, [avg, avg, avg, 255]); + } + } + img.updatePixels(); +} + +function updateBodies(data) { + bodyData = data; +} + +function drawBodies() { + if (bodyData != undefined) { + noStroke(); + fill(255,50); + ellipseMode(CENTER); + + for (var b in bodyData.bodies) { + if (bodyData.bodyTrackingIds[b] != 0) { + for (var i in bodyData.bodies[b]) { + ellipse(bodyData.bodies[b][i].x * canvas.width/2 + canvas.width/2.0, + (1.0-bodyData.bodies[b][i].y) * canvas.height/2,16,16); + } + } + } + } +} + +function draw() { + background(0); + image(img, 0, 0, 512, 424); + drawBodies(); +} \ No newline at end of file diff --git a/Samples/NodeJSSample/web/styles.css b/Samples/P5NodeJSSample/web/styles.css similarity index 100% rename from Samples/NodeJSSample/web/styles.css rename to Samples/P5NodeJSSample/web/styles.css diff --git a/Samples/NodeJSSample/web/vendor/jquery.min.js b/Samples/P5NodeJSSample/web/vendor/jquery.min.js similarity index 100% rename from Samples/NodeJSSample/web/vendor/jquery.min.js rename to Samples/P5NodeJSSample/web/vendor/jquery.min.js diff --git a/Samples/NodeJSSample/web/vendor/jquery.timeago.js b/Samples/P5NodeJSSample/web/vendor/jquery.timeago.js similarity index 100% rename from Samples/NodeJSSample/web/vendor/jquery.timeago.js rename to Samples/P5NodeJSSample/web/vendor/jquery.timeago.js diff --git a/Samples/P5NodeJSSample/web/vendor/p5.min.js b/Samples/P5NodeJSSample/web/vendor/p5.min.js new file mode 100644 index 0000000..9756a83 --- /dev/null +++ b/Samples/P5NodeJSSample/web/vendor/p5.min.js @@ -0,0 +1,5 @@ +/*! p5.min.js v0.3.12 November 23, 2014 */ + +var shim=function(){window.requestDraw=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}}()}({}),constants=function(){var t=Math.PI;return{ARROW:"default",CROSS:"crosshair",HAND:"pointer",MOVE:"move",TEXT:"text",WAIT:"wait",HALF_PI:t/2,PI:t,QUARTER_PI:t/4,TAU:2*t,TWO_PI:2*t,DEGREES:"degrees",RADIANS:"radians",CORNER:"corner",CORNERS:"corners",RADIUS:"radius",RIGHT:"right",LEFT:"left",CENTER:"center",POINTS:"points",LINES:"lines",TRIANGLES:"triangles",TRIANGLE_FAN:"triangles_fan",TRIANGLE_STRIP:"triangles_strip",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",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:"normal",ADDITIVE:"lighter",DARKEST:"darken",LIGHTEST:"lighten",DIFFERENCE:"difference",EXCLUSION:"exclusion",MULTIPLY:"multiply",SCREEN:"screen",REPLACE:"source-over",OVERLAY:"overlay",HARD_LIGHT:"hard-light",SOFT_LIGHT:"soft-light",DODGE:"color-dodge",BURN:"color-burn",NORMAL:"normal",ITALIC:"italic",BOLD:"bold",LINEAR:"linear",QUADRATIC:"quadratic",BEZIER:"bezier",CURVE:"curve"}}({}),core=function(t,e,r){"use strict";var r=r,o=function(t,e){this._setupDone=!1,this._pixelDensity=window.devicePixelRatio||1,this._startTime=(new Date).getTime(),this._userNode=e,this._curElement=null,this._elements=[],this._preloadCount=0,this._updateInterval=0,this._isGlobal=!1,this._loop=!0,this._styles=[],this._defaultCanvasSize={width:100,height:100},this._events={mousemove:null,mousedown:null,mouseup:null,click:null,mousewheel:null,mouseover:null,mouseout:null,keydown:null,keyup:null,keypress:null,touchstart:null,touchmove:null,touchend:null,resize:null},this._loadingScreenId="p5_loading",this._start=function(){if(this._userNode&&"string"==typeof this._userNode&&(this._userNode=document.getElementById(this._userNode)),this._loadingScreen=document.getElementById(this._loadingScreenId),!this._loadingScreen){this._loadingScreen=document.createElement("loadingDiv"),this._loadingScreen.innerHTML="loading...",this._loadingScreen.style.position="absolute";var t=this._userNode||document.body;t.appendChild(this._loadingScreen)}this.createCanvas(this._defaultCanvasSize.width,this._defaultCanvasSize.height,!0);var e=this.preload||window.preload,r=this._isGlobal?window:this;e?(this._preloadMethods.forEach(function(t){r[t]=function(e){return r._preload(t,e)}}),e(),0===this._preloadCount&&(this._setup(),this._runFrames(),this._draw())):(this._setup(),this._runFrames(),this._draw())}.bind(this),this._preload=function(t,e){var r=this._isGlobal?window:this;return r._setProperty("_preloadCount",r._preloadCount+1),o.prototype[t].call(r,e,function(){r._setProperty("_preloadCount",r._preloadCount-1),0===r._preloadCount&&(r._setup(),r._runFrames(),r._draw())})}.bind(this),this._setup=function(){var t=this._isGlobal?window:this;"function"==typeof t.preload&&this._preloadMethods.forEach(function(e){t[e]=o.prototype[e]}),"function"==typeof t.setup&&t.setup(),this.canvas.style.visibility="",this.canvas.className=this.canvas.className.replace("p5_hidden",""),this._setupDone=!0,this._loadingScreen.parentNode.removeChild(this._loadingScreen)}.bind(this),this._draw=function(){var t=this.setup||window.setup,e=(new Date).getTime();this._frameRate=1e3/(e-this._lastFrameTime),this._lastFrameTime=e;var r=this.draw||window.draw;this._loop&&(this._drawInterval&&clearInterval(this._drawInterval),this._drawInterval=setTimeout(function(){window.requestDraw(this._draw.bind(this))}.bind(this),1e3/this._targetFrameRate)),"function"==typeof r&&(this.push(),"undefined"==typeof t&&this.scale(this._pixelDensity,this._pixelDensity),this._registeredMethods.pre.forEach(function(t){t.call(this)}),r(),this._registeredMethods.post.forEach(function(t){t.call(this)}),this.pop()),this._updatePMouseCoords(),this._updatePTouchCoords()}.bind(this),this._runFrames=function(){this._updateInterval&&clearInterval(this._updateInterval),this._updateInterval=setInterval(function(){this._setProperty("frameCount",this.frameCount+1)}.bind(this),1e3/this._targetFrameRate)}.bind(this),this._setProperty=function(t,e){this[t]=e,this._isGlobal&&(window[t]=e)}.bind(this),this.remove=function(){if(this._curElement){this._loop=!1,this._drawInterval&&clearTimeout(this._drawInterval),this._updateInterval&&clearTimeout(this._updateInterval);for(var t in this._events)window.removeEventListener(t,this._events[t]);for(var e=0;e=3?(t=arguments[0],e=arguments[1],n=arguments[2],i="number"==typeof arguments[3]?arguments[3]:255):(this._colorMode===r.RGB?t=e=n=arguments[0]:(t=n=arguments[0],e=0),i="number"==typeof arguments[1]?arguments[1]:255),[t,e,n,i]},o.Color._normalizeColorArray=function(t){var e=this._colorMode===r.RGB,o=e?this._maxRGB:this._maxHSB;return t[0]*=255/o[0],t[1]*=255/o[1],t[2]*=255/o[2],t[3]*=255/o[3],t},o.Color._getRGB=function(t){var e=t[0],r=t[1],o=t[2];e/=255,r/=255,o/=255;var n=[];if(0===r)n=[Math.round(255*o),Math.round(255*o),Math.round(255*o),t[3]];else{var i=6*e;6===i&&(i=0);var s,a,p,u=Math.floor(i),h=o*(1-r),l=o*(1-r*(i-u)),c=o*(1-r*(1-(i-u)));0===u?(s=o,a=c,p=h):1===u?(s=l,a=o,p=h):2===u?(s=h,a=o,p=c):3===u?(s=h,a=l,p=o):4===u?(s=c,a=h,p=o):(s=o,a=h,p=l),n=[Math.round(255*s),Math.round(255*a),Math.round(255*p),t[3]]}return n},o.Color._getHSB=function(t){var e,r,o=t[0]/255,n=t[1]/255,i=t[2]/255,s=Math.min(o,n,i),a=Math.max(o,n,i),p=a-s,u=a;if(0===p)e=0,r=0;else{r=p/a;var h=((a-o)/6+p/2)/p,l=((a-n)/6+p/2)/p,c=((a-i)/6+p/2)/p;o===a?e=c-l:n===a?e=1/3+h-c:i===a&&(e=2/3+l-h),0>e&&(e+=1),e>1&&(e-=1)}return[Math.round(255*e),Math.round(255*r),Math.round(255*u),t[3]]},o.Color._getColorString=function(t){for(var e=0;3>e;e++)t[e]=Math.floor(t[e]);var r="undefined"!=typeof t[3]?t[3]/255:1;return"rgba("+t[0]+","+t[1]+","+t[2]+","+r+")"},o.Color._getCanvasColor=function(){if(arguments[0]instanceof o.Color){if(1===arguments.length)return arguments[0].colorString;var t=arguments[0].rgba;return t[3]=arguments[1],t=o.Color._normalizeColorArray.call(this,t),o.Color._getColorString(t)}if(arguments[0]instanceof Array){if(1===arguments.length)return o.Color._getColorString(arguments[0]);var e=this._colorMode===r.RGB,n=e?this._maxRGB[3]:this._maxHSB[3];return arguments[0][3]=255*arguments[1]/n,o.Color._getColorString(arguments[0])}var i=o.Color._getFormattedColor.apply(this,arguments);return i=o.Color._normalizeColorArray.call(this,i),this._colorMode===r.HSB&&(i=o.Color._getRGB(i)),o.Color._getColorString(i)},o.Color}({},core,constants),p5Element=function(t,e){function r(t,e,r){var o=e.bind(r);r.elt.addEventListener(t,o,!1),r._events[t]=o}var o=e;return o.Element=function(t,e){this.elt=t,this._pInst=e,this._events={},this.width=this.elt.offsetWidth,this.height=this.elt.offsetHeight},o.Element.prototype.parent=function(t){return"string"==typeof t?t=document.getElementById(t):t instanceof o.Element&&(t=t.elt),t.appendChild(this.elt),this},o.Element.prototype.id=function(t){return this.elt.id=t,this},o.Element.prototype.class=function(t){return this.elt.className+=" "+t,this},o.Element.prototype.mousePressed=function(t){return r("mousedown",t,this),this},o.Element.prototype.mouseWheel=function(t){return r("mousewheel",t,this),this},o.Element.prototype.mouseReleased=function(t){return r("mouseup",t,this),this},o.Element.prototype.mouseClicked=function(t){return r("click",t,this),this},o.Element.prototype.mouseMoved=function(t){return r("mousemove",t,this),this},o.Element.prototype.mouseOver=function(t){return r("mouseover",t,this),this},o.Element.prototype.mouseOut=function(t){return r("mouseout",t,this),this},o.Element.prototype._setProperty=function(t,e){this[t]=e},o.Element}({},core),p5Graphics=function(t,e,r){var o=e,r=r;return o.Graphics=function(t,e,r){o.Element.call(this,t,e),this.canvas=t,this.drawingContext=this.canvas.getContext("2d"),this._pInst=e,r?(this._isMainCanvas=!0,this._pInst._setProperty("_curElement",this),this._pInst._setProperty("canvas",this.canvas),this._pInst._setProperty("drawingContext",this.drawingContext),this._pInst._setProperty("width",this.width),this._pInst._setProperty("height",this.height)):(this.canvas.style.display="none",this._styles=[])},o.Graphics.prototype=Object.create(o.Element.prototype),o.Graphics.prototype._applyDefaults=function(){this.drawingContext.fillStyle="#FFFFFF",this.drawingContext.strokeStyle="#000000",this.drawingContext.lineCap=r.ROUND,this.drawingContext.font="normal 12px sans-serif"},o.Graphics.prototype.resize=function(t,e){this.width=t,this.height=e,this.elt.width=t*this._pInst._pixelDensity,this.elt.height=e*this._pInst._pixelDensity,this.elt.style.width=t+"px",this.elt.style.height=e+"px",this._isMainCanvas&&(this._pInst._setProperty("width",this.width),this._pInst._setProperty("height",this.height)),this.drawingContext.scale(this._pInst._pixelDensity,this._pInst._pixelDensity)},o.Graphics}({},core,constants),filters=function(){"use strict";function t(t){var e=3.5*t|0;if(e=1>e?1:248>e?e:248,o!==e){o=e,n=1+o<<1,i=new Int32Array(n),s=new Array(n);for(var r=0;n>r;r++)s[r]=new Int32Array(256);for(var a,p,u,h,l=1,c=e-1;e>l;l++){i[e+l]=i[c]=p=c*c,u=s[e+l],h=s[c--];for(var d=0;256>d;d++)u[d]=h[d]=p*d}a=i[e]=e*e,u=s[e];for(var f=0;256>f;f++)u[f]=a*f}}function e(e,a){for(var p=r._toPixels(e),u=e.width,h=e.height,l=u*h,c=new Int32Array(l),d=0;l>d;d++)c[d]=r._getARGB(p,d);var f,y,g,m,v,w,_,x,C,b,R=new Int32Array(l),S=new Int32Array(l),E=new Int32Array(l),M=new Int32Array(l),T=0;t(a);var I,P,A,D;for(P=0;h>P;P++){for(I=0;u>I;I++){if(m=g=y=v=f=0,w=I-o,0>w)b=-w,w=0;else{if(w>=u)break;b=0}for(A=b;n>A&&!(w>=u);A++){var k=c[w+T];D=s[A],v+=D[(-16777216&k)>>>24],y+=D[(16711680&k)>>16],g+=D[(65280&k)>>8],m+=D[255&k],f+=i[A],w++}_=T+I,R[_]=v/f,S[_]=y/f,E[_]=g/f,M[_]=m/f}T+=u}for(T=0,x=-o,C=x*u,P=0;h>P;P++){for(I=0;u>I;I++){if(m=g=y=v=f=0,0>x)b=_=-x,w=I;else{if(x>=h)break;b=0,_=x,w=I+C}for(A=b;n>A&&!(_>=h);A++)D=s[A],v+=D[R[w]],y+=D[S[w]],g+=D[E[w]],m+=D[M[w]],f+=i[A],_++,w+=u;c[I+T]=v/f<<24|y/f<<16|g/f<<8|m/f}T+=u,C+=u,x++}r._setPixels(p,c)}var r={};r._toPixels=function(t){return t instanceof ImageData?t.data:t.getContext("2d").getImageData(0,0,t.width,t.height).data},r._getARGB=function(t,e){var r=4*e;return t[r+3]<<24&4278190080|t[r]<<16&16711680|t[r+1]<<8&65280|255&t[r+2]},r._setPixels=function(t,e){for(var r=0,o=0,n=t.length;n>o;o++)r=4*o,t[r+0]=(16711680&e[o])>>>16,t[r+1]=(65280&e[o])>>>8,t[r+2]=255&e[o],t[r+3]=(4278190080&e[o])>>>24},r._toImageData=function(t){return t instanceof ImageData?t:t.getContext("2d").getImageData(0,0,t.width,t.height)},r._createImageData=function(t,e){return r._tmpCanvas=document.createElement("canvas"),r._tmpCtx=r._tmpCanvas.getContext("2d"),this._tmpCtx.createImageData(t,e)},r.apply=function(t,e,r){var o=t.getContext("2d"),n=o.getImageData(0,0,t.width,t.height),i=e(n,r);i instanceof ImageData?o.putImageData(i,0,0,0,0,t.width,t.height):o.putImageData(n,0,0,0,0,t.width,t.height)},r.threshold=function(t,e){var o=r._toPixels(t);void 0===e&&(e=.5);for(var n=Math.floor(255*e),i=0;i=n?255:0,o[i]=o[i+1]=o[i+2]=s}},r.gray=function(t){for(var e=r._toPixels(t),o=0;oe||e>255)throw new Error("Level must be greater than 2 and less than 255 for posterize");for(var n=e-1,i=0;i>8)/n,o[i+1]=255*(a*e>>8)/n,o[i+2]=255*(p*e>>8)/n}},r.dilate=function(t){for(var e,o,n,i,s,a,p,u,h,l,c,d,f,y,g,m,v,w=r._toPixels(t),_=0,x=w.length?w.length/4:0,C=new Int32Array(x);x>_;)for(e=_,o=_+t.width;o>_;)n=i=r._getARGB(w,_),p=_-1,a=_+1,u=_-t.width,h=_+t.width,e>p&&(p=_),a>=o&&(a=_),0>u&&(u=0),h>=x&&(h=_),d=r._getARGB(w,u),c=r._getARGB(w,p),f=r._getARGB(w,h),l=r._getARGB(w,a),s=77*(n>>16&255)+151*(n>>8&255)+28*(255&n),g=77*(c>>16&255)+151*(c>>8&255)+28*(255&c),y=77*(l>>16&255)+151*(l>>8&255)+28*(255&l),m=77*(d>>16&255)+151*(d>>8&255)+28*(255&d),v=77*(f>>16&255)+151*(f>>8&255)+28*(255&f),g>s&&(i=c,s=g),y>s&&(i=l,s=y),m>s&&(i=d,s=m),v>s&&(i=f,s=v),C[_++]=i;r._setPixels(w,C)},r.erode=function(t){for(var e,o,n,i,s,a,p,u,h,l,c,d,f,y,g,m,v,w=r._toPixels(t),_=0,x=w.length?w.length/4:0,C=new Int32Array(x);x>_;)for(e=_,o=_+t.width;o>_;)n=i=r._getARGB(w,_),p=_-1,a=_+1,u=_-t.width,h=_+t.width,e>p&&(p=_),a>=o&&(a=_),0>u&&(u=0),h>=x&&(h=_),d=r._getARGB(w,u),c=r._getARGB(w,p),f=r._getARGB(w,h),l=r._getARGB(w,a),s=77*(n>>16&255)+151*(n>>8&255)+28*(255&n),g=77*(c>>16&255)+151*(c>>8&255)+28*(255&c),y=77*(l>>16&255)+151*(l>>8&255)+28*(255&l),m=77*(d>>16&255)+151*(d>>8&255)+28*(255&d),v=77*(f>>16&255)+151*(f>>8&255)+28*(255&f),s>g&&(i=c,s=g),s>y&&(i=l,s=y),s>m&&(i=d,s=m),s>v&&(i=f,s=v),C[_++]=i;r._setPixels(w,C)};var o,n,i,s;return r.blur=function(t,r){e(t,r)},r}({}),p5Image=function(t,e,r){"use strict";var o=e,n=r;return o.Image=function(t,e){this.width=t,this.height=e,this.canvas=document.createElement("canvas"),this.canvas.width=this.width,this.canvas.height=this.height,this.drawingContext=this.canvas.getContext("2d"),this.pixels=[]},o.Image.prototype._setProperty=function(t,e){this[t]=e},o.Image.prototype.loadPixels=function(){o.prototype.loadPixels.call(this)},o.Image.prototype.updatePixels=function(t,e,r,n){o.prototype.updatePixels.call(this,t,e,r,n)},o.Image.prototype.get=function(t,e,r,n){return o.prototype.get.call(this,t,e,r,n)},o.Image.prototype.set=function(t,e,r){o.prototype.set.call(this,t,e,r)},o.Image.prototype.resize=function(t,e){t=t||this.canvas.width,e=t||this.canvas.height;var r=document.createElement("canvas");r.width=t,r.height=e,r.getContext("2d").drawImage(this.canvas,0,0,this.canvas.width,this.canvas.height,0,0,r.width,r.width),this.canvas.width=this.width=t,this.canvas.height=this.height=e,this.drawingContext.drawImage(r,0,0,t,e,0,0,t,e),this.pixels.length>0&&this.loadPixels()},o.Image.prototype.copy=function(){o.prototype.copy.apply(this,arguments)},o.Image.prototype.mask=function(t){void 0===t&&(t=this);var e=this.drawingContext.globalCompositeOperation,r=1;t instanceof o.Graphics&&(r=t._pInst._pixelDensity);var n=[t,0,0,r*t.width,r*t.height,0,0,this.width,this.height];this.drawingContext.globalCompositeOperation="destination-out",this.copy.apply(this,n),this.drawingContext.globalCompositeOperation=e},o.Image.prototype.filter=function(t,e){n.apply(this.canvas,n[t.toLowerCase()],e)},o.Image.prototype.blend=function(){o.prototype.blend.apply(this,arguments)},o.Image.prototype.save=function(t,e){var r;if(e)switch(e.toLowerCase()){case"png":r="image/png";break;case"jpeg":r="image/jpeg";break;case"jpg":r="image/jpeg";break;default:r="image/png"}else e="png",r="image/png";var n="image/octet-stream",i=this.canvas.toDataURL(r);i=i.replace(r,n),o.prototype.downloadFile(i,t,e)},o.Image}({},core,filters),polargeometry=function(){return{degreesToRadians:function(t){return 2*Math.PI*t/360},radiansToDegrees:function(t){return 360*t/(2*Math.PI)}}}({}),p5Vector=function(t,e,r,o){"use strict";var n=e,i=r,o=o;return n.Vector=function(){var t,e,r;arguments[0]instanceof n?(this.p5=arguments[0],t=arguments[1][0]||0,e=arguments[1][1]||0,r=arguments[1][2]||0):(t=arguments[0]||0,e=arguments[1]||0,r=arguments[2]||0),this.x=t,this.y=e,this.z=r},n.Vector.prototype.set=function(t,e,r){return t instanceof n.Vector?(this.x=t.x||0,this.y=t.y||0,this.z=t.z||0,this):t instanceof Array?(this.x=t[0]||0,this.y=t[1]||0,this.z=t[2]||0,this):(this.x=t||0,this.y=e||0,this.z=r||0,this)},n.Vector.prototype.get=function(){return this.p5?new n.Vector(this.p5,[this.x,this.y,this.z]):new n.Vector(this.x,this.y,this.z)},n.Vector.prototype.add=function(t,e,r){return t instanceof n.Vector?(this.x+=t.x||0,this.y+=t.y||0,this.z+=t.z||0,this):t instanceof Array?(this.x+=t[0]||0,this.y+=t[1]||0,this.z+=t[2]||0,this):(this.x+=t||0,this.y+=e||0,this.z+=r||0,this)},n.Vector.prototype.sub=function(t,e,r){return t instanceof n.Vector?(this.x-=t.x||0,this.y-=t.y||0,this.z-=t.z||0,this):t instanceof Array?(this.x-=t[0]||0,this.y-=t[1]||0,this.z-=t[2]||0,this):(this.x-=t||0,this.y-=e||0,this.z-=r||0,this)},n.Vector.prototype.mult=function(t){return this.x*=t||0,this.y*=t||0,this.z*=t||0,this},n.Vector.prototype.div=function(t){return this.x/=t,this.y/=t,this.z/=t,this},n.Vector.prototype.mag=function(){return Math.sqrt(this.magSq())},n.Vector.prototype.magSq=function(){var t=this.x,e=this.y,r=this.z;return t*t+e*e+r*r},n.Vector.prototype.dot=function(t,e,r){return t instanceof n.Vector?this.dot(t.x,t.y,t.z):this.x*(t||0)+this.y*(e||0)+this.z*(r||0)},n.Vector.prototype.cross=function(t){var e=this.y*t.z-this.z*t.y,r=this.z*t.x-this.x*t.z,o=this.x*t.y-this.y*t.x;return this.p5?new n.Vector(this.p5,[e,r,o]):new n.Vector(e,r,o)},n.Vector.prototype.dist=function(t){var e=t.get().sub(this);return e.mag()},n.Vector.prototype.normalize=function(){return this.div(this.mag())},n.Vector.prototype.limit=function(t){var e=this.magSq();return e>t*t&&(this.div(Math.sqrt(e)),this.mult(t)),this},n.Vector.prototype.setMag=function(t){return this.normalize().mult(t)},n.Vector.prototype.heading=function(){var t=Math.atan2(this.y,this.x);return this.p5?this.p5._angleMode===o.RADIANS?t:i.radiansToDegrees(t):t},n.Vector.prototype.rotate=function(t){this.p5&&this.p5._angleMode===o.DEGREES&&(t=i.degreesToRadians(t));var e=this.heading()+t,r=this.mag();return this.x=Math.cos(e)*r,this.y=Math.sin(e)*r,this},n.Vector.prototype.lerp=function(t,e,r,o){return t instanceof n.Vector?this.lerp(t.x,t.y,t.z,e):(this.x+=(t-this.x)*o||0,this.y+=(e-this.y)*o||0,this.z+=(r-this.z)*o||0,this)},n.Vector.prototype.array=function(){return[this.x||0,this.y||0,this.z||0]},n.Vector.fromAngle=function(t){return this.p5&&this.p5._angleMode===o.DEGREES&&(t=i.degreesToRadians(t)),this.p5?new n.Vector(this.p5,[Math.cos(t),Math.sin(t),0]):new n.Vector(Math.cos(t),Math.sin(t),0)},n.Vector.random2D=function(){var t;return t=this.p5?this.p5.random(this.p5._angleMode===o.DEGREES?360:o.TWO_PI):Math.random()*Math.PI*2,this.fromAngle(t)},n.Vector.random3D=function(){var t,e;this.p5?(t=this.p5.random(0,o.TWO_PI),e=this.p5.random(-1,1)):(t=Math.random()*Math.PI*2,e=2*Math.random()-1);var r=Math.sqrt(1-e*e)*Math.cos(t),i=Math.sqrt(1-e*e)*Math.sin(t);return this.p5?new n.Vector(this.p5,[r,i,e]):new n.Vector(r,i,e)},n.Vector.add=function(t,e){return t.get().add(e)},n.Vector.sub=function(t,e){return t.get().sub(e)},n.Vector.mult=function(t,e){return t.get().mult(e)},n.Vector.div=function(t,e){return t.get().div(e)},n.Vector.dot=function(t,e){return t.dot(e)},n.Vector.cross=function(t,e){return t.cross(e)},n.Vector.dist=function(t,e){return t.dist(e)},n.Vector.lerp=function(t,e,r){return t.get().lerp(e,r)},n.Vector.angleBetween=function(t,e){var r=Math.acos(t.dot(e)/(t.mag()*e.mag()));return this.p5&&this.p5._angleMode===o.DEGREES&&(r=i.radiansToDegrees(r)),r},n.Vector}({},core,polargeometry,constants),p5TableRow=function(t,e){"use strict";var r=e;return r.TableRow=function(t,e){var r=[],o={};t&&(e=e||",",r=t.split(e));for(var n=0;n=0))throw'This table has no column named "'+t+'"';this.obj[t]=e,this.arr[r]=e}else{if(!(ta;a++)s.push(r.prototype.lerp(t.rgba[a],e.rgba[a],o));return new r.Color(this,s)}return r.prototype.lerp(t,e,o)},r.prototype.red=function(t){if(t instanceof Array)return t[0];if(t instanceof r.Color)return t.rgba[0];throw new Error("Needs p5.Color or pixel array as argument.")},r.prototype.saturation=function(t){if(!t instanceof r.Color)throw new Error("Needs p5.Color as argument.");return t.hsba||(t.hsba=r.Color.getRGB(t.rgba),t.hsba=t.hsba.concat(t.rgba[3])),t.hsba[1]},r}({},core,p5Color),colorsetting=function(t,e,r){"use strict";var o=e,r=r;return o.prototype._doStroke=!0,o.prototype._doFill=!0,o.prototype._colorMode=r.RGB,o.prototype._maxRGB=[255,255,255,255],o.prototype._maxHSB=[255,255,255,255],o.prototype.background=function(){if(arguments[0]instanceof o.Image)this.image(arguments[0],0,0,this.width,this.height);else{var t=this.drawingContext.fillStyle,e=this.drawingContext;e.fillStyle=o.Color._getCanvasColor.apply(this,arguments),e.fillRect(0,0,this.width,this.height),e.fillStyle=t}},o.prototype.clear=function(){this.drawingContext.clearRect(0,0,this.width,this.height)},o.prototype.colorMode=function(){if(arguments[0]===r.RGB||arguments[0]===r.HSB){this._colorMode=arguments[0];var t=this._colorMode===r.RGB,e=t?this._maxRGB:this._maxHSB;2===arguments.length?(e[0]=arguments[1],e[1]=arguments[1],e[2]=arguments[1]):arguments.length>2&&(e[0]=arguments[1],e[1]=arguments[2],e[2]=arguments[3]),5===arguments.length&&(e[3]=arguments[4])}},o.prototype.fill=function(){this._setProperty("_doFill",!0);var t=this.drawingContext;t.fillStyle=o.Color._getCanvasColor.apply(this,arguments)},o.prototype.noFill=function(){this._setProperty("_doFill",!1)},o.prototype.noStroke=function(){this._setProperty("_doStroke",!1)},o.prototype.stroke=function(){this._setProperty("_doStroke",!0);var t=this.drawingContext;t.strokeStyle=o.Color._getCanvasColor.apply(this,arguments)},o}({},core,constants,p5Color),dataconversion=function(t,e){"use strict";var r=e;return r.prototype.float=function(t){return parseFloat(t)},r.prototype.int=function(t,e){return"string"==typeof t?(e=e||10,parseInt(t,e)):"number"==typeof t?0|t:"boolean"==typeof t?t?1:0:t instanceof Array?t.map(r.prototype.int):void 0},r}({},core),dataarray_functions=function(t,e){"use strict";var r=e;return r.prototype.append=function(t,e){return t.push(e),t},r.prototype.arrayCopy=function(t,e,r,o,n){var i,s;"undefined"!=typeof n?(s=Math.min(n,t.length),i=o,t=t.slice(e,s+e)):("undefined"!=typeof r?(s=r,s=Math.min(s,t.length)):s=t.length,i=0,r=e,t=t.slice(0,s)),Array.prototype.splice.apply(r,[i,s].concat(t))},r.prototype.concat=function(t,e){return t.concat(e)},r.prototype.reverse=function(t){return t.reverse()},r.prototype.shorten=function(t){return t.pop(),t},r.prototype.sort=function(t,e){var r=e?t.slice(0,Math.min(e,t.length)):t,o=e?t.slice(Math.min(e,t.length)):[];return r="string"==typeof r[0]?r.sort():r.sort(function(t,e){return t-e}),r.concat(o)},r.prototype.splice=function(t,e,r){return Array.prototype.splice.apply(t,[r,0].concat(e)),t},r.prototype.subset=function(t,e,r){return"undefined"!=typeof r?t.slice(e,e+r):t.slice(e,t.length)},r}({},core),datastring_functions=function(t,e){"use strict";function r(){var t=arguments[0],e=0>t,r=e?t.toString().substring(1):t.toString(),o=r.indexOf("."),n=-1!==o?r.substring(0,o):r,i=-1!==o?r.substring(o+1):"",s=e?"-":"";if(3===arguments.length){for(var a=0;a1&&(r=r.substring(0,arguments[1]+1)),o+r}function n(){return parseFloat(arguments[0])>0?"+"+arguments[0].toString():arguments[0].toString()}function i(){return parseFloat(arguments[0])>0?" "+arguments[0].toString():arguments[0].toString()}var s=e;return s.prototype.join=function(t,e){return t.join(e)},s.prototype.match=function(t,e){return t.match(e)},s.prototype.matchAll=function(t,e){for(var r=new RegExp(e,"g"),o=r.exec(t),n=[];null!==o;)n.push(o),o=r.exec(t);return n},s.prototype.nf=function(){if(arguments[0]instanceof Array){var t=arguments[1],e=arguments[2]; +return arguments[0].map(function(o){return r(o,t,e)})}return r.apply(this,arguments)},s.prototype.nfc=function(){if(arguments[0]instanceof Array){var t=arguments[1];return arguments[0].map(function(e){return o(e,t)})}return o.apply(this,arguments)},s.prototype.nfp=function(){var t=this.nf(arguments);return t instanceof Array?t.map(n):n(t)},s.prototype.nfs=function(){var t=this.nf(arguments);return t instanceof Array?t.map(i):i(t)},s.prototype.split=function(t,e){return t.split(e)},s.prototype.splitTokens=function(){var t=arguments.length>0?arguments[1]:/\s/g;return arguments[0].split(t).filter(function(t){return t})},s.prototype.trim=function(t){return t instanceof Array?t.map(this.trim):t.trim()},s}({},core),environment=function(t,e,r){"use strict";function o(t){var e=document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled;if(!e)throw new Error("Fullscreen not enabled in this browser.");t.requestFullscreen?t.requestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.msRequestFullscreen&&t.msRequestFullscreen()}function n(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen()}var i=e,s=r,a=[s.ARROW,s.CROSS,s.HAND,s.MOVE,s.TEXT,s.WAIT];return i.prototype._frameRate=0,i.prototype._lastFrameTime=(new Date).getTime(),i.prototype._targetFrameRate=60,i.prototype.frameCount=0,i.prototype.focused=!0,i.prototype.cursor=function(t,e,r){var o="auto",n=this._curElement.elt;if(a.indexOf(t)>-1)o=t;else if("string"==typeof t){var i="";e&&r&&"number"==typeof e&&"number"==typeof r&&(i=e+" "+r),o="http://"!==t.substring(0,6)?"url("+t+") "+i+", auto":/\.(cur|jpg|jpeg|gif|png|CUR|JPG|JPEG|GIF|PNG)$/.test(t)?"url("+t+") "+i+", auto":t}n.style.cursor=o},i.prototype.frameRate=function(t){return"undefined"==typeof t?this._frameRate:(this._setProperty("_targetFrameRate",t),this._runFrames(),this)},i.prototype.getFrameRate=function(){return this.frameRate()},i.prototype.setFrameRate=function(t){return this.frameRate(t)},i.prototype.noCursor=function(){this._curElement.elt.style.cursor="none"},i.prototype.displayWidth=screen.width,i.prototype.displayHeight=screen.height,i.prototype.windowWidth=window.innerWidth,i.prototype.windowHeight=window.innerHeight,i.prototype.onresize=function(t){this._setProperty("windowWidth",window.innerWidth),this._setProperty("windowHeight",window.innerHeight);var e,r=this._isGlobal?window:this;"function"==typeof r.windowResized&&(e=r.windowResized(t),void 0===e||e||t.preventDefault())},i.prototype.width=0,i.prototype.height=0,i.prototype.fullscreen=function(t){return"undefined"==typeof t?document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement:void(t?o(document.documentElement):n())},i}({},core,constants),imageimage=function(t,e,r){"use strict";var o=e,r=r;return o.prototype._imageMode=r.CORNER,o.prototype._tint=null,o.prototype.createImage=function(t,e){return new o.Image(t,e)},o}({},core,constants),canvas=function(t,e){var e=e;return{modeAdjust:function(t,r,o,n,i){return i===e.CORNER?{x:t,y:r,w:o,h:n}:i===e.CORNERS?{x:t,y:r,w:o-t,h:n-r}:i===e.RADIUS?{x:t-o,y:r-n,w:2*o,h:2*n}:i===e.CENTER?{x:t-.5*o,y:r-.5*n,w:o,h:n}:void 0},arcModeAdjust:function(t,r,o,n,i){return i===e.CORNER?{x:t+.5*o,y:r+.5*n,w:o,h:n}:i===e.CORNERS?{x:t,y:r,w:o+t,h:n+r}:i===e.RADIUS?{x:t,y:r,w:2*o,h:2*n}:i===e.CENTER?{x:t,y:r,w:o,h:n}:void 0}}}({},constants),imageloading_displaying=function(t,e,r,o,n){"use strict";var i=e,s=r,o=o,n=n;return i.prototype.loadImage=function(t,e){var r=new Image,o=new i.Image(1,1,this);return r.onload=function(){o.width=o.canvas.width=r.width,o.height=o.canvas.height=r.height,o.canvas.getContext("2d").drawImage(r,0,0),"undefined"!=typeof e&&e(o)},0!==t.indexOf("data:image/")&&(r.crossOrigin="Anonymous"),r.src=t,o},i.prototype.image=function(t,e,r,n,i){var s=t.canvas||t.elt;e=e||0,r=r||0,n=n||t.width,i=i||t.height;var a=o.modeAdjust(e,r,n,i,this._imageMode);this._tint&&t.canvas?this.drawingContext.drawImage(this._getTintedImageCanvas(t),a.x,a.y,a.w,a.h):this.drawingContext.drawImage(s,a.x,a.y,a.w,a.h)},i.prototype.tint=function(){var t=i.Color._getFormattedColor.apply(this,arguments);t=i.Color._normalizeColorArray.call(this,t),this._tint=t},i.prototype.noTint=function(){this._tint=null},i.prototype._getTintedImageCanvas=function(t){if(!t.canvas)return t;var e=s._toPixels(t.canvas),r=document.createElement("canvas");r.width=t.canvas.width,r.height=t.canvas.height;for(var o=r.getContext("2d"),n=o.createImageData(t.canvas.width,t.canvas.height),i=n.data,a=0;athis.width||e>this.height||0>t||0>e)return[0,0,0,255];var i=this.drawingContext.getImageData(t,e,r,n),s=i.data;if(1===r&&1===n){for(var a=[],p=0;p0;)self._completeHandlers.shift()(t)}function success(resp){resp="jsonp"!==type?self.request:resp;var filteredResponse=globalSetupOptions.dataFilter(resp.responseText,type),r=filteredResponse;try{resp.responseText=r}catch(e){}if(r)switch(type){case"json":try{resp=win.JSON?win.JSON.parse(r):eval("("+r+")")}catch(err){return error(resp,"Could not parse JSON in response",err)}break;case"js":resp=eval(r);break;case"html":resp=r;break;case"xml":resp=resp.responseXML&&resp.responseXML.parseError&&resp.responseXML.parseError.errorCode&&resp.responseXML.parseError.reason?null:resp.responseXML}for(self._responseArgs.resp=resp,self._fulfilled=!0,fn(resp),self._successHandler(resp);self._fulfillmentHandlers.length>0;)resp=self._fulfillmentHandlers.shift()(resp);complete(resp)}function error(t,e,r){for(t=self.request,self._responseArgs.resp=t,self._responseArgs.msg=e,self._responseArgs.t=r,self._erred=!0;self._errorHandlers.length>0;)self._errorHandlers.shift()(t,e,r);complete(t)}this.url="string"==typeof o?o:o.url,this.timeout=null,this._fulfilled=!1,this._successHandler=function(){},this._fulfillmentHandlers=[],this._errorHandlers=[],this._completeHandlers=[],this._erred=!1,this._responseArgs={};var self=this,type=o.type||setType(this.url);fn=fn||function(){},o.timeout&&(this.timeout=setTimeout(function(){self.abort()},o.timeout)),o.success&&(this._successHandler=function(){o.success.apply(o,arguments)}),o.error&&this._errorHandlers.push(function(){o.error.apply(o,arguments)}),o.complete&&this._completeHandlers.push(function(){o.complete.apply(o,arguments)}),this.request=getRequest.call(this,success,error)}function reqwest(t,e){return new Reqwest(t,e)}function normalize(t){return t?t.replace(/\r?\n/g,"\r\n"):""}function serial(t,e){var r,o,n,i,s=t.name,a=t.tagName.toLowerCase(),p=function(t){t&&!t.disabled&&e(s,normalize(t.attributes.value&&t.attributes.value.specified?t.value:t.text))};if(!t.disabled&&s)switch(a){case"input":/reset|button|image|file/i.test(t.type)||(r=/checkbox/i.test(t.type),o=/radio/i.test(t.type),n=t.value,(!(r||o)||t.checked)&&e(s,normalize(r&&""===n?"on":n)));break;case"textarea":e(s,normalize(t.value));break;case"select":if("select-one"===t.type.toLowerCase())p(t.selectedIndex>=0?t.options[t.selectedIndex]:null);else for(i=0;t.length&&ie){var i=t;t=e,e=i}return r*(e-t)+t};var i,s=!1;return r.prototype.randomGaussian=function(t,e){var r,o,n,a;if(s)r=i,s=!1;else{do o=this.random(2)-1,n=this.random(2)-1,a=o*o+n*n;while(a>=1);a=Math.sqrt(-2*Math.log(a)/a),r=o*a,i=n*a,s=!0}var p=t||0,u=e||1;return r*u+p},r}({},core),mathnoise=function(t,e){"use strict";for(var r=e,o=4,n=1<y;y++)c[y]=Math.sin(y*f*h),d[y]=Math.cos(y*f*h);var g=l;g>>=1;var m;return r.prototype.noise=function(t,e,r){if(e=e||0,r=r||0,null==m){m=new Array(a+1);for(var h=0;a+1>h;h++)m[h]=Math.random()}0>t&&(t=-t),0>e&&(e=-e),0>r&&(r=-r);for(var c,f,y,v,w,_=Math.floor(t),x=Math.floor(e),C=Math.floor(r),b=t-_,R=e-x,S=r-C,E=0,M=.5,T=function(t){return.5*(1-d[Math.floor(t*g)%l])},I=0;p>I;I++){var P=_+(x<=1&&(_++,b--),R>=1&&(x++,R--),S>=1&&(C++,S--)}return E},r.prototype.noiseDetail=function(t,e){t>0&&(p=t),e>0&&(u=e)},r.prototype.noiseSeed=function(t){var e=function(){var t,e,r=4294967296,o=1664525,n=1013904223;return{setSeed:function(o){e=t=o||Math.round(Math.random()*r)},getSeed:function(){return t},rand:function(){return e=(o*e+n)%r,e/r}}}();e.setSeed(t),m=new Array(a+1);for(var r=0;a+1>r;r++)m[r]=e.rand()},r}({},core),mathtrigonometry=function(t,e,r,o){"use strict";var n=e,i=r,o=o;return n.prototype._angleMode=o.RADIANS,n.prototype.acos=function(t){return this._angleMode===o.RADIANS?Math.acos(t):i.radiansToDegrees(Math.acos(t))},n.prototype.asin=function(t){return this._angleMode===o.RADIANS?Math.asin(t):i.radiansToDegrees(Math.asin(t))},n.prototype.atan=function(t){return this._angleMode===o.RADIANS?Math.atan(t):i.radiansToDegrees(Math.atan(t))},n.prototype.atan2=function(t,e){return this._angleMode===o.RADIANS?Math.atan2(t,e):i.radiansToDegrees(Math.atan2(t,e))},n.prototype.cos=function(t){return Math.cos(this._angleMode===o.RADIANS?t:this.radians(t))},n.prototype.sin=function(t){return Math.sin(this._angleMode===o.RADIANS?t:this.radians(t))},n.prototype.tan=function(t){return Math.tan(this._angleMode===o.RADIANS?t:this.radians(t))},n.prototype.degrees=function(t){return i.radiansToDegrees(t)},n.prototype.radians=function(t){return i.degreesToRadians(t)},n.prototype.angleMode=function(t){(t===o.DEGREES||t===o.RADIANS)&&(this._angleMode=t)},n}({},core,polargeometry,constants),outputfiles=function(t,e){"use strict";function r(t,e){e||(e=""),t||(t="untitled");var r="";return t&&t.indexOf(".")>-1&&(r=t.split(".").pop()),e&&r!==e&&(r=e,t=t+"."+r),[t,r]}function o(t){document.body.removeChild(t.target)}var n=e;return window.URL=window.URL||window.webkitURL,n.prototype._pWriters=[],n.prototype.beginRaw=function(){throw"not yet implemented"},n.prototype.beginRecord=function(){throw"not yet implemented"},n.prototype.createOutput=function(){throw"not yet implemented"},n.prototype.createWriter=function(t,e){var r;for(var o in n.prototype._pWriters)if(n.prototype._pWriters[o].name===t)return r=new n.PrintWriter(t+window.millis(),e),n.prototype._pWriters.push(r),r;return r=new n.PrintWriter(t,e),n.prototype._pWriters.push(r),r},n.prototype.endRaw=function(){throw"not yet implemented"},n.prototype.endRecord=function(){throw"not yet implemented"},n.prototype.escape=function(t){return t.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")},n.PrintWriter=function(t,e){var r=this;this.name=t,this.content="",this.print=function(t){this.content+=t},this.println=function(t){this.content+=t+"\n"},this.flush=function(){this.content=""},this.close=function(){var o=[];o.push(this.content),n.prototype.writeFile(o,t,e);for(var i in n.prototype._pWriters)n.prototype._pWriters[i].name===this.name&&n.prototype._pWriters.splice(i,1);r.flush(),r={}}},n.prototype.saveBytes=function(){throw"not yet implemented"},n.prototype.save=function(){var t=arguments,e=this._curElement.elt;if(0===t.length)return void n.prototype.saveCanvas(e);if(t[0]instanceof n.Graphics)return void n.prototype.saveCanvas(t[0].elt,t[1],t[2]);if("string"==typeof t[0])n.prototype.saveCanvas(e,t[0]);else{var o=r(t[1],t[2])[1];switch(o){case"json":n.prototype.saveJSON(t[0],t[1],t[2]);break;case"txt":n.prototype.saveStrings(t[0],t[1],t[2]);break;default:t[0]instanceof Array?n.prototype.saveStrings(t[0],t[1],t[2]):t[0]instanceof n.Table?n.prototype.saveTable(t[0],t[1],t[2],t[3]):t[0]instanceof n.Image?n.prototype.saveCanvas(t[0].canvas,t[1]):t[0]instanceof n.SoundFile?n.prototype.saveSound(t[0],t[1],t[2],t[3]):t[0]instanceof Object&&n.prototype.saveJSON(t[0],t[1],t[2])}}},n.prototype.saveJSON=function(t,e,r){var o;o=r?JSON.stringify(t):JSON.stringify(t,void 0,2),this.saveStrings(o.split("\n"),e,"json")},n.prototype.saveJSONObject=n.prototype.saveJSON,n.prototype.saveJSONArray=n.prototype.saveJSON,n.prototype.saveStream=function(){throw"not yet implemented"},n.prototype.saveStrings=function(t,e,r){var o=r||"txt",n=this.createWriter(e,o);for(var i in t)i"),o.println("");var h=' "),o.println(""),o.println(" "),"0"!==i[0]){o.println(" ");for(var l=0;l"+c),o.println(" ")}o.println(" ")}for(var d=0;d");for(var f=0;f"+g),o.println(" ")}o.println(" ")}o.println("
"),o.println(""),o.print("")}o.close(),o.flush()},n.prototype.writeFile=function(t,e,r){var o="application/octet-stream";n.prototype._isSafari()&&(o="text/plain");var i=new Blob(t,{type:o}),s=window.URL.createObjectURL(i);n.prototype.downloadFile(s,e,r)},n.prototype.downloadFile=function(t,e,i){var s=r(e,i),a=s[0],p=s[1],u=document.createElement("a");if(u.href=t,u.download=a,u.onclick=o,u.style.display="none",document.body.appendChild(u),n.prototype._isSafari()){var h="Hello, Safari user! To download this file...\n";h+="1. Go to File --> Save As.\n",h+='2. Choose "Page Source" as the Format.\n',h+='3. Name it with this extension: ."'+p+'"',alert(h)}u.click(),t=null},n.prototype._checkFileExtension=r,n.prototype._isSafari=function(){var t=Object.prototype.toString.call(window.HTMLElement);return t.indexOf("Constructor")>0},n}({},core),outputimage=function(t,e){"use strict";var r=e,o=[];return r.prototype.saveCanvas=function(t,e,o){o||(o=r.prototype._checkFileExtension(e,o)[1],""===o&&(o="png"));var n;if(t?n=t:this._curElement&&this._curElement.elt&&(n=this._curElement.elt),r.prototype._isSafari()){var i="Hello, Safari user!\n";i+="Now capturing a screenshot...\n",i+="To save this image,\n",i+="go to File --> Save As.\n",alert(i),window.location.href=n.toDataURL()}else{var s;if("undefined"==typeof o)o="png",s="image/png";else switch(o){case"png":s="image/png";break;case"jpeg":s="image/jpeg";break;case"jpg":s="image/jpeg";break;default:s="image/png"}var a="image/octet-stream",p=n.toDataURL(s);p=p.replace(s,a),r.prototype.downloadFile(p,e,o)}},r.prototype.saveFrames=function(t,e,n,i,s){var a=n||3;a=r.prototype.constrain(a,0,15),a=1e3*a;var p=i||15;p=r.prototype.constrain(p,0,22);var u=0,h=r.prototype._makeFrame,l=this._curElement.elt,c=setInterval(function(){h(t+u,e,l),u++},1e3/p);setTimeout(function(){if(clearInterval(c),s)s(o);else for(var t=0;th.w?h.h/2:h.w/2,c=h.h>h.w?h.w/h.h:1,d=h.h>h.w?1:h.h/h.w;return u.scale(c,d),u.beginPath(),u.arc(h.x,h.y,l,s,a),this._doStroke&&u.stroke(),p===o.CHORD||p===o.OPEN?u.closePath():(p===o.PIE||void 0===p)&&(u.lineTo(h.x,h.y),u.closePath()),this._doFill&&u.fill(),this._doStroke&&p!==o.OPEN&&void 0!==p&&u.stroke(),this}},n.prototype.ellipse=function(t,e,o,n){if(this._doStroke||this._doFill){o=Math.abs(o),n=Math.abs(n);var i=this.drawingContext,s=r.modeAdjust(t,e,o,n,this._ellipseMode);if(i.beginPath(),o===n)i.arc(s.x+s.w/2,s.y+s.w/2,s.w/2,0,2*Math.PI,!1);else{var a=.5522848,p=s.w/2*a,u=s.h/2*a,h=s.x+s.w,l=s.y+s.h,c=s.x+s.w/2,d=s.y+s.h/2;i.moveTo(s.x,d),i.bezierCurveTo(s.x,d-u,c-p,s.y,c,s.y),i.bezierCurveTo(c+p,s.y,h,d-u,h,d),i.bezierCurveTo(h,d+u,c+p,l,c,l),i.bezierCurveTo(c-p,l,s.x,d+u,s.x,d),i.closePath()}return this._doFill&&i.fill(),this._doStroke&&i.stroke(),this}},n.prototype.line=function(t,e,r,o){if(this._doStroke){var n=this.drawingContext;if("rgba(0,0,0,0)"!==n.strokeStyle)return n.beginPath(),n.moveTo(t,e),n.lineTo(r,o),n.stroke(),this}},n.prototype.point=function(t,e){if(this._doStroke){var r=this.drawingContext,n=r.strokeStyle,i=r.fillStyle;if("rgba(0,0,0,0)"!==n)return t=Math.round(t),e=Math.round(e),r.fillStyle=n,r.lineWidth>1?(r.beginPath(),r.arc(t,e,r.lineWidth/2,0,o.TWO_PI,!1),r.fill()):r.fillRect(t,e,1,1),r.fillStyle=i,this}},n.prototype.quad=function(t,e,r,o,n,i,s,a){if(this._doStroke||this._doFill){var p=this.drawingContext;return p.beginPath(),p.moveTo(t,e),p.lineTo(r,o),p.lineTo(n,i),p.lineTo(s,a),p.closePath(),this._doFill&&p.fill(),this._doStroke&&p.stroke(),this}},n.prototype.rect=function(t,e,o,n){if(this._doStroke||this._doFill){var i=r.modeAdjust(t,e,o,n,this._rectMode),s=this.drawingContext;return this._doStroke&&s.lineWidth%2===1&&s.translate(.5,.5),s.beginPath(),s.rect(i.x,i.y,i.w,i.h),this._doFill&&s.fill(),this._doStroke&&s.stroke(),this._doStroke&&s.lineWidth%2===1&&s.translate(-.5,-.5),this}},n.prototype.triangle=function(t,e,r,o,n,i){if(this._doStroke||this._doFill){var s=this.drawingContext;return s.beginPath(),s.moveTo(t,e),s.lineTo(r,o),s.lineTo(n,i),s.closePath(),this._doFill&&s.fill(),this._doStroke&&s.stroke(),this}},n}({},core,canvas,constants),shapeattributes=function(t,e,r){"use strict";var o=e,r=r;return o.prototype._rectMode=r.CORNER,o.prototype._ellipseMode=r.CENTER,o.prototype.ellipseMode=function(t){return(t===r.CORNER||t===r.CORNERS||t===r.RADIUS||t===r.CENTER)&&(this._ellipseMode=t),this},o.prototype.noSmooth=function(){return this.drawingContext.mozImageSmoothingEnabled=!1,this.drawingContext.webkitImageSmoothingEnabled=!1,this},o.prototype.rectMode=function(t){return(t===r.CORNER||t===r.CORNERS||t===r.RADIUS||t===r.CENTER)&&(this._rectMode=t),this},o.prototype.smooth=function(){return this.drawingContext.mozImageSmoothingEnabled=!0,this.drawingContext.webkitImageSmoothingEnabled=!0,this},o.prototype.strokeCap=function(t){return(t===r.ROUND||t===r.SQUARE||t===r.PROJECT)&&(this.drawingContext.lineCap=t),this},o.prototype.strokeJoin=function(t){return(t===r.ROUND||t===r.BEVEL||t===r.MITER)&&(this.drawingContext.lineJoin=t),this},o.prototype.strokeWeight=function(t){return this.drawingContext.lineWidth="undefined"==typeof t||0===t?1e-4:t,this},o}({},core,constants),shapecurves=function(t,e){"use strict";var r=e;return r.prototype._bezierDetail=20,r.prototype._curveDetail=20,r.prototype.bezier=function(t,e,o,n,i,s,a,p){if(this._doStroke){var u=this.drawingContext;u.beginPath(),u.moveTo(t,e);for(var h=0;h<=this._bezierDetail;h++){var l=h/parseFloat(this._bezierDetail),c=r.prototype.bezierPoint(t,o,i,a,l),d=r.prototype.bezierPoint(e,n,s,p,l);u.lineTo(c,d)}return u.stroke(),this}},r.prototype.bezierDetail=function(t){return this._setProperty("_bezierDetail",t),this},r.prototype.bezierPoint=function(t,e,r,o,n){var i=1-n;return Math.pow(i,3)*t+3*Math.pow(i,2)*n*e+3*i*Math.pow(n,2)*r+Math.pow(n,3)*o},r.prototype.bezierTangent=function(t,e,r,o,n){var i=1-n;return 3*o*Math.pow(n,2)-3*r*Math.pow(n,2)+6*r*i*n-6*e*i*n+3*e*Math.pow(i,2)-3*t*Math.pow(i,2)},r.prototype.curve=function(t,e,o,n,i,s,a,p){if(this._doStroke){var u=this.drawingContext;u.moveTo(t,e),u.beginPath();for(var h=0;h<=this._curveDetail;h++){var l=parseFloat(h/this._curveDetail),c=r.prototype.curvePoint(t,o,i,a,l),d=r.prototype.curvePoint(e,n,s,p,l);u.lineTo(c,d)}return u.stroke(),u.closePath(),this}},r.prototype.curveDetail=function(t){return this._setProperty("_curveDetail",t),this},r.prototype.curvePoint=function(t,e,r,o,n){var i=n*n*n,s=n*n,a=-.5*i+s-.5*n,p=1.5*i-2.5*s+1,u=-1.5*i+2*s+.5*n,h=.5*i-.5*s;return t*a+e*p+r*u+o*h},r.prototype.curveTangent=function(t,e,r,o,n){var i=n*n,s=-3*i/2+2*n-.5,a=9*i/2-5*n,p=-9*i/2+4*n+.5,u=3*i/2-n;return t*s+e*a+r*p+o*u},r.prototype.curveTightness=function(){throw"not yet implemented"},r}({},core),shapevertex=function(t,e,r){"use strict";var o=e,r=r;return o.prototype._shapeKind=null,o.prototype._shapeInited=!1,o.prototype._contourInited=!1,o.prototype._contourVertices=[],o.prototype._curveVertices=[],o.prototype.beginContour=function(){return this._contourVertices=[],this._contourInited=!0,this},o.prototype.beginShape=function(t){return this._shapeKind=t===r.POINTS||t===r.LINES||t===r.TRIANGLES||t===r.TRIANGLE_FAN||t===r.TRIANGLE_STRIP||t===r.QUADS||t===r.QUAD_STRIP?t:null,this._shapeInited=!0,this.drawingContext.beginPath(),this},o.prototype.bezierVertex=function(t,e,o,n,i,s){if(this._contourInited){var a={};return a.x=t,a.y=e,a.x3=o,a.y3=n,a.x4=i,a.y4=s,a.type=r.BEZIER,this._contourVertices.push(a),this}return this.drawingContext.bezierCurveTo(t,e,o,n,i,s),this},o.prototype.curveVertex=function(t,e){var r={};return r.x=t,r.y=e,this._curveVertices.push(r),this._curveVertices.length>=4&&(this.curve(this._curveVertices[0].x,this._curveVertices[0].y,this._curveVertices[1].x,this._curveVertices[1].y,this._curveVertices[2].x,this._curveVertices[2].y,this._curveVertices[3].x,this._curveVertices[3].y),this._curveVertices.shift()),this},o.prototype.endContour=function(){this._contourVertices.reverse(),this.drawingContext.moveTo(this._contourVertices[0].x,this._contourVertices[0].y);var t=this.drawingContext;return this._contourVertices.slice(1).forEach(function(e){switch(e.type){case r.LINEAR:t.lineTo(e.x,e.y);break;case r.QUADRATIC:t.quadraticCurveTo(e.x,e.y,e.x3,e.y3);break;case r.BEZIER:t.bezierCurveTo(e.x,e.y,e.x3,e.y3,e.x4,e.y4);break;case r.CURVE:}}),this.drawingContext.closePath(),this._contourInited=!1,this},o.prototype.endShape=function(t){return t===r.CLOSE&&(this.drawingContext.closePath(),this._doFill&&this.drawingContext.fill()),this._doStroke&&this._curveVertices.length<=0?this.drawingContext.stroke():this._curveVertices=[],this},o.prototype.quadraticVertex=function(t,e,o,n){if(this._contourInited){var i={};return i.x=t,i.y=e,i.x3=o,i.y3=n,i.type=r.QUADRATIC,this._contourVertices.push(i),this}return this.drawingContext.quadraticCurveTo(t,e,o,n),this},o.prototype.vertex=function(t,e){if(this._contourInited){var o={};return o.x=t,o.y=e,o.type=r.LINEAR,this._contourVertices.push(o),this}return this._shapeInited?this.drawingContext.moveTo(t,e):this.drawingContext.lineTo(t,e),this._shapeInited=!1,this},o}({},core,constants),structure=function(t,e){"use strict";var r=e;return r.prototype.exit=function(){throw"exit() not implemented, see remove()"},r.prototype.noLoop=function(){this._loop=!1,this._drawInterval&&clearInterval(this._drawInterval)},r.prototype.loop=function(){this._loop=!0,this._draw()},r.prototype.push=function(){this.drawingContext.save(),this._styles.push({doStroke:this._doStroke,doFill:this._doFill,tint:this._tint,imageMode:this._imageMode,rectMode:this._rectMode,ellipseMode:this._ellipseMode,colorMode:this._colorMode,textFont:this.textFont,textLeading:this.textLeading,textSize:this.textSize,textStyle:this.textStyle})},r.prototype.pop=function(){this.drawingContext.restore();var t=this._styles.pop();this._doStroke=t.doStroke,this._doFill=t.doFill,this._tint=t.tint,this._imageMode=t.imageMode,this._rectMode=t.rectMode,this._ellipseMode=t.ellipseMode,this._colorMode=t.colorMode,this.textFont=t.textFont,this.textLeading=t.textLeading,this.textSize=t.textSize,this.textStyle=t.textStyle},r.prototype.pushStyle=function(){throw new Error("pushStyle() not used, see push()")},r.prototype.popStyle=function(){throw new Error("popStyle() not used, see pop()")},r.prototype.redraw=function(){var t=this._isGlobal?window:this;t.draw&&t.draw()},r.prototype.size=function(){throw"size() not implemented, see createCanvas()"},r}({},core),transform=function(t,e,r){"use strict";var o=e,r=r;return o.prototype.applyMatrix=function(t,e,r,o,n,i){return this.drawingContext.transform(t,e,r,o,n,i),this},o.prototype.popMatrix=function(){throw new Error("popMatrix() not used, see pop()")},o.prototype.printMatrix=function(){throw new Error("printMatrix() not implemented")},o.prototype.pushMatrix=function(){throw new Error("pushMatrix() not used, see push()")},o.prototype.resetMatrix=function(){return this.drawingContext.setTransform(),this},o.prototype.rotate=function(t){return this._angleMode===r.DEGREES&&(t=this.radians(t)),this.drawingContext.rotate(t),this},o.prototype.rotateX=function(){throw"not yet implemented"},o.prototype.rotateY=function(){throw"not yet implemented"},o.prototype.scale=function(){var t=1,e=1;return 1===arguments.length?t=e=arguments[0]:(t=arguments[0],e=arguments[1]),this.drawingContext.scale(t,e),this},o.prototype.shearX=function(t){return this._angleMode===r.DEGREES&&(t=this.radians(t)),this.drawingContext.transform(1,0,this.tan(t),1,0,0),this},o.prototype.shearY=function(t){return this._angleMode===r.DEGREES&&(t=this.radians(t)),this.drawingContext.transform(1,this.tan(t),0,1,0,0),this},o.prototype.translate=function(t,e){return this.drawingContext.translate(t,e),this},o}({},core,constants,outputtext_area),typographyattributes=function(t,e,r){"use strict";var o=e,r=r;return o.prototype._textLeading=15,o.prototype._textFont="sans-serif",o.prototype._textSize=12,o.prototype._textStyle=r.NORMAL,o.prototype._textAscent=null,o.prototype._textDescent=null,o.prototype.textAlign=function(t){(t===r.LEFT||t===r.RIGHT||t===r.CENTER)&&(this.drawingContext.textAlign=t)},o.prototype.textLeading=function(t){this._setProperty("_textLeading",t)},o.prototype.textSize=function(t){this._setProperty("_textSize",t),this._applyTextProperties()},o.prototype.textStyle=function(t){(t===r.NORMAL||t===r.ITALIC||t===r.BOLD)&&(this._setProperty("_textStyle",t),this._applyTextProperties())},o.prototype.textWidth=function(t){return this.drawingContext.measureText(t).width},o.prototype.textAscent=function(){return null==this._textAscent&&this._updateTextMetrics(),this._textAscent},o.prototype.textDescent=function(){return null==this._textDescent&&this._updateTextMetrics(),this._textDescent},o.prototype._applyTextProperties=function(){this._setProperty("_textAscent",null),this._setProperty("_textDescent",null);var t=this._textStyle+" "+this._textSize+"px "+this._textFont;this.drawingContext.font=t},o.prototype._updateTextMetrics=function(){var t=document.createElement("span");t.style.fontFamily=this._textFont,t.style.fontSize=this._textSize+"px",t.innerHTML="ABCjgq|";var e=document.createElement("div");e.style.display="inline-block",e.style.width="1px",e.style.height="0px";var r=document.createElement("div");r.appendChild(t),r.appendChild(e),r.style.height="0px",r.style.overflow="hidden",document.body.appendChild(r),e.style.verticalAlign="baseline";var o=this._calculateOffset(e),n=this._calculateOffset(t),i=o[1]-n[1];e.style.verticalAlign="bottom",o=this._calculateOffset(e),n=this._calculateOffset(t);var s=o[1]-n[1],a=s-i;document.body.removeChild(r),this._setProperty("_textAscent",i),this._setProperty("_textDescent",a)},o.prototype._calculateOffset=function(t){var e=0,r=0;if(t.offsetParent){do e+=t.offsetLeft,r+=t.offsetTop;while(t=t.offsetParent)}else e+=t.offsetLeft,r+=t.offsetTop;return[e,r]},o}({},core,constants),typographyloading_displaying=function(t,e,r){"use strict";var o=e,r=r;return o.prototype.text=function(){if(3===arguments.length)this._doFill&&this.drawingContext.fillText(arguments[0],arguments[1],arguments[2]),this._doStroke&&this.drawingContext.strokeText(arguments[0],arguments[1],arguments[2]);else if(5===arguments.length){for(var t=arguments[0].split(" "),e="",o=r.modeAdjust(arguments[1],arguments[2],arguments[3],arguments[4],this._rectMode),n=o.y+this._textLeading,i=0;io.y+o.h)break;p>o.w&&i>0?(this._doFill&&this.drawingContext.fillText(e,o.x,n),this._doStroke&&this.drawingContext.strokeText(e,o.x,n),e=t[i]+" ",n+=this._textLeading):e=s}n<=o.y+o.h&&(this._doFill&&this.drawingContext.fillText(e,o.x,n),this._doStroke&&this.drawingContext.strokeText(e,o.x,n))}},o.prototype.textFont=function(t){this._setProperty("_textFont",t),this._applyTextProperties()},o}({},core,canvas),src_app=function(t,e){"use strict";var r=e,o=function(){window.PHANTOMJS||(window.setup&&"function"==typeof window.setup||window.draw&&"function"==typeof window.draw)&&new r};return"complete"===document.readyState?o():window.addEventListener("load",o,!1),window.p5=r,r}({},core,p5Color,p5Element,p5Graphics,p5Image,p5Vector,p5TableRow,p5Table,colorcreating_reading,colorsetting,constants,dataconversion,dataarray_functions,datastring_functions,environment,imageimage,imageloading_displaying,imagepixels,inputfiles,inputkeyboard,inputmouse,inputtime_date,inputtouch,mathmath,mathcalculation,mathrandom,mathnoise,mathtrigonometry,outputfiles,outputimage,outputtext_area,renderingrendering,shape2d_primitives,shapeattributes,shapecurves,shapevertex,structure,transform,typographyattributes,typographyloading_displaying); \ No newline at end of file