<script>(function(scope){varGui=function(params){if(!ready){Gui.error("Gui not ready. Put your code inside Gui.ready()")}params=params||{};this.vars={};this.localStorage=params.localStorage||false;this.panel=document.createElement("dat-gui");this.panel.autoPlace=params.autoPlace!==false;if(this.panel.autoPlace){document.body.appendChild(this.panel)}};Gui.prototype.add=function(object,path){varvalue=Path.get(path).getValueFrom(object);if(value===null||value===undefined){returnGui.error(object+" doesn't have a value for path \""+path+'".')}varargs=Array.prototype.slice.call(arguments,2);varcontroller;if(args[0]instanceofArray||typeofargs[0]=="object"){controller=document.createElement("dat-gui-option")}else{controller=Gui.getController(value)}if(!controller){returnGui.error("Unrecognized type:",value)}controller.watch(object,path);controller.init.apply(controller,args);varrow=document.createElement("gui-row");row.name=path;controller.row=row;controller.name=function(name){row.name=name};controller.comment=function(comment){row.comment=comment};row.appendChild(controller);this.panel.appendChild(row);returncontroller};Gui.prototype.remember=function(object){};Gui.prototype.var=function(){varname,initialValue,args;if(arguments.length==1){name=arguments[0];returnthis.vars[name]}initialValue=arguments[1];name=arguments[0];args=[this.vars,name];args=args.concat(Array.prototype.slice.call(arguments,2));this.vars[name]=initialValue;returnthis.add.apply(this,args)};Gui.prototype.listenAll=function(){Gui.warn("controller.listenAll() is deprecated. All controllers are listened for free.")};varcontrollers={};Gui.register=function(elementName,test){controllers[elementName]=test};Gui.getController=function(value){for(vartypeincontrollers){vartest=controllers[type];if(test(value)){returndocument.createElement(type)}}};varready=false;varreadyHandlers=[];document.addEventListener("polymer-ready",function(){ready=true;readyHandlers.forEach(function(fnc){fnc()})});Gui.ready=function(fnc){if(ready){fnc()}else{readyHandlers.push(fnc)}};Gui.error=function(){varargs=Array.prototype.slice.apply(arguments);args.unshift("dat-gui ::");console.error.apply(console,args)};Gui.warn=function(){varargs=Array.prototype.slice.apply(arguments);args.unshift("dat-gui ::");console.warn.apply(console,args)};vardat={};dat.gui={};dat.gui.GUI=Gui;dat.GUI=dat.gui.GUI;dat.color={};dat.color.Color=function(){};dat.dom={};dat.dom.dom=function(){};dat.controllers={};dat.controllers.Controller=constructor("dat-gui-base");dat.controllers.NumberController=constructor("dat-gui-number");dat.controllers.FunctionController=constructor("dat-gui-function");dat.controllers.ColorController=constructor("dat-gui-color");dat.controllers.BooleanController=constructor("dat-gui-boolean");dat.controllers.OptionController=constructor("dat-gui-option");dat.controllers.NumberControllerBox=dat.controllers.NumberController;dat.controllers.NumberControllerSlider=dat.controllers.NumberController;functionconstructor(elementName){returnfunction(object,path){varel=document.createElement(elementName);el.watch(object,path);returnel}}scope.dat=dat;scope.Gui=Gui})(this);</script>
<divhidden><script>Polymer("dat-gui-base",{ready:function(){this.update()},update:function(){},init:function(){},watch:function(object,path){this.object=object;this.path=path;this.bind("value",newPathObserver(this.object,this.path))},valueChanged:function(){this.fire("change",this.value);this.update()},on:function(event,listener){this.addEventListener(event,listener);returnthis},map:function(x,a,b,c,d){return(x-a)/(b-a)*(d-c)+c},listen:function(){Gui.warn("controller.listen() is deprecated. All controllers are listened for free.");returnthis},getValue:function(){returnthis.value},setValue:function(v){this.value=v;returnthis},onChange:function(v){this.addEventListener("change",function(e){v(e.detail)});returnthis}});</script><polymer-elementname="dat-gui-base"attributes="object path value"assetpath="../elements/dat-gui-base/"></polymer-element><script>Gui.register("dat-gui-number",function(value){returntypeofvalue=="number"});Polymer("dat-gui-number",{value:0,decimals:3,computed:{slider:"min !== undefined && max !== undefined"},ready:function(){var_this=this;window.addEventListener("keydown",function(e){if(e.keyCode==18){_this._alt=true}},false);window.addEventListener("keyup",function(e){if(e.keyCode==18){_this._alt=false}},false)},init:function(min,max,step){this.min=min;this.max=max;this.step=step},valueChanged:function(newValue){if(this.step!==undefined){this.value=Math.round(this.value/this.step)*this.step}if(this.min!==undefined){this.value=Math.max(this.value,this.min)}if(this.max!==undefined){this.value=Math.min(this.value,this.max)}this.super()},minChanged:function(){this.value=Math.max(this.value,this.min);this.update()},maxChanged:function(){this.value=Math.min(this.value,this.max);this.update()},update:function(){varratio=this.map(this.value,this.min,this.max,0,1);if(this.min<0&&this.max>0){this.$.container.classList.add("straddle-zero");varzero=this.map(0,this.min,this.max,0,1);if(this.value>=0){this.$.fill.style.left=zero*100+"%";this.$.fill.style.width=(ratio-zero)*100+"%";this.$.fill.style.right=""}else{this.$.fill.style.left="";this.$.fill.style.width=(zero-ratio)*100+"%";this.$.fill.style.right=(1-zero)*100+"%"}}else{this.$.container.classList.remove("straddle-zero");if(this.max>0){this.$.fill.style.left=0;this.$.fill.style.width=ratio*100+"%";this.$.fill.style.right=""}else{this.$.fill.style.left="";this.$.fill.style.width=(1-ratio)*100+"%";this.$.fill.style.right=0}}this.$.knob.style.left=ratio*100+"%";this.$.container.classList.toggle("positive",this.value>=0);this.$.container.classList.toggle("negative",this.value<0);this.super()},click:function(e){this.$.input.select()},keydown:function(e){if(e.keyCode==13){this.$.input.blur()}},down:function(e){e.preventDefault();this._rect=this.$.track.getBoundingClientRect();if(!this._alt){this.value=this.valueFromX(e.x)}this.fire("sliderDown")},up:function(e){this.fire("sliderUp")},trackstart:function(e){this._dragFriction=1},trackx:function(e){if(this.step===undefined){vardv=this.valueFromDX(e.ddx);if(this._alt){dv/=10}this.value+=dv*this._dragFriction}else{this.value=this.valueFromX(e.pageX)}},tracky:function(e){this._dragFriction=Math.max(.01,Math.min(1,this.map(e.dy,50,300,1,.1)))},blur:function(e){varv=parseFloat(this.$.input.value);if(v===v){this.value=v}},truncate:function(v){if(v%1!==0&&this.decimals!==undefined){returnthis.limitDecimals(v,this.decimals)}else{returnv}},limitDecimals:function(v,maxDecimals){varstr=v.toString();varnumDecimals=str.substring(str.indexOf(".")+1).length;str=v.toFixed(Math.min(numDecimals,this.decimals));for(varz,i=0,l=str.length;i<l;i++){if(str.charAt(i)!=="0"){z=i}}returnstr.substring(0,z+1)},valueFromX:function(x){returnthis.map(x,this._rect.left,this._rect.right,this.min,this.max)},valueFromDX:function(dx){returnthis.map(dx,0,this._rect.width,0,this.max-this.min)}});</script><polymer-elementname="dat-gui-number"attributes="min max value step"extends="dat-gui-base"assetpath="../elements/dat-gui-number/"><template><style>input{font:10px'LucidaGrande',sans-serif;color:#ecebe0;-webkit-font-smooth
<divhidden><script>Gui.register("dat-gui-string",function(value){returntypeofvalue=="string"});Polymer("dat-gui-string",{click:function(e){this.$.input.select()},keydown:function(e){if(e.keyCode==13){this.$.input.blur()}}});</script><polymer-elementname="dat-gui-string"extends="dat-gui-base"assetpath="../elements/dat-gui-string/"><template><style>input{font:10px'Lucida Grande',sans-serif;color:#ecebe0;-webkit-font-smoothing:antialiased;height:100%;width:100%;display:inline-block;background-color:transparent;border:0;-webkit-border-radius:0;border-radius:0;padding:0;outline:0;-webkit-transition:background-color.15slinear;-moz-transition:background-color.15slinear;-o-transition:background-color.15slinear;-ms-transition:background-color.15slinear;transition:background-color.15slinear;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:host-context(.touch-true)input{font-size:13.5px}input:focus{background:rgba(255,255,255,.05)}:host-context(.touch-false)input:hover{background:rgba(255,255,255,.05)}</style><style>input{color:#1ebd6e;padding-left:8px}</style><inputid="input"type="text"value="{{ value }}"on-click="{{ click }}"on-keydown="{{ keydown }}"></template></polymer-element></div>
<divhidden><script>Gui.register("dat-gui-boolean",function(value){returntypeofvalue=="boolean"});Polymer("dat-gui-boolean",{ready:function(){},toggle:function(){this.value=!this.value}});</script><polymer-elementname="dat-gui-boolean"extends="dat-gui-base"assetpath="../elements/dat-gui-boolean/"><template><style>input{font:10px'Lucida Grande',sans-serif;color:#ecebe0;-webkit-font-smoothing:antialiased;height:100%;width:100%;display:inline-block;background-color:transparent;border:0;-webkit-border-radius:0;border-radius:0;padding:0;outline:0;-webkit-transition:background-color.15slinear;-moz-transition:background-color.15slinear;-o-transition:background-color.15slinear;-ms-transition:background-color.15slinear;transition:background-color.15slinear;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}:host-context(.touch-true)input{font-size:13.5px}input:focus{background:rgba(255,255,255,.05)}:host-context(.touch-false)input:hover{background:rgba(255,255,255,.05)}</style><style>#container{height:100%;cursor:pointer;padding-left:8px}#switch-track{width:2em;height:.8em;background:rgba(255,255,255,.25);border-radius:999px;-webkit-transition:background.1slinear;-moz-transition:background.1slinear;-o-transition:background.1slinear;-ms-transition:background.1slinear;transition:background.1slinear}#switch-knob{height:.8em;width:.8em;border-radius:100%;background:#ecebe0;-webkit-transition:-webkit-transform.15scubic-bezier(0.25,.25,0,1);-moz-transition:-moz-transform.15scubic-bezier(0.25,.25,0,1);-o-transition:-o-transform.15scubic-bezier(0.25,.25,0,1);-ms-transition:-ms-transform.15scubic-bezier(0.25,.25,0,1);transition:transform.15scubic-bezier(0.25,.25,0,1)}.value-true#switch-track{background:#864694}.value-true#switch-knob{-webkit-transform:translate3d(1.2em,0,0);-moz-transform:translate3d(1.2em,0,0);-o-transform:translate3d(1.2em,0,0);-ms-transform:translate3d(1.2em,0,0);transform:translate3d(1.2em,0,0)}:host-context(.touch-false).value-false:hover#switch-knob{-webkit-transform:scale(1.5);-moz-transform:scale(1.5);-o-transform:scale(1.5);-ms-transform:scale(1.5);transform:scale(1.5)}:host-context(.touch-false).value-true:hover#switch-knob{-webkit-transform:translate3d(1.2em,0,0)scale(1.5);-moz-transform:translate3d(1.2em,0,0)scale(1.5);-o-transform:translate3d(1.2em,0,0)scale(1.5);-ms-transform:translate3d(1.2em,0,0)scale(1.5);transform:translate3d(1.2em,0,0)scale(1.5)}#text{margin-left:8px}.value-false#text{color:rgba(255,255,255,.25)}</style><divid="container"horizontal=""layout=""center=""on-tap="{{ toggle }}"class="value-{{ value }}"><divid="switch-track"><divid="switch-knob"></div></div></div></template></polymer-element></div>
<divhidden><script>Polymer("dat-gui-option",{key:null,ready:function(){this.options={}},init:function(options){if(Array.isArray(options)){options.forEach(function(opt){this.options[opt]=opt},this)}else{this.options=options}},valueChanged:function(){for(variinthis.options){if(this.options[i]===this.value){this.key=i;break}}this.super()},keyChanged:function(){this.value=this.options[this.key]},keys:function(object){if(object){returnObject.keys(object)}}});</script><polymer-elementname="dat-gui-option"extends="dat-gui-base"attributes="options key"assetpath="../elements/dat-gui-option/"><template><style>#container{height:100%;cursor:pointer;padding-left:8px}select{outline:0}</style><divid="container"horizontal=""layout=""center=""><selectvalue="{{ key }}"on-change="{{ change }}"><templaterepeat="{{ name in options | keys }}"><optionvalue="{{ name }}">{{ name }}</option></template></select></div></template></polymer-element></div>