|
!function(a,b){function c(a){this._borders=[],this.id=a||c._idCount,c._idCount++}function d(a){this._gradients=[],this._colors=[],this.id=a||d._idCount,d._idCount++}function e(){}function f(a){var b,c,d,e=a||{};for(this.world=e.world||Burner.System.firstWorld(),this.position=e.position||"top left",this.text=e.text||"",this.opacity="undefined"==typeof e.opacity?.75:e.opacity,this.color=e.color||[255,255,255],this.borderWidth=e.borderWidth||0,this.borderStyle=e.borderStyle||"none",this.borderColor=e.borderColor||[204,204,204],this.colorMode="rgb",this.el=document.createElement("div"),this.el.id="caption",this.el.className="caption ",d=this.position.split(" "),b=0,c=d.length;c>b;b++)this.el.className=this.el.className+"caption"+y.capitalizeFirstLetter(d[b])+" ";this.el.style.opacity=this.opacity,this.el.style.color=this.colorMode+"("+this.color[0]+", "+this.color[1]+", "+this.color[2]+")",this.el.style.borderWidth=this.borderWidth+"px",this.el.style.borderStyle=this.borderStyle,this.el.style.borderColor="string"==typeof this.borderColor?this.borderColor:this.colorMode+"("+this.borderColor[0]+", "+this.borderColor[1]+", "+this.borderColor[2]+")",this.el.appendChild(document.createTextNode(this.text)),document.getElementById("caption")&&document.getElementById("caption").parentNode.removeChild(document.getElementById("caption")),this.world.el.appendChild(this.el)}function g(a){var b,c,d,e=this,f=a||{};for(this.world=f.world||Burner.System.firstWorld(),this.position=f.position||"top left",this.opacity="undefined"==typeof f.opacity?.75:f.opacity,this.color=f.color||[255,255,255],this.borderWidth=f.borderWidth||0,this.borderStyle=f.borderStyle||"none",this.borderColor=f.borderColor||[204,204,204],this.colorMode="rgb",this.text=Burner.System.supportedFeatures.touch?w.touchMap.stats+"-finger tap = stats | "+w.touchMap.pause+"-finger tap = pause | "+w.touchMap.reset+"-finger tap = reset":"'"+String.fromCharCode(w.keyMap.pause).toLowerCase()+"' = pause | "+"'"+String.fromCharCode(w.keyMap.resetSystem).toLowerCase()+"' = reset | "+"'"+String.fromCharCode(w.keyMap.stats).toLowerCase()+"' = stats",this.el=document.createElement("div"),this.el.id="inputMenu",this.el.className="inputMenu ",d=this.position.split(" "),b=0,c=d.length;c>b;b++)this.el.className=this.el.className+"inputMenu"+y.capitalizeFirstLetter(d[b])+" ";this.el.style.opacity=this.opacity,this.el.style.color=this.colorMode+"("+this.color[0]+", "+this.color[1]+", "+this.color[2]+")",this.el.style.borderWidth=this.borderWidth+"px",this.el.style.borderStyle=this.borderStyle,this.el.style.borderColor="string"==typeof this.borderColor?this.borderColor:this.colorMode+"("+this.borderColor[0]+", "+this.borderColor[1]+", "+this.borderColor[2]+")",this.el.appendChild(document.createTextNode(this.text)),document.getElementById("inputMenu")&&document.getElementById("inputMenu").parentNode.removeChild(document.getElementById("inputMenu")),Burner.System.supportedFeatures.touch?y.addEvent(this.el,"touchstart",function(){e.destroy()}):y.addEvent(this.el,"mouseup",function(){e.destroy()}),this.world.el.appendChild(this.el)}function h(a){var b=a||{};b.name=b.name||"Mover",Burner.Item.call(this,b)}function i(a){var b=a||{};b.name=b.name||"Agent",h.call(this,b)}function j(a){var b=a||{};b.name=b.name||"Walker",h.call(this,b)}function k(a){var b=a||{};b.name=b.name||"Sensor",h.call(this,b)}function l(a){var b=a||{};b.name=b.name||"Connector",Burner.Item.call(this,b)}function m(a){var b=a||{};b.name=b.name||"Point",h.call(this,b)}function n(a){var b=a||{};b.name=b.name||"Particle",i.call(this,b)}function o(a){var b=a||{};b.name=b.name||"ParticleSystem",i.call(this,b)}function p(a){var b=a||{};b.name=b.name||"Oscillator",Burner.Item.call(this,b)}function q(a){var b=a||{};b.name=b.name||"Liquid",i.call(this,b)}function r(a){var b=a||{};b.name=b.name||"Attractor",i.call(this,b)}function s(a){var b=a||{};b.name=b.name||"Repeller",i.call(this,b)}function t(a){if(!a||!a.type)throw new Error("Stimulus: options.type is required.");a.name=a.type.substr(0,1).toUpperCase()+a.type.toLowerCase().substr(1,a.type.length),i.call(this,a)}function u(a){var b=a||{};b.name=b.name||"FlowField",Burner.Item.call(this,b)}function v(a){var b,c,d={location:"object",scale:"number",angle:"number",opacity:"number",width:"number",height:"number",colorMode:"string",color:"array"};return x.checkRequiredParams(a,d)?(b=document.createElement("div"),c=document.createElement("div"),b.className="flowFieldMarker item",c.className="nose",b.appendChild(c),b.style.cssText=Burner.System.getCSSText({x:a.location.x-a.width/2,y:a.location.y-a.height/2,width:a.width,height:a.height,opacity:a.opacity,angle:a.angle,scale:1,colorMode:a.colorMode,color0:a.color[0],color1:a.color[1],color2:a.color[2],zIndex:a.zIndex,borderRadius:a.borderRadius}),b):void 0}b.Flora=a,Burner.Classes=Flora;var w={borderStyles:["none","solid","dotted","dashed","double","inset","outset","groove","ridge"],defaultColorList:[{name:"cold",startColor:[88,129,135],endColor:[171,244,255],boxShadowColor:[132,192,201]},{name:"food",startColor:[186,255,130],endColor:[84,187,0],boxShadowColor:[57,128,0]},{name:"heat",startColor:[255,132,86],endColor:[175,47,0],boxShadowColor:[255,69,0]},{name:"light",startColor:[255,255,255],endColor:[189,148,0],boxShadowColor:[255,200,0]},{name:"oxygen",startColor:[130,136,255],endColor:[49,56,205],boxShadowColor:[60,64,140]}],keyMap:{pause:80,resetSystem:82,stats:83},touchMap:{stats:2,pause:3,reset:4}},x={};x.checkRequiredParams=function(a,b,c){var d,e,f=!0;for(d in b)if(b.hasOwnProperty(d))try{if("undefined"==typeof a)throw new Error("checkRequiredOptions: No options were passed.");if(!this.checkDataType(this.getDataType(a[d]),b[d].split("|"))||""===a[d])throw f=!1,e=""===a[d]?'checkRequiredOptions: required option "'+d+'" is empty.':"undefined"==typeof a[d]?'checkRequiredOptions: required option "'+d+'" is missing from passed options.':'checkRequiredOptions: passed option "'+d+'" must be type '+b[d]+". Passed as "+this.getDataType(a[d])+".",new Error(e)}catch(g){"undefined"!=typeof console&&console.log("ERROR: "+g.message+(c?" from: "+c:""))}return f},x.checkDataType=function(a,b){var c,d;for(c=0,d=b.length;d>c;c++)if(a===b[c])return!0;return!1},x.getDataType=function(a){return"[object Array]"===Object.prototype.toString.call(a)?"array":"[object NodeList]"===Object.prototype.toString.call(a)?"nodeList":typeof a};var y={};y.extend=function(a,b){function c(){}c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a,a._superClass=b},y.map=function(a,b,c,d,e){var f=(a-b)/(c-b);return f*(e-d)+d},y.getRandomNumber=function(a,b,c){return c?Math.random()*(b-(a-1))+a:Math.floor(Math.random()*(b-(a-1)))+a},y.degreesToRadians=function(a){return"undefined"!=typeof a?2*Math.PI*(a/360):("undefined"!=typeof console&&console.log("Error: Utils.degreesToRadians is missing degrees param."),!1)},y.radiansToDegrees=function(a){return"undefined"!=typeof a?a*(180/Math.PI):("undefined"!=typeof console&&console.log("Error: Utils.radiansToDegrees is missing radians param."),!1)},y.constrain=function(a,b,c){return a>c?c:b>a?b:a},y.clone=function(a){function b(){}return b.prototype=a,new b},y.addEvent=function(a,b,c){a.addEventListener?this.addEventHandler=function(a,b,c){a.addEventListener(b,c,!1)}:a.attachEvent&&(this.addEventHandler=function(a,b,c){a.attachEvent("on"+b,c)}),this.addEventHandler(a,b,c)},y.log=function(a){"undefined"!=typeof console&&"undefined"!=typeof console.log?(this.log=function(a){console.log(a)},this.log.call(this,a)):this.log=function(){}},y.getWindowSize=function(){var a={width:!1,height:!1};return"undefined"!=typeof window.innerWidth?a.width=window.innerWidth:"undefined"!=typeof document.documentElement&&"undefined"!=typeof document.documentElement.clientWidth?a.width=document.documentElement.clientWidth:"undefined"!=typeof document.body&&(a.width=document.body.clientWidth),"undefined"!=typeof window.innerHeight?a.height=window.innerHeight:"undefined"!=typeof document.documentElement&&"undefined"!=typeof document.documentElement.clientHeight?a.height=document.documentElement.clientHeight:"undefined"!=typeof document.body&&(a.height=document.body.clientHeight),a},y.getDataType=function(a){return"[object Array]"===Object.prototype.toString.call(a)?"array":"[object NodeList]"===Object.prototype.toString.call(a)?"nodeList":typeof a},y.capitalizeFirstLetter=function(a){return a.charAt(0).toUpperCase()+a.slice(1)},y.isInside=function(a,b){return b&&a.location.x+a.width/2>b.location.x-b.width/2&&a.location.x-a.width/2<b.location.x+b.width/2&&a.location.y+a.height/2>b.location.y-b.height/2&&a.location.y-a.height/2<b.location.y+b.height/2?!0:!1},y.mouseIsInsideWorld=function(a){var b=Burner.System.mouse,c=b.location.x,d=b.location.y,e=a.el.offsetLeft,f=a.el.offsetTop;return a&&c>e&&c<e+a.bounds[1]&&d>f&&d<f+a.bounds[2]?!0:!1};var z=function(a){"undefined"==typeof a&&(a=Math);var b,c=[[1,1,0],[-1,1,0],[1,-1,0],[-1,-1,0],[1,0,1],[-1,0,1],[1,0,-1],[-1,0,-1],[0,1,1],[0,-1,1],[0,1,-1],[0,-1,-1]],d=[];for(b=0;256>b;b+=1)d[b]=Math.floor(256*a.random());var e=[];for(b=0;512>b;b+=1)e[b]=d[255&b];var f=[[0,1,2,3],[0,1,3,2],[0,0,0,0],[0,2,3,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,3,0],[0,2,1,3],[0,0,0,0],[0,3,1,2],[0,3,2,1],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,3,2,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[1,2,0,3],[0,0,0,0],[1,3,0,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,3,0,1],[2,3,1,0],[1,0,2,3],[1,0,3,2],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,3,1],[0,0,0,0],[2,1,3,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0],[2,0,1,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,0,1,2],[3,0,2,1],[0,0,0,0],[3,1,2,0],[2,1,0,3],[0,0,0,0],[0,0,0,0],[0,0,0,0],[3,1,0,2],[0,0,0,0],[3,2,0,1],[3,2,1,0]];return{grad3:c,p:d,perm:e,simplex:f,dot:function(a,b,c){return a[0]*b+a[1]*c},noise:function(a,b){var c,d,e,f,g,h=.5*(Math.sqrt(3)-1),i=(a+b)*h,j=Math.floor(a+i),k=Math.floor(b+i),l=(3-Math.sqrt(3))/6,m=(j+k)*l,n=j-m,o=k-m,p=a-n,q=b-o;p>q?(f=1,g=0):(f=0,g=1);var r=p-f+l,s=q-g+l,t=p-1+2*l,u=q-1+2*l,v=255&j,w=255&k,x=this.perm[v+this.perm[w]]%12,y=this.perm[v+f+this.perm[w+g]]%12,z=this.perm[v+1+this.perm[w+1]]%12,A=.5-p*p-q*q;0>A?c=0:(A*=A,c=A*A*this.dot(this.grad3[x],p,q));var B=.5-r*r-s*s;0>B?d=0:(B*=B,d=B*B*this.dot(this.grad3[y],r,s));var C=.5-t*t-u*u;return 0>C?e=0:(C*=C,e=C*C*this.dot(this.grad3[z],t,u)),70*(c+d+e)},noise3d:function(a,b,c){var d,e,f,g,h,i,j,k,l,m,n=1/3,o=(a+b+c)*n,p=Math.floor(a+o),q=Math.floor(b+o),r=Math.floor(c+o),s=1/6,t=(p+q+r)*s,u=p-t,v=q-t,w=r-t,x=a-u,y=b-v,z=c-w;x>=y?y>=z?(h=1,i=0,j=0,k=1,l=1,m=0):x>=z?(h=1,i=0,j=0,k=1,l=0,m=1):(h=0,i=0,j=1,k=1,l=0,m=1):z>y?(h=0,i=0,j=1,k=0,l=1,m=1):z>x?(h=0,i=1,j=0,k=0,l=1,m=1):(h=0,i=1,j=0,k=1,l=1,m=0);var A=x-h+s,B=y-i+s,C=z-j+s,D=x-k+2*s,E=y-l+2*s,F=z-m+2*s,G=x-1+3*s,H=y-1+3*s,I=z-1+3*s,J=255&p,K=255&q,L=255&r,M=this.perm[J+this.perm[K+this.perm[L]]]%12,N=this.perm[J+h+this.perm[K+i+this.perm[L+j]]]%12,O=this.perm[J+k+this.perm[K+l+this.perm[L+m]]]%12,P=this.perm[J+1+this.perm[K+1+this.perm[L+1]]]%12,Q=.6-x*x-y*y-z*z;0>Q?d=0:(Q*=Q,d=Q*Q*this.dot(this.grad3[M],x,y,z));var R=.6-A*A-B*B-C*C;0>R?e=0:(R*=R,e=R*R*this.dot(this.grad3[N],A,B,C));var S=.6-D*D-E*E-F*F;0>S?f=0:(S*=S,f=S*S*this.dot(this.grad3[O],D,E,F));var T=.6-G*G-H*H-I*I;return 0>T?g=0:(T*=T,g=T*T*this.dot(this.grad3[P],G,H,I)),32*(d+e+f+g)}}}({random:function(){return.1}});c._idCount=0,c.prototype.name="BorderPalette",c.prototype.addBorder=function(a){var b,c,d={min:"number",max:"number",style:"string"};if(x.checkRequiredParams(a,d))for(c=y.getRandomNumber(a.min,a.max),b=0;c>b;b++)this._borders.push(a.style);return this},c.prototype.getBorder=function(){if(this._borders.length>0)return this._borders[y.getRandomNumber(0,this._borders.length-1)];throw new Error("BorderPalette.getBorder: You must add borders via addBorder() before using getBorder().")},d._idCount=0,d.prototype.name="ColorPalette",d.prototype.addColor=function(a){var b,c,e,f={min:"number",max:"number",startColor:"array",endColor:"array"};if(x.checkRequiredParams(a,f))for(c=y.getRandomNumber(a.min,a.max),e=d._createColorRange(a.startColor,a.endColor,255),b=0;c>b;b++)this._colors.push(e[y.getRandomNumber(0,e.length-1)]);return this},d.prototype.createGradient=function(a){var b={startColor:"array",endColor:"array"};if(x.checkRequiredParams(a,b)){if(this.startColor=a.startColor,this.endColor=a.endColor,this.totalColors=a.totalColors||255,!(this.totalColors>0))throw new Error("ColorPalette: total colors must be greater than zero.");this._gradients.push(d._createColorRange(this.startColor,this.endColor,this.totalColors))}},d.prototype.getColor=function(){if(this._colors.length>0)return this._colors[y.getRandomNumber(0,this._colors.length-1)];throw new Error("ColorPalette.getColor: You must add colors via addColor() before using getColor().")},d.prototype.createSampleStrip=function(a){var b,c,d;for(b=0,c=this._colors.length;c>b;b++)d=document.createElement("div"),d.className="color-sample-strip",d.style.background="rgb("+this._colors[b].toString()+")",a.appendChild(d)},d._createColorRange=function(a,b,c){var d,e,f,g,h,i,j,k=[],l=a[0],m=a[1],n=a[2],o=b[0],p=b[1],q=b[2];for(e=o-l,f=p-m,g=q-n,d=0;c>d;d++)h=parseInt(e*d/c,10)+l,i=parseInt(f*d/c,10)+m,j=parseInt(g*d/c,10)+n,k.push([h,i,j]);return k},e.prototype.addColor=function(a){var b={name:"string",startColor:"array",endColor:"array"};return x.checkRequiredParams(a,b)&&(this[a.name]={startColor:a.startColor,endColor:a.endColor}),this},e.prototype.name="ColorTable",e.prototype.getColor=function(a,b,c){var d,e,f;if("string"!==x.getDataType(a))throw new Error("ColorTable: You must pass a name (string) for the color entry in the table.");if(!this[a])throw new Error("ColorTable: "+a+" does not exist. Add colors to the ColorTable via addColor().");return d=this[a],b&&(e=d.startColor),c&&(f=d.endColor),e&&f||!e&&!f?{startColor:d.startColor,endColor:d.endColor}:e?e:f?f:void 0},f.prototype.name="Caption",f.prototype.reset=function(){},f.prototype.init=function(){},f.prototype.destroy=function(){var a=this.el.id;return this.el.parentNode.removeChild(this.el),document.getElementById(a)?void 0:!0},g.prototype.name="InputMenu",g.prototype.reset=function(){},g.prototype.init=function(){},g.prototype.destroy=function(){var a=this.el.id;return this.el.parentNode.removeChild(this.el),document.getElementById(a)?void 0:!0},y.extend(h,Burner.Item),h.prototype.init=function(a){this.width="undefined"==typeof a.width?20:a.width,this.height="undefined"==typeof a.height?20:a.height,this.color=a.color||[255,255,255],this.motorSpeed=a.motorSpeed||0,this.angle=a.angle||0,this.pointToDirection="undefined"==typeof a.pointToDirection?!0:a.pointToDirection,this.draggable=!!a.draggable,this.parent=a.parent||null,this.pointToParentDirection=!!a.pointToParentDirection,this.offsetDistance="undefined"==typeof a.offsetDistance?30:a.offsetDistance,this.offsetAngle=a.offsetAngle||0,this.beforeStep=a.beforeStep||null,this.afterStep=a.afterStep||null,this.isMouseOut=!1,this.isPressed=!1;var b=function(a){return function(b){a.mouseover(b,a)}}(this),c=function(a){return function(b){a.mousedown(b,a)}}(this),d=function(a){return function(b){a.mousemove(b,a)}}(this),e=function(a){return function(b){a.mouseup(b,a)}}(this),f=function(a){return function(b){a.mouseout(b,a)}}(this);this.draggable&&(y.addEvent(this.el,"mouseover",b),y.addEvent(this.el,"mousedown",c),y.addEvent(this.el,"mousemove",d),y.addEvent(this.el,"mouseup",e),y.addEvent(this.el,"mouseout",f))},h.prototype.mouseover=function(){this.isMouseOut=!1,clearInterval(this.mouseOutInterval)},h.prototype.mousedown=function(a){var b,c=a.target||a.srcElement;a.changedTouches&&(b=a.changedTouches[0]),a.pageX&&a.pageY?(this.offsetX=a.pageX-c.offsetLeft,this.offsetY=a.pageY-c.offsetTop):a.clientX&&a.clientY?(this.offsetX=a.clientX-c.offsetLeft,this.offsetY=a.clientY-c.offsetTop):b&&(this.offsetX=b.pageX-c.offsetLeft,this.offsetY=b.pageY-c.offsetTop),this.isPressed=!0,this.isMouseOut=!1},h.prototype.mousemove=function(a){var b,c,d;this.isPressed&&(this.isMouseOut=!1,a.changedTouches&&(d=a.changedTouches[0]),a.pageX&&a.pageY?(b=a.pageX-this.world.el.offsetLeft,c=a.pageY-this.world.el.offsetTop):a.clientX&&a.clientY?(b=a.clientX-this.world.el.offsetLeft,c=a.clientY-this.world.el.offsetTop):d&&(b=d.pageX-this.world.el.offsetLeft,c=d.pageY-this.world.el.offsetTop),y.mouseIsInsideWorld(this.world)?this.location=new Burner.Vector(b,c):this.isPressed=!1)},h.prototype.mouseup=function(){this.isPressed=!1},h.prototype.mouseout=function(a,b){var c,d,e=b,f=Burner.System.mouse;b.isPressed&&(b.isMouseOut=!0,b.mouseOutInterval=setInterval(function(){e.isPressed&&e.isMouseOut&&(c=f.location.x-e.world.el.offsetLeft,d=f.location.y-e.world.el.offsetTop,e.location=new Burner.Vector(c,d))},16))},h.prototype.step=function(){var a,b,c,d,e;this.beforeStep&&this.beforeStep.apply(this),this.isStatic||this.isPressed||(this.world.c&&(a=y.clone(this.velocity),a.mult(-1),a.normalize(),a.mult(this.world.c),this.applyForce(a)),this.applyForce(this.world.gravity),this.applyForces&&this.applyForces(),this.velocity.add(this.acceleration),this.velocity.limit(this.maxSpeed,this.minSpeed),this.location.add(this.velocity),this.pointToDirection&&this.velocity.mag()>.1&&(this.angle=y.radiansToDegrees(Math.atan2(this.velocity.y,this.velocity.x)))),this.controlCamera&&this._checkCameraEdges(),this.checkWorldEdges&&this._checkWorldEdges(),this.parent&&(this.offsetDistance?(b=this.offsetDistance,c=y.degreesToRadians(this.parent.angle+this.offsetAngle),d=b*Math.cos(c),e=b*Math.sin(c),this.location.x=this.parent.location.x,this.location.y=this.parent.location.y,this.location.add(new Burner.Vector(d,e)),this.pointToParentDirection&&(this.angle=y.radiansToDegrees(Math.atan2(this.parent.velocity.y,this.parent.velocity.x)))):this.location=this.parent.location),this.acceleration.mult(0),this.life<this.lifespan?this.life+=1:-1!==this.lifespan&&Burner.System.destroyItem(this),this.afterStep&&this.afterStep.apply(this)},h.prototype._seek=function(a){var b=this.world,c=Burner.Vector.VectorSub(a.location,this.location),d=c.mag();if(c.normalize(),d<b.bounds[1]/2){var e=y.map(d,0,b.bounds[1]/2,0,this.maxSpeed);c.mult(e)}else c.mult(this.maxSpeed);return c.sub(this.velocity),c.limit(this.maxSteeringForce),c},h.prototype._checkAvoidEdges=function(){var a,b;this.location.x<this.avoidWorldEdgesStrength?a=this.maxSpeed:this.location.x>this.world.bounds[1]-this.avoidWorldEdgesStrength&&(a=-this.maxSpeed),a&&(b=new Burner.Vector(a,this.velocity.y),b.sub(this.velocity),b.limit(this.maxSteeringForce),this.applyForce(b)),this.location.y<this.avoidWorldEdgesStrength?a=this.maxSpeed:this.location.y>this.world.bounds[2]-this.avoidWorldEdgesStrength&&(a=-this.maxSpeed),a&&(b=new Burner.Vector(this.velocity.x,a),b.sub(this.velocity),b.limit(this.maxSteeringForce),this.applyForce(b))},h.prototype.drag=function(a){var b=this.velocity.mag(),c=-1*a.c*b*b,d=y.clone(this.velocity);return d.normalize(),d.mult(c),d},h.prototype.attract=function(a){var b,c,d=Burner.Vector.VectorSub(a.location,this.location);return b=d.mag(),b=y.constrain(b,this.width*this.height,a.width*a.height),d.normalize(),c=a.G*a.mass*this.mass/(b*b),d.mult(c),d},h.prototype.isInside=function(a){return a&&this.location.x+this.width/2>a.location.x-a.width/2&&this.location.x-this.width/2<a.location.x+a.width/2&&this.location.y+this.height/2>a.location.y-a.height/2&&this.location.y-this.height/2<a.location.y+a.height/2?!0:!1},y.extend(i,h),i.prototype.init=function(a){var b=a||{};i._superClass.prototype.init.call(this,b),this.followMouse=!!b.followMouse,this.maxSteeringForce="undefined"==typeof b.maxSteeringForce?10:b.maxSteeringForce,this.seekTarget=b.seekTarget||null,this.flocking=!!b.flocking,this.desiredSeparation="undefined"==typeof b.desiredSeparation?2*this.width:b.desiredSeparation,this.separateStrength="undefined"==typeof b.separateStrength?.3:b.separateStrength,this.alignStrength="undefined"==typeof b.alignStrength?.2:b.alignStrength,this.cohesionStrength="undefined"==typeof b.cohesionStrength?.1:b.cohesionStrength,this.flowField=b.flowField||null,this.sensors=b.sensors||[],this.color=b.color||[197,177,115],this.borderWidth=b.borderWidth||0,this.borderStyle=b.borderStyle||"none",this.borderColor=b.borderColor||"transparent",this.borderRadius=b.borderRadius||this.sensors.length?100:0,this.separateSumForceVector=new Burner.Vector,this.alignSumForceVector=new Burner.Vector,this.cohesionSumForceVector=new Burner.Vector,this.followTargetVector=new Burner.Vector,this.followDesiredVelocity=new Burner.Vector},i.prototype.applyForces=function(){var a,b,c,d,e,f,g,h,i,j=Burner.System._caches.Liquid,k=Burner.System._caches.Attractor,l=Burner.System._caches.Repeller;if(Burner.System._caches.Heat,j&&j.list.length>0)for(a=0,b=j.list.length;b>a;a+=1)this.id!==j.list[a].id&&y.isInside(this,j.list[a])&&this.applyForce(this.drag(j.list[a]));if(k&&k.list.length>0)for(a=0,b=k.list.length;b>a;a+=1)this.id!==k.list[a].id&&this.applyForce(this.attract(k.list[a]));if(l&&l.list.length>0)for(a=0,b=l.list.length;b>a;a+=1)this.id!==l.list[a].id&&this.applyForce(this.attract(l.list[a]));if(this.sensors.length>0)for(a=0,b=this.sensors.length;b>a;a+=1)e=this.sensors[a],f=e.offsetDistance,g=y.degreesToRadians(this.angle+e.offsetAngle),h=f*Math.cos(g),i=f*Math.sin(g),e.location.x=this.location.x,e.location.y=this.location.y,e.location.add(new Burner.Vector(h,i)),a&&(e.borderStyle="none"),e.activated&&(this.applyForce(e.getActivationForce(this)),c=!0);if(!c&&this.motorSpeed&&(d=y.clone(this.velocity),d.normalize(),this.velocity.mag()>this.motorSpeed?d.mult(-this.motorSpeed):d.mult(this.motorSpeed),this.applyForce(d)),this.followMouse&&!Burner.System.supportedFeatures.touch){var m={location:new Burner.Vector(Burner.System.mouse.location.x,Burner.System.mouse.location.y)};this.applyForce(this._seek(m))}if(this.seekTarget&&this.applyForce(this._seek(this.seekTarget)),this.flowField){var n,o,p=this.flowField.resolution,q=Math.floor(this.location.x/p),r=Math.floor(this.location.y/p);this.flowField.field[q]&&(n=this.flowField.field[q][r],n?(this.followTargetVector.x=n.x,this.followTargetVector.y=n.y):(this.followTargetVector.x=this.location.x,this.followTargetVector.y=this.location.y),o={location:this.followTargetVector},this.applyForce(this.follow(o)))}return this.flocking&&this.flock(Burner.System.getAllItemsByName("Agent")),this.acceleration},i.prototype.follow=function(a){return this.followDesiredVelocity.x=a.location.x,this.followDesiredVelocity.y=a.location.y,this.followDesiredVelocity.mult(this.maxSpeed),this.followDesiredVelocity.sub(this.velocity),this.followDesiredVelocity.limit(this.maxSteeringForce),this.followDesiredVelocity},i.prototype.flock=function(a){return this.applyForce(this.separate(a).mult(this.separateStrength)),this.applyForce(this.align(a).mult(this.alignStrength)),this.applyForce(this.cohesion(a).mult(this.cohesionStrength)),this.acceleration},i.prototype.separate=function(a){var b,c,d,e,f,g,h=0;for(this.separateSumForceVector.x=0,this.separateSumForceVector.y=0,g=this.separateSumForceVector,b=0,c=a.length;c>b;b+=1)d=a[b],this.className===d.className&&this.id!==d.id&&(f=this.location.distance(d.location),f>0&&f<this.desiredSeparation&&(e=Burner.Vector.VectorSub(this.location,d.location),e.normalize(),e.div(f),g.add(e),h+=1));return h>0?(g.div(h),g.normalize(),g.mult(this.maxSpeed),g.sub(this.velocity),g.limit(this.maxSteeringForce),g):new Burner.Vector},i.prototype.align=function(a){var b,c,d,e,f,g=2*this.width,h=0;for(this.alignSumForceVector.x=0,this.alignSumForceVector.y=0,f=this.alignSumForceVector,b=0,c=a.length;c>b;b+=1)d=a[b],e=this.location.distance(d.location),e>0&&g>e&&this.className===d.className&&this.id!==d.id&&(f.add(d.velocity),h+=1);return h>0?(f.div(h),f.normalize(),f.mult(this.maxSpeed),f.sub(this.velocity),f.limit(this.maxSteeringForce),f):new Burner.Vector},i.prototype.cohesion=function(a){var b,c,d,e,f,g=10,h=0;for(this.cohesionSumForceVector.x=0,this.cohesionSumForceVector.y=0,f=this.cohesionSumForceVector,b=0,c=a.length;c>b;b+=1)d=a[b],e=this.location.distance(d.location),e>0&&g>e&&this.className===d.className&&this.id!==d.id&&(f.add(d.location),h+=1);return h>0?(f.div(h),f.sub(this.location),f.normalize(),f.mult(this.maxSpeed),f.sub(this.velocity),f.limit(this.maxSteeringForce),f):new Burner.Vector},i.prototype.getLocation=function(a){return a?"x"===a?this.location.x:"y"===a?this.location.y:void 0:new Burner.Vector(this.location.x,this.location.y)},i.prototype.getVelocity=function(a){return a?"x"===a?this.velocity.x:"y"===a?this.velocity.y:void 0:new Burner.Vector(this.location.x,this.location.y)},y.extend(j,h),j.prototype.init=function(a){var b=a||{};this.width="undefined"==typeof b.width?10:b.width,this.height="undefined"==typeof b.height?10:b.height,this.perlin="undefined"==typeof b.perlin?!0:b.perlin,this.remainsOnScreen=!!b.remainsOnScreen,this.perlinSpeed="undefined"==typeof b.perlinSpeed?.005:b.perlinSpeed,this.perlinTime=b.perlinTime||0,this.perlinAccelLow="undefined"==typeof b.perlinAccelLow?-.075:b.perlinAccelLow,this.perlinAccelHigh="undefined"==typeof b.perlinAccelHigh?.075:b.perlinAccelHigh,this.offsetX="undefined"==typeof b.offsetX?1e4*Math.random():b.offsetX,this.offsetY="undefined"==typeof b.offsetY?1e4*Math.random():b.offsetY,this.random=!!b.random,this.randomRadius="undefined"==typeof b.randomRadius?100:b.randomRadius,this.color=b.color||[255,150,50],this.borderWidth="undefined"==typeof b.borderWidth?2:b.borderWidth,this.borderStyle=b.borderStyle||"solid",this.borderColor=b.borderColor||[255,255,255],this.borderRadius="undefined"==typeof b.borderRadius?100:b.borderRadius,this.avoidWorldEdges=!!b.avoidWorldEdges,this.avoidWorldEdgesStrength="undefined"==typeof b.avoidWorldEdgesStrength?50:b.avoidWorldEdgesStrength},j.prototype.applyForces=function(){this.perlin?(this.perlinTime+=this.perlinSpeed,this.remainsOnScreen?(this.acceleration=new Burner.Vector,this.velocity=new Burner.Vector,this.location.x=y.map(z.noise(this.perlinTime+this.offsetX,0,.1),-1,1,0,this.world.bounds[1]),this.location.y=y.map(z.noise(0,this.perlinTime+this.offsetY,.1),-1,1,0,this.world.bounds[2])):(this.acceleration.x=y.map(z.noise(this.perlinTime+this.offsetX,0,.1),-1,1,this.perlinAccelLow,this.perlinAccelHigh),this.acceleration.y=y.map(z.noise(0,this.perlinTime+this.offsetY,.1),-1,1,this.perlinAccelLow,this.perlinAccelHigh))):this.random&&(this.seekTarget={location:Burner.Vector.VectorAdd(this.location,new Burner.Vector(y.getRandomNumber(-this.randomRadius,this.randomRadius),y.getRandomNumber(-this.randomRadius,this.randomRadius)))},this.applyForce(this._seek(this.seekTarget))),this.avoidWorldEdges&&this._checkAvoidEdges()},y.extend(k,h),k.prototype.init=function(a){var b=a||{};k._superClass.prototype.init.call(this,b),this.type=b.type||"",this.behavior=b.behavior||"LOVE",this.sensitivity="undefined"==typeof b.sensitivity?2:b.sensitivity,this.width="undefined"==typeof b.width?7:b.width,this.height="undefined"==typeof b.height?7:b.height,this.offsetDistance="undefined"==typeof b.offsetDistance?30:b.offsetDistance,this.offsetAngle=b.offsetAngle||0,this.opacity="undefined"==typeof b.opacity?.75:b.opacity,this.target=b.target||null,this.activated=!!b.activated,this.activatedColor=b.activatedColor||[255,255,255],this.borderRadius="undefined"==typeof b.borderRadius?100:b.borderRadius,this.borderWidth="undefined"==typeof b.borderWidth?2:b.borderWidth,this.borderStyle="solid",this.borderColor=[255,255,255]},k.prototype.step=function(){var a,b,c=!1,d=Burner.System._caches.Heat||{list:[]},e=Burner.System._caches.Cold||{list:[]},f=Burner.System._caches.Predators||{list:[]},g=Burner.System._caches.Light||{list:[]},h=Burner.System._caches.Oxygen||{list:[]},i=Burner.System._caches.Food||{list:[]};if("heat"===this.type&&d.list&&d.list.length>0)for(a=0,b=d.list.length;b>a;a++)this.isInside(this,d.list[a],this.sensitivity)&&(this.target=d.list[a],this.activated=!0,c=!0);else if("cold"===this.type&&e.list&&e.list.length>0)for(a=0,b=e.list.length;b>a;a++)this.isInside(this,e.list[a],this.sensitivity)&&(this.target=e.list[a],this.activated=!0,c=!0);else if("predator"===this.type&&f.list&&f.list.length>0)for(a=0,b=f.list.length;b>a;a+=1)this.isInside(this,f.list[a],this.sensitivity)&&(this.target=f.list[a],this.activated=!0,c=!0);else if("light"===this.type&&g.list&&g.list.length>0)for(a=0,b=g.list.length;b>a;a++)g.lookup[g.list[a].id]&&this.isInside(this,g.list[a],this.sensitivity)&&(this.target=g.list[a],this.activated=!0,c=!0);else if("oxygen"===this.type&&h.list&&h.list.length>0)for(a=0,b=h.list.length;b>a;a+=1)h.lookup[h.list[a].id]&&this.isInside(this,h.list[a],this.sensitivity)&&(this.target=h.list[a],this.activated=!0,c=!0);else if("food"===this.type&&i.list&&i.list.length>0)for(a=0,b=i.list.length;b>a;a+=1)i.lookup[i.list[a].id]&&this.isInside(this,i.list[a],this.sensitivity)&&(this.target=i.list[a],this.activated=!0,c=!0);c?this.color=this.activatedColor:(this.target=null,this.activated=!1,this.color="transparent"),this.afterStep&&this.afterStep.apply(this)},k.prototype.getActivationForce=function(a){var b,c,d,e,f;switch(this.behavior){case"AGGRESSIVE":return c=Burner.Vector.VectorSub(this.target.location,this.location),b=c.mag(),c.normalize(),d=b/a.maxSpeed,c.mult(d),c.sub(a.velocity),c.limit(a.maxSteeringForce),c;case"COWARD":return c=Burner.Vector.VectorSub(this.target.location,this.location),b=c.mag(),c.normalize(),d=b/a.maxSpeed,c.mult(-d),c.sub(a.velocity),c.limit(a.maxSteeringForce),c;case"LIKES":var g=Burner.Vector.VectorSub(this.target.location,this.location);return b=g.mag(),g.normalize(),d=b/a.maxSpeed,g.mult(d),f=Burner.Vector.VectorSub(g,a.velocity),f.limit(a.maxSteeringForce),f;case"LOVES":var h=Burner.Vector.VectorSub(this.target.location,this.location);return b=h.mag(),h.normalize(),b>this.width?(d=b/a.maxSpeed,h.mult(d),f=Burner.Vector.VectorSub(h,a.velocity),f.limit(a.maxSteeringForce),f):(a.velocity=new Burner.Vector,a.acceleration=new Burner.Vector,new Burner.Vector);case"EXPLORER":var i=Burner.Vector.VectorSub(this.target.location,this.location);return b=i.mag(),i.normalize(),d=b/a.maxSpeed,i.mult(-d),f=Burner.Vector.VectorSub(i,a.velocity),f.limit(.05*a.maxSteeringForce),f;case"ACCELERATE":return e=a.velocity.clone(),e.normalize(),e.mult(a.minSpeed);case"DECELERATE":return e=a.velocity.clone(),e.normalize(),e.mult(-a.minSpeed);default:return new Burner.Vector}},k.prototype.isInside=function(a,b,c){return a.location.x+a.width/2>b.location.x-b.width/2-c*b.width&&a.location.x-a.width/2<b.location.x+b.width/2+c*b.width&&a.location.y+a.height/2>b.location.y-b.height/2-c*b.height&&a.location.y-a.height/2<b.location.y+b.height/2+c*b.height?!0:!1},y.extend(l,Burner.Item),l.prototype.init=function(a){if(!a||!a.parentA||!a.parentB)throw new Error("Connector: both parentA and parentB are required.");this.parentA=a.parentA,this.parentB=a.parentB,this.opacity="undefined"==typeof a.opacity?1:a.opacity,this.zIndex=a.zIndex||0,this.borderWidth=1,this.borderRadius=0,this.borderStyle="dotted",this.borderColor="undefined"==typeof a.borderColor?[150,150,150]:a.borderColor,this.width=0,this.height=0,this.color="transparent"},l.prototype.step=function(){var a=this.parentA.location,b=this.parentB.location;this.width=Math.floor(Burner.Vector.VectorSub(this.parentA.location,this.parentB.location).mag()),this.location=Burner.Vector.VectorAdd(this.parentA.location,this.parentB.location).div(2),this.angle=y.radiansToDegrees(Math.atan2(b.y-a.y,b.x-a.x))},y.extend(m,h),m.prototype.init=function(a){var b=a||{};this.width="undefined"==typeof b.width?10:b.width,this.height="undefined"==typeof b.height?10:b.height,this.opacity="undefined"==typeof b.opacity?1:b.opacity,this.isStatic=b.isStatic===!1?!1:b.isStatic||!0,this.zIndex="undefined"==typeof b.zIndex?1:b.zIndex,this.color=b.color||[200,200,200],this.borderRadius="undefined"==typeof b.borderRadius?100:b.borderRadius,this.borderWidth="undefined"==typeof b.borderWidth?2:b.borderWidth,this.borderStyle=b.borderStyle||"solid",this.borderColor=b.borderColor||[60,60,60] |
|
},y.extend(n,i),n.prototype.init=function(a){var b=a||{};n._superClass.prototype.init.call(this,b),this.width="undefined"==typeof b.width?20:b.width,this.height="undefined"==typeof b.height?20:b.height,this.lifespan="undefined"==typeof b.lifespan?50:b.lifespan,this.life=b.life||0,this.fade="undefined"==typeof b.fade?!0:!1,this.shrink="undefined"==typeof b.shrink?!0:!1,this.checkWorldEdges=!!b.checkWorldEdges,this.maxSpeed="undefined"==typeof b.maxSpeed?4:0,this.zIndex="undefined"==typeof b.zIndex?1:0,this.color=b.color||[200,200,200],this.borderWidth="undefined"==typeof b.borderWidth?this.width/4:0,this.borderStyle=b.borderStyle||"none",this.borderColor=b.borderColor||"transparent",this.borderRadius="undefined"==typeof b.borderRadius?100:0,this.boxShadowSpread="undefined"==typeof b.boxShadowSpread?this.width/4:0,this.boxShadowColor=b.boxShadowColor||"transparent",b.acceleration||(this.acceleration=new Burner.Vector(1,1),this.acceleration.normalize(),this.acceleration.mult(this.maxSpeed?this.maxSpeed:3),this.acceleration.rotate(y.getRandomNumber(0,2*Math.PI,!0))),b.velocity||(this.velocity=new Burner.Vector),this.initWidth=this.width,this.initHeight=this.height},n.prototype.step=function(){var a;this.world.c&&(a=y.clone(this.velocity),a.mult(-1),a.normalize(),a.mult(this.world.c),this.applyForce(a)),this.applyForce(this.world.gravity),this.applyForces&&this.applyForces(),this.checkEdges&&this._checkWorldEdges(),this.velocity.add(this.acceleration),this.maxSpeed&&this.velocity.limit(this.maxSpeed),this.minSpeed&&this.velocity.limit(null,this.minSpeed),this.location.add(this.velocity),this.fade&&(this.opacity=y.map(this.life,0,this.lifespan,1,0)),this.shrink&&(this.width=y.map(this.life,0,this.lifespan,this.initWidth,0),this.height=y.map(this.life,0,this.lifespan,this.initHeight,0)),this.acceleration.mult(0),this.life<this.lifespan?this.life+=1:-1!==this.lifespan&&Burner.System.destroyItem(this)},y.extend(o,i),o.prototype.init=function(a){var b=a||{};o._superClass.prototype.init.call(this,b),this.isStatic="undefined"==typeof b.isStatic?!0:b.isStatic,this.lifespan="undefined"==typeof b.lifespan?-1:b.lifespan,this.life=b.life||0,this.width=b.width||0,this.height=b.height||0,this.burst="undefined"==typeof b.burst?1:b.burst,this.burstRate="undefined"==typeof b.burstRate?4:b.burstRate,this.emitRadius="undefined"==typeof b.emitRadius?3:b.emitRadius,this.startColor=b.startColor||[100,20,20],this.endColor=b.endColor||[255,0,0],this.particleOptions=b.particleOptions||{width:15,height:15,lifespan:50,borderRadius:100,checkEdges:!1,acceleration:null,velocity:null,location:null,maxSpeed:3,fade:!0},this.borderWidth=b.borderWidth||0,this.borderStyle=b.borderStyle||"none",this.borderColor=b.borderColor||"transparent",this.borderRadius=b.borderRadius||0,this.clock=0,this.particleOptions.acceleration&&(this.initParticleAcceleration=new Burner.Vector(this.particleOptions.acceleration.x,this.particleOptions.acceleration.y));var c=new d;c.addColor({min:12,max:24,startColor:this.startColor,endColor:this.endColor}),this.beforeStep=function(){var a,b,d=this.initParticleAcceleration;if(this.life<this.lifespan)this.life+=1;else if(-1!==this.lifespan)return Burner.System.destroyItem(this),void 0;if(0===this.clock%this.burstRate){a=this.getLocation(),b=new Burner.Vector(1,1),b.normalize(),b.mult(this.emitRadius),b.rotate(y.getRandomNumber(0,2*Math.PI,!0)),a.add(b);for(var e=0;e<this.burst;e++)this.particleOptions.world=this.world,this.particleOptions.life=0,this.particleOptions.color=c.getColor(),this.particleOptions.borderStyle="solid",this.particleOptions.borderColor=c.getColor(),this.particleOptions.boxShadowColor=c.getColor(),d&&(this.particleOptions.acceleration=new Burner.Vector(d.x,d.y)),this.particleOptions.location=o.getParticleLocation(a),Burner.System.add("Particle",this.particleOptions)}this.clock++}},o.getParticleLocation=function(a){return function(){return new Burner.Vector(a.x,a.y)}()},y.extend(p,Burner.Item),p.prototype.init=function(a){var b=a||{};this.initialLocation=b.initialLocation||new Burner.Vector(this.world.bounds[1]/2,this.world.bounds[2]/2),this.lastLocation=new Burner.Vector,this.amplitude=b.amplitude||new Burner.Vector(this.world.bounds[1]/2-this.width,this.world.bounds[2]/2-this.height),this.acceleration=b.acceleration||new Burner.Vector(.01,0),this.aVelocity=b.aVelocity||new Burner.Vector,this.isStatic=!!b.isStatic,this.isPerlin=!!b.isPerlin,this.perlinSpeed="undefined"==typeof b.perlinSpeed?.005:b.perlinSpeed,this.perlinTime=b.perlinTime||0,this.perlinAccelLow="undefined"==typeof b.perlinAccelLow?-2:b.perlinAccelLow,this.perlinAccelHigh="undefined"==typeof b.perlinAccelHigh?2:b.perlinAccelHigh,this.perlinOffsetX="undefined"==typeof b.perlinOffsetX?1e4*Math.random():b.perlinOffsetX,this.perlinOffsetY="undefined"==typeof b.perlinOffsetY?1e4*Math.random():b.perlinOffsetY,this.width="undefined"==typeof b.width?20:b.width,this.height="undefined"==typeof b.height?20:b.height,this.color=b.color||[200,100,0],this.borderWidth=b.borderWidth||0,this.borderStyle=b.borderStyle||"solid",this.borderColor=b.borderColor||[255,150,50],this.borderRadius="undefined"==typeof b.borderRadius?100:b.borderRadius,this.boxShadowSpread=b.boxShadowSpread||0,this.boxShadowColor=b.boxShadowColor||[200,100,0]},p.prototype.step=function(){var a,b=this.world;this.beforeStep&&this.beforeStep.apply(this),this.isStatic||this.isPressed||(this.isPerlin?(this.perlinTime+=this.perlinSpeed,this.aVelocity.x=y.map(z.noise(this.perlinTime+this.perlinOffsetX,0,.1),-1,1,this.perlinAccelLow,this.perlinAccelHigh),this.aVelocity.y=y.map(z.noise(0,this.perlinTime+this.perlinOffsetY,.1),-1,1,this.perlinAccelLow,this.perlinAccelHigh)):this.aVelocity.add(this.acceleration),this.location.x=this.initialLocation.x+Math.sin(this.aVelocity.x)*this.amplitude.x,this.location.y=this.initialLocation.y+Math.sin(this.aVelocity.y)*this.amplitude.y,this.pointToDirection&&(a=Burner.Vector.VectorSub(this.location,this.lastLocation),this.angle=y.radiansToDegrees(Math.atan2(a.y,a.x))),this.controlCamera&&this._checkCameraEdges(),(this.checkWorldEdges||this.wrapWorldEdges)&&this._checkWorldEdges(b),this.lifespan>0&&(this.lifespan-=1),this.afterStep&&this.afterStep.apply(this),this.pointToDirection&&(this.lastLocation.x=this.location.x,this.lastLocation.y=this.location.y))},y.extend(q,i),q.prototype.init=function(a){var b=a||{};q._superClass.prototype.init.call(this,b),this.c="undefined"==typeof b.c?1:b.c,this.mass="undefined"==typeof b.mass?50:b.mass,this.isStatic="undefined"==typeof b.isStatic?!0:b.isStatic,this.width="undefined"==typeof b.width?100:b.width,this.height="undefined"==typeof b.height?100:b.height,this.opacity="undefined"==typeof b.opacity?.75:b.opacity,this.zIndex="undefined"==typeof b.zIndex?1:b.zIndex,this.color=b.color||[105,210,231],this.borderWidth="undefined"==typeof b.borderWidth?this.width/4:b.borderWidth,this.borderStyle=b.borderStyle||"double",this.borderColor=b.borderColor||[167,219,216],this.borderRadius="undefined"==typeof b.borderRadius?100:b.borderRadius,this.boxShadowSpread="undefined"==typeof b.boxShadowSpread?this.width/8:b.boxShadowSpread,this.boxShadowColor=b.boxShadowColor||[147,199,196],Burner.System.updateCache(this)},y.extend(r,i),r.prototype.init=function(a){var b=a||{};r._superClass.prototype.init.call(this,b),this.G="undefined"==typeof b.G?10:b.G,this.mass="undefined"==typeof b.mass?1e3:b.mass,this.isStatic="undefined"==typeof b.isStatic?!0:b.isStatic,this.width="undefined"==typeof b.width?100:b.width,this.height="undefined"==typeof b.height?100:b.height,this.opacity="undefined"==typeof b.opacity?.75:b.opacity,this.zIndex="undefined "==typeof b.zIndex?1:b.zIndex,this.color=b.color||[92,187,0],this.borderWidth="undefined"==typeof b.borderWidth?this.width/4:b.borderWidth,this.borderStyle=b.borderStyle||"double",this.borderColor=b.borderColor||[224,228,204],this.borderRadius="undefined"==typeof b.borderRadius?100:b.borderRadius,this.boxShadowSpread="undefined"==typeof b.boxShadowSpread?this.width/4:b.boxShadowSpread,this.boxShadowColor=b.boxShadowColor||[64,129,0],Burner.System.updateCache(this)},y.extend(s,i),s.prototype.init=function(a){var b=a||{};s._superClass.prototype.init.call(this,b),this.G="undefined"==typeof b.G?-10:b.G,this.mass="undefined"==typeof b.mass?1e3:b.mass,this.isStatic="undefined"==typeof b.isStatic?!0:b.isStatic,this.width="undefined"==typeof b.width?100:b.width,this.height="undefined"==typeof b.height?100:b.height,this.opacity="undefined"==typeof b.opacity?.75:b.opacity,this.zIndex="undefined"==typeof b.zIndex?10:b.zIndex,this.color=b.color||[250,105,0],this.borderWidth="undefined"==typeof b.borderWidth?this.width/4:b.borderWidth,this.borderStyle=b.borderStyle||"double",this.borderColor=b.borderColor||[224,228,204],this.borderRadius="undefined"==typeof b.borderRadius?100:b.borderRadius,this.boxShadowSpread="undefined"==typeof b.boxShadowSpread?this.width/4:b.boxShadowSpread,this.boxShadowColor=b.boxShadowColor||[250,105,0],Burner.System.updateCache(this)};var A,B,C,D,E,F,G={},H={},I={},J=["double","double","dotted","dashed"];for(A=0,B=w.defaultColorList.length;B>A;A++)D=w.defaultColorList[A],C=new d,C.addColor({min:20,max:200,startColor:D.startColor,endColor:D.endColor}),G[D.name]=C,H[D.name]=D.borderColor,I[D.name]=D.boxShadowColor;for(F=new c,A=0,B=J.length;B>A;A++)E=J[A],F.addBorder({min:2,max:10,style:E});y.extend(t,i),t.prototype.init=function(a){var b=a||{},c=this.name.toLowerCase();t._superClass.prototype.init.call(this,b),this.mass="undefined"==typeof b.mass?50:b.mass,this.isStatic="undefined"==typeof b.isStatic?!0:b.isStatic,this.width="undefined"==typeof b.width?50:b.width,this.height="undefined"==typeof b.height?50:b.height,this.opacity="undefined"==typeof b.opacity?.75:b.opacity,this.zIndex="undefined"==typeof b.zIndex?1:b.zIndex,this.color=b.color||G[c].getColor(),this.borderWidth="undefined"==typeof b.borderWidth?this.width/y.getRandomNumber(2,8):b.borderWidth,this.borderStyle="undefined"==typeof b.borderStyle?F.getBorder():b.borderStyle,this.borderColor="undefined"==typeof b.borderColor?G[c].getColor():b.borderColor,this.borderRadius="undefined"==typeof b.borderRadius?100:b.borderRadius,this.boxShadowSpread="undefined"==typeof b.boxShadowSpread?this.width/y.getRandomNumber(2,8):b.boxShadowSpread,this.boxShadowColor="undefined"==typeof b.boxShadowColor?I[c]:b.boxShadowColor,Burner.System.updateCache(this)},y.extend(u,Burner.Item),u.prototype.init=function(a){var b=a||{};this.resolution="undefined"==typeof b.resolution?50:b.resolution,this.perlinSpeed="undefined"==typeof b.perlinSpeed?.01:b.perlinSpeed,this.perlinTime="undefined"==typeof b.perlinTime?100:b.perlinTime,this.field=b.field||null,this.createMarkers=!!b.createMarkers,this.world=b.world||Burner.System.firstWorld()},u.prototype.build=function(){var a,b,c,d,e,f,g,h,i,j,k,l,m={},n=this.world,o=Math.ceil(n.bounds[1]/parseFloat(this.resolution)),p=Math.ceil(n.bounds[2]/parseFloat(this.resolution)),q=this.perlinTime;for(a=0,b=o;b>a;a+=1){for(l=this.perlinTime,m[a]={},c=0,d=p;d>c;c+=1){if(e=a*this.resolution+this.resolution/2,f=c*this.resolution+this.resolution/2,g=y.map(z.noise(q,l,.1),0,1,0,2*Math.PI),h=Math.cos(g),i=Math.sin(g),j=new Burner.Vector(h,i),m[a][c]=j,k=y.radiansToDegrees(Math.atan2(i,h)),this.createMarkers){var r=new v({location:new Burner.Vector(e,f),scale:1,opacity:y.map(k,-360,360,.1,.75),width:this.resolution,height:this.resolution/2,field:j,angle:k,colorMode:"rgb",color:[200,100,50],borderRadius:0,zIndex:0});n.el.appendChild(r)}l+=parseFloat(this.perlinSpeed)}q+=parseFloat(this.perlinSpeed)}this.field=m},v.prototype.name="FlowFieldMarker",a.Config=w,a.Interface=x,a.Utils=y,a.SimplexNoise=z,a.BorderPalette=c,a.ColorPalette=d,a.ColorTable=e,a.Caption=f,a.InputMenu=g,a.Mover=h,a.Agent=i,a.Walker=j,a.Sensor=k,a.Connector=l,a.Point=m,a.Particle=n,a.ParticleSystem=o,a.Oscillator=p,a.Liquid=q,a.Attractor=r,a.Repeller=s,a.i=A,a.max=B,a.pal=C,a.color=D,a.palettes=G,a.border=E,a.borderPalette=F,a.borderColors=H,a.boxShadowColors=I,a.borderStyles=J,a.Stimulus=t,a.FlowField=u,a.FlowFieldMarker=v}({},function(){return this}()); |