(function(){"use strict"})();var tm=tm||{};tm.global=window||global||this,function(){tm.VERSION="0.1.4",tm.LIB_ROOT=function(){if(!window.document)return;var a=document.getElementsByTagName("script");for(var b=0,c=a.length;b0||a.indexOf("iPad")>0||a.indexOf("Android")>0}(),tm.createClass=function(a){a.init=a.init||function(){},a.superClass=a.superClass||null;var b=function(){var a=new b.prototype.creator;return b.prototype.init.apply(a,arguments),a};a.superClass&&(b.prototype=Object.create(a.superClass.prototype),b.prototype.superInit=function(){var b=this.__proto__;this.__proto__=a.superClass.prototype,a.superClass.prototype.init.apply(this,arguments),this.__proto__=b}),b.prototype.selfClass=b;for(var c in a)b.prototype[c]=a[c];return b.prototype.creator=function(){return this},b.prototype.creator.prototype=b.prototype,b},tm.using=function(){for(var a in tm)window[a]=tm[a]},tm.setLoop=function(a,b){var c=function(){var c=(new Date).getTime();a();var d=(new Date).getTime()-c,e=b-d;e=e>0?e:0,setTimeout(arguments.callee,e)};setTimeout(c,b)},tm.keyCode={backspace:8,tab:9,enter:13,"return":13,shift:16,ctrl:17,alt:18,pause:19,capslock:20,escape:27,pageup:33,pagedown:34,end:35,home:36,left:37,up:38,right:39,down:40,insert:45,"delete":46,0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:65,A:65,b:66,B:66,c:67,C:67,d:68,D:68,e:69,E:69,f:70,F:70,g:71,G:71,h:72,H:72,i:73,I:73,j:74,J:74,k:75,K:75,l:76,L:76,m:77,M:77,n:78,N:78,o:79,O:79,p:80,P:80,q:81,Q:81,r:82,R:82,s:83,S:83,t:84,T:84,u:85,U:85,v:86,V:86,w:87,W:87,x:88,X:88,y:89,Y:89,z:90,Z:90,numpad0:96,numpad1:97,numpad2:98,numpad3:99,numpad4:100,numpad5:101,numpad6:102,numpad7:103,numpad8:104,numpad9:105,multiply:106,add:107,subtract:109,decimalpoint:110,divide:111,f1:112,f2:113,f3:114,f4:115,f5:116,f6:117,f7:118,f8:119,f9:120,f10:121,f11:122,f12:123,numlock:144,scrolllock:145,semicolon:186,equalsign:187,comma:188,dash:189,period:190,"forward slash":191,"/":191,"grave accent":192,"open bracket":219,"back slash":220,"close braket":221,"single quote":222,space:32},tm.inform=function(parent){parent=parent||document.body;var eInfo=document.createElement("div");eInfo.setAttribute("class","tm-info"),eInfo.addEventListener("mouseover",function(){this.style.opacity=.9},!1),eInfo.addEventListener("mouseout",function(){this.style.opacity=.25},!1);with(eInfo.style)position="absolute",width="100%",bottom="0px",left="0px",right="0px",margin="0px",padding="10px 0px",zIndex="0",textAlign="center",fontFamily='"Meiryo", "メイリオ", "ヒラギノ角ゴ Pro W3", sans-serif',fontSize="13px",opacity="0.25",backgroundColor="rgb(230,230,255)",background="-webkit-linear-gradient(top, hsla(0, 100%, 100%, 0.8) 0%, hsla(0, 100%, 100%, 0.3) 50%, hsla(0, 100%, 100%, 0.1) 51%, hsla(0, 100%, 100%, 0.2) 100%), rgb(190,190,210)",background="-moz-linear-gradient(top, hsla(0, 100%, 100%, 0.8) 0%, hsla(0, 100%, 100%, 0.3) 50%, hsla(0, 100%, 100%, 0.1) 51%, hsla(0, 100%, 100%, 0.2) 100%), rgb(190,190,210)",WebkitTransition="1s",MozTransition="1s";eInfo.innerHTML="このプログラムで利用している JavaScript ライブラリ 『tmlib.js』 についてはこちら.".format({projectLink:"https://github.com/phi1618/tmlib.js"}),parent.appendChild(eInfo)}}(),function(){if(!window)return;window.requestAnimationFrame||(window.requestAnimationFrame=window[tm.VENDER_PREFIX+"RequestAnimationFrame"]||function(a){window.setTimeout(a,1e3/60)}),window.cancelRequestAnimationFrame||(window.cancelRequestAnimationFrame=window[tm.VENDER_PREFIX+"CancelRequestAnimationFrame"]||window.clearTimeout)}(),function(){if(!window.document)return;_loadCheckList=[],tm.addLoadCheckList=function(a){console.assert(a.isLoaded!==undefined,"isLoaded が定義されていません!!"),_loadCheckList.push(a)},_preloadListners=[],_mainListners=[],tm.preload=function(a){_preloadListners.push(a)},tm.main=function(a){_mainListners.push(a)};var a=function(){for(var a=0,b=_preloadListners.length;ab;d+=c,++e)this[e]=d}return this}),Array.defineInstanceMethod("shuffle",function(){for(var a=0,b=this.length;ac?c:a},Math.DEG_TO_RAD=Math.PI/180,Math.RAD_TO_DEG=180/Math.PI,Math.degToRad=function(a){return a*Math.DEG_TO_RAD},Math.radToDeg=function(a){return a*Math.RAD_TO_DEG},Math.rand=function(a,b){return window.Math.floor(Math.random()*(b-a+1))+a},Math.randf=function(a,b){return window.Math.random()*(b-a)+a},Math.magnitude=function(){return Math.sqrt(Math.magnitudeSq.apply(null,arguments))},Math.magnitudeSq=function(){var a=0;for(var b=0,c=arguments.length;b>>0}),Number.defineInstanceMethod("toHex",function(){return this.toString(16)}),Number.defineInstanceMethod("toBin",function(){return this.toString(2)}),Number.defineInstanceMethod("padding",function(a,b){var c=this+"";a-=c.length,b=b||"0";while(a-->0)c=b+c;return c})}(),function(){String.prototype.format=function(a){var b=undefined;if(typeof a=="object")b=function(b,c){return a[c]};else{var c=arguments;b=function(a,b){return c[parseInt(b)]}}return this.replace(/\{(\w+)\}/g,b)},String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")},String.prototype.capitalize=function(){return this.replace(/\w+/g,function(a){return a.capitalizeFirstLetter()})},String.prototype.capitalizeFirstLetter=function(){return this.charAt(0).toUpperCase()+this.substr(1).toLowerCase()},String.prototype.toDash=function(){return this.replace(/([A-Z])/g,function(a){return"-"+a.toLowerCase()})},String.prototype.toHash=function(){return TM.crc32(this)},String.prototype.padding=function(a,b){var c=this.toString();a-=c.length,b=b||" ";while(a-->0)c=b+c;return c},String.prototype.paddingLeft=String.prototype.padding,String.prototype.paddingRight=function(a,b){var c=this.toString();a-=c.length,b=b||" ";while(a-->0)c+=b;return c},String.prototype.repeat=function(a){var b=Array(a);for(var c=0;c>>8^c;return(b^-1)>>>0}}(),function(){tm.Item=tm.createClass({prev:null,next:null,data:null,init:function(){}}),tm.List=tm.createClass({init:function(){this._length=0,this._head=tm.Item(),this._tail=tm.Item(),this._head.next=this._tail,this._tail.prev=this._head},add:function(a){var b=tm.Item();return b.data=a,b.prev=this._tail.prev,b.next=this._tail,this._tail.prev.next=b,this._tail.prev=b,++this._length,this},remove:function(a){var b=this.getItem(a);return b.prev.next=b.next,b.next.prev=b.prev,--this._length,b},get:function(a){return this.getItem(a).data},getItem:function(a){var b=this._head.next,c=0;while(c++0)for(var a=0,b=this.tasks.length;a0){var j=h.substring(0,i),k=h.substring(i+1);d[j]=k}}return d},stringify:function(a,b,c){b=b||"&",c=c||"=";var d=[];for(var e in a){var f=encodeURIComponent(a[e]);d.push(e+c+f)}return d.join(b)}}}(),tm.geom=tm.geom||{},function(){tm.geom.Vector2=tm.createClass({x:0,y:0,init:function(a,b){this.set(a,b)},clone:function(){return tm.geom.Vector2(this.x,this.y)},equals:function(a){return this.x===a.x&&this.y===a.y?!0:!1},equalsNumber:function(a,b){return this.x===a&&this.y===b?!0:!1},equalsArray:function(a){return this.x===a[0]&&this.y===a[1]?!0:!1},set:function(a,b){this.x=a,this.y=b},setNumber:function(a,b){return this.x=a,this.y=b,this},setArray:function(a){return this.x=a[0],this.y=a[1],this},setObject:function(a){return this.x=a.x,this.y=a.y,this},setString:function(a){var b=a.match(/(-?\d+(\.{1}\d+)?),\s*(-?\d+(\.{1}\d+)?)/);return this.x=parseFloat(b[1]),this.y=parseFloat(b[3]),this},setSmart:function(a,b){var c=arguments[0];if(arguments.length===2)this.x=a,this.y=b;else if(c instanceof Array)this.x=c[0],this.y=c[1];else if(c instanceof Object)this.x=c.x,this.y=c.y;else if(typeof c=="string"){var d=c.match(/(-?\d+(\.{1}\d+)?),\s*(-?\d+(\.{1}\d+)?)/);this.x=parseFloat(d[1]),this.y=parseFloat(d[3])}return this},setAngle:function(a,b){var c=a*Math.DEG_TO_RAD;return b=b||1,this.x=Math.cos(c)*b,this.y=Math.sin(c)*b,this},setRadian:function(a,b){return b=b||1,this.x=Math.cos(a)*b,this.y=Math.sin(a)*b,this},setDegree:function(a,b){var c=a*Math.DEG_TO_RAD;return b=b||1,this.x=Math.cos(c)*b,this.y=Math.sin(c)*b,this},setRandom:function(a,b,c){return a=a||0,b=b||360,c=c||1,this.setDegree(Math.randf(a,b),c),this},add:function(a){return this.x+=a.x,this.y+=a.y,this},sub:function(a){return this.x-=a.x,this.y-=a.y,this},mul:function(a){return this.x*=a,this.y*=a,this},div:function(a){return a=a||.01,this.x/=a,this.y/=a,this},negate:function(){return this.x=-this.x,this.y=-this.y,this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},lengthSquared:function(){return this.x*this.x+this.y*this.y},distance:function(a){return Math.sqrt(Math.pow(this.x-a.x,2)+Math.pow(this.y-a.y,2))},distanceSquared:function(a){return Math.pow(this.x-a.x,2)+Math.pow(this.y-a.y,2)},normalize:function(){var a=this.length();return this.div(a),this},toAngle:function(){return Math.atan2(this.y,this.x)},toStyleString:function(){return"{x:{x}, y:{y}}".format(this)},toString:function(){return"{x:{x}, y:{y}}".format(this)},setX:function(a){return this.x=a,this},setY:function(a){return this.y=a,this}}),tm.geom.Vector2.min=function(a,b){return tm.geom.Vector2(a.xb.x?a.x:b.x,a.y>b.y?a.y:b.y)},tm.geom.Vector2.add=function(a,b){return tm.geom.Vector2(a.x+b.x,a.y+b.y)},tm.geom.Vector2.sub=function(a,b){return tm.geom.Vector2(a.x-b.x,a.y-b.y)},tm.geom.Vector2.mul=function(a,b){return tm.geom.Vector2(a.x*b,a.y*b)},tm.geom.Vector2.div=function(a,b){return tm.geom.Vector2(a.x/b,a.y/b)},tm.geom.Vector2.negate=function(){return tm.geom.Vector2(-this.x,-this.y)},tm.geom.Vector2.dot=function(a,b){return a.x*b.x+a.y*b.y},tm.geom.Vector2.cross=function(a,b){return a.x*b.y-a.y*b.x},tm.geom.Vector2.distance=function(a,b){return Math.sqrt(Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2))},tm.geom.Vector2.distanceSquared=function(a,b){return Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2)},tm.geom.Vector2.manhattanDistance=function(a,b){return Math.abs(a.x-b.x)+Math.abs(a.y-b.y)},tm.geom.Vector2.reflect=function(a,b){var c=Vector2.dot(a,b),d=Vector2.mul(b,2*c);return tm.geom.Vector2.sub(a,d)},tm.geom.Vector2.lerp=function(a,b,c){return tm.geom.Vector2(a.x+(b.x-a.x)*c,a.y+(b.y-a.y)*c)},tm.geom.Vector2.slerp=function(a,b,c){},tm.geom.Vector2.random=function(a,b,c){return a=a||0,b=b||360,c=c||1,tm.geom.Vector2().setDegree(Math.randf(a,b),c)},tm.geom.Vector2.ZERO=tm.geom.Vector2(0,0),tm.geom.Vector2.LEFT=tm.geom.Vector2(-1,0),tm.geom.Vector2.RIGHT=tm.geom.Vector2(1,0),tm.geom.Vector2.UP=tm.geom.Vector2(0,1),tm.geom.Vector2.DOWN=tm.geom.Vector2(0,-1)}(),tm.geom=tm.geom||{},function(){tm.geom.Vector3=tm.createClass({x:0,y:0,z:0,init:function(a,b,c){this.set(a,b,c)},set:function(a,b,c){return this.x=a,this.y=b,this.z=c,this},setNumber:function(a,b,c){return this.x=a,this.y=b,this.z=c,this},setArray:function(a){return this.x=a[0],this.y=a[1],this.z=a[2],this},setObject:function(a){return this.x=a.x,this.y=a.y,this.z=a.z,this},setString:function(a){var b=a.match(/(-?\d+(\.{1}\d+)?),\s*(-?\d+(\.{1}\d+)?),\s*(-?\d+(\.{1}\d+)?)/);return this.x=parseFloat(b[1]),this.y=parseFloat(b[3]),this.z=parseFloat(b[5]),this},setAngle:function(a,b,c){return c=c||1,this.x=c*Math.cos(a)*Math.sin(b),this.y=c*Math.sin(a),this.z=c*Math.cos(a)*Math.cos(b),this},setRadian:function(a,b,c){return this.setFromAngle(a,b,c)},setDegree:function(a,b,c){return this.setFromAngle(a*Math.PI/180,b*Math.PI/180,c)},setSmart:function(a,b,c){var d=arguments[0];if(arguments.length===3)this.x=a,this.y=b,this.z=c;else if(d instanceof Array)this.x=d[0],this.y=d[1],this.z=d[2];else if(d instanceof Object)this.x=d.x,this.y=d.y,this.z=d.z;else if(typeof d=="string"){var e=d.match(/(-?\d+(\.{1}\d+)?),\s*(-?\d+(\.{1}\d+)?),\s*(-?\d+(\.{1}\d+)?)/);this.x=parseFloat(e[1]),this.y=parseFloat(e[3]),this.z=parseFloat(e[5])}return this},add:function(a){return this.x+=a.x,this.y+=a.y,this.z+=a.z,this},sub:function(a){return this.x-=a.x,this.y-=a.y,this.z-=a.z,this},mul:function(a){return this.x*=a,this.y*=a,this.z*=a,this},div:function(a){return console.assert(a!=0,"0 division!!"),this.x/=a,this.y/=a,this.z/=a,this},negate:function(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this},length:function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},lengthSquared:function(){return this.x*this.x+this.y*this.y+this.z*this.z},normalize:function(){var a=this.length();return this.div(a),this},toVector2:function(){},toAngleXY:function(){return Math.atan2(this.y,this.x)},to3D:function(){},equals:function(a,b,c){return this.x===a&&this.y===b&&this.z===c},equalsArray:function(a){return this.equals(a[0],a[1],a[2])},equalsObject:function(a){return this.equals(a.x,a.y,a.z)},equalsSmart:function(){},toStyleString:function(){return"{x:{x}, y:{y}, z:{z}}".format(this)},toString:function(){return"{x:{x}, y:{y}, z:{z}}".format(this)},setX:function(a){return this.x=a,this},setY:function(a){return this.y=a,this},setZ:function(a){return this.z=a,this}}),tm.geom.Vector3.min=function(a,b){return Vector3(a.xb.x?a.x:b.x,a.y>b.y?a.y:b.y,a.z>b.z?a.z:b.z)},tm.geom.Vector3.add=function(a,b){return tm.geom.Vector3(a.x+b.x,a.y+b.y,a.z+b.z)},tm.geom.Vector3.sub=function(a,b){return tm.geom.Vector3(a.x-b.x,a.y-b.y,a.z-b.z)},tm.geom.Vector3.mul=function(a,b){return tm.geom.Vector3(a.x*b,a.y*b,a.z*b)},tm.geom.Vector3.div=function(a,b){return tm.geom.Vector3(a.x/b,a.y/b,a.z/b)},tm.geom.Vector3.dot=function(a,b){return a.x*b.x+a.y*b.y+a.z*b.z},tm.geom.Vector3.cross=function(a,b){},tm.geom.Vector3.negate=function(a){return tm.geom.Vector3(-a.x,-a.y,-a.z)},tm.geom.Vector3.distance=function(a,b){return Math.sqrt(Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2)+Math.pow(a.z-b.z,2))},tm.geom.Vector3.distanceSquared=function(a,b){return Math.pow(a.x-b.x,2)+Math.pow(a.y-b.y,2)+Math.pow(a.z-b.z,2)},tm.geom.Vector3.manhattanDistance=function(a,b){return Math.abs(a.x-b.x)+Math.abs(a.y-b.y)+Math.abs(a.z-b.z)},tm.geom.Vector3.reflect=function(a,b){var c=Vector3.dot(a,b),d=Vector3.mul(b,2*c);return Vector3.sub(a,d)},tm.geom.Vector3.lerp=function(a,b,c){return tm.geom.Vector3(a.x+(b.x-a.x)*c,a.y+(b.y-a.y)*c,a.z+(b.z-a.z)*c)},tm.geom.Vector3.slerp=function(a,b,c){},tm.geom.Vector3.random=function(a,b,c,d,e){return a=a||0,b=b||360,c=c||0,d=d||360,e=e||1,TM.Geom.Vector3().setFromDegree(TM.randomf(a,b),TM.randomf(c,d),e)},tm.geom.Vector3.ZERO=tm.geom.Vector3(0,0,0),tm.geom.Vector3.LEFT=tm.geom.Vector3(-1,0,0),tm.geom.Vector3.RIGHT=tm.geom.Vector3(1,0,0),tm.geom.Vector3.UP=tm.geom.Vector3(0,1,0),tm.geom.Vector3.DOWN=tm.geom.Vector3(0,-1,0),tm.geom.Vector3.FORWARD=tm.geom.Vector3(0,0,-1),tm.geom.Vector3.BACKWARD=tm.geom.Vector3(0,0,1)}(),tm.geom=tm.geom||{},function(){tm.geom.Matrix33=tm.createClass({m:null,init:function(){this.m=[],arguments.length>=9?this.set.apply(this,arguments):this.identity()},clone:function(){var a=this.m;return tm.geom.Matrix33(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8])},set:function(a,b,c,d,e,f,g,h,i){return console.assert(arguments.length>=9,""),this.m00=a,this.m01=b,this.m02=c,this.m10=d,this.m11=e,this.m12=f,this.m20=g,this.m21=h,this.m22=i,this},setArray:function(a){return this.set(a[0],a[3],a[6],a[1],a[4],a[7],a[2],a[5],a[8]),this},setObject:function(a){return this.set(a.m00,a.m01,a.m02,a.m10,a.m11,a.m12,a.m20,a.m21,a.m22),this},identity:function(){var a=this.m;return a[0]=1,a[3]=0,a[6]=0,a[1]=0,a[4]=1,a[7]=0,a[2]=0,a[5]=0,a[8]=1,this},transpose:function(){return this.m.swap(1,3),this.m.swap(2,6),this.m.swap(5,7),this},invert:function(){var a=this.m,b=a[0],c=a[3],d=a[6],e=a[1],f=a[4],g=a[7],h=a[2],i=a[5],j=a[8],k=this.determinant();return this.m00=(f*j-g*i)/k,this.m01=(e*j-g*h)/k*-1,this.m02=(e*i-f*h)/k,this.m10=(c*j-d*i)/k*-1,this.m11=(b*j-d*h)/k,this.m12=(b*i-c*h)/k*-1,this.m20=(c*g-d*f)/k,this.m21=(b*g-d*e)/k*-1,this.m22=(b*f-c*e)/k,this.transpose(),this},determinant:function(){var a=this.m,b=a[0],c=a[3],d=a[6],e=a[1],f=a[4],g=a[7],h=a[2],i=a[5],j=a[8];return b*f*j+e*i*d+c*g*h-d*f*h-c*e*j-g*i*b},zero:function(){return this.set(0,0,0,0,0,0,0,0,0),this},translate:function(a,b){var c=this.m;return c[6]=c[0]*a+c[3]*b+c[6],c[7]=c[1]*a+c[4]*b+c[7],c[8]=c[2]*a+c[5]*b+c[8],this},rotateX:function(a){return this.multiply(tm.geom.Matrix33.rotateX(a))},rotateY:function(a){return this.multiply(tm.geom.Matrix33.rotateY(a))},rotateZ:function(a){var b=Math.sin(a),c=Math.cos(a),d=this.m,e=d[0],f=d[1],g=d[2],h=d[3],i=d[4],j=d[5];return this.multiply(tm.geom.Matrix33.rotateZ(a))},scale:function(a,b){var c=this.m;return c[0]*=a,c[3]*=b,c[1]*=a,c[4]*=b,c[2]*=a,c[5]*=b,this},multiply:function(a){var b=this.m,c=a.m,d=b[0],e=b[3],f=b[6],g=b[1],h=b[4],i=b[7],j=b[2],k=b[5],l=b[8],m=c[0],n=c[3],o=c[6],p=c[1],q=c[4],r=c[7],s=c[2],t=c[5],u=c[8];return b[0]=d*m+e*p+f*s,b[3]=d*n+e*q+f*t,b[6]=d*o+e*r+f*u,b[1]=g*m+h*p+i*s,b[4]=g*n+h*q+i*t,b[7]=g*o+h*r+i*u,b[2]=j*m+k*p+l*s,b[5]=j*n+k*q+l*t,b[8]=j*o+k*r+l*u,this},multiplyVector2:function(a){var b=this.m00*a.x+this.m01*a.y+this.m02,c=this.m10*a.x+this.m11*a.y+this.m12;return tm.geom.Vector2(b,c)},multiplyVector3:function(a){var b=this.m00*a.x+this.m01*a.y+this.m02*a.z,c=this.m10*a.x+this.m11*a.y+this.m12*a.z,d=this.m20*a.x+this.m21*a.y+this.m22*a.z;return tm.geom.Vector3(b,c,d)},toArray:function(){return this.m.slice()},toString:function(){return"|{m00}, {m01}, {m02}|\n|{m10}, {m11}, {m12}|\n|{m20}, {m21}, {m22}|".format(this)}}),tm.geom.Matrix33.prototype.accessor("m00",{get:function(){return this.m[0]},set:function(a){this.m[0]=a}}),tm.geom.Matrix33.prototype.accessor("m10",{get:function(){return this.m[1]},set:function(a){this.m[1]=a}}),tm.geom.Matrix33.prototype.accessor("m20",{get:function(){return this.m[2]},set:function(a){this.m[2]=a}}),tm.geom.Matrix33.prototype.accessor("m01",{get:function(){return this.m[3]},set:function(a){this.m[3]=a}}),tm.geom.Matrix33.prototype.accessor("m11",{get:function(){return this.m[4]},set:function(a){this.m[4]=a}}),tm.geom.Matrix33.prototype.accessor("m21",{get:function(){return this.m[5]},set:function(a){this.m[5]=a}}),tm.geom.Matrix33.prototype.accessor("m02",{get:function(){return this.m[6]},set:function(a){this.m[6]=a}}),tm.geom.Matrix33.prototype.accessor("m12",{get:function(){return this.m[7]},set:function(a){this.m[7]=a}}),tm.geom.Matrix33.prototype.accessor("m22",{get:function(){return this.m[8]},set:function(a){this.m[8]=a}}),tm.geom.Matrix33.prototype.accessor("a",{get:function(){return this.m[0]},set:function(a){this.m[0]=a}}),tm.geom.Matrix33.prototype.accessor("b",{get:function(){return this.m[3]},set:function(a){this.m[3]=a}}),tm.geom.Matrix33.prototype.accessor("c",{get:function(){return this.m[1]},set:function(a){this.m[1]=a}}),tm.geom.Matrix33.prototype.accessor("d",{get:function(){return this.m[4]},set:function(a){this.m[4]=a}}),tm.geom.Matrix33.prototype.accessor("tx",{get:function(){return this.m[6]},set:function(a){this.m[6]=a}}),tm.geom.Matrix33.prototype.accessor("ty",{get:function(){return this.m[7]},set:function(a){this.m[7]=a}}),tm.geom.Matrix33.translate=function(a,b){return tm.geom.Matrix33(1,0,a,0,1,b,0,0,1)},tm.geom.Matrix33.rotateX=function(a){var b=Math.cos(a),c=Math.sin(a);return tm.geom.Matrix33(1,0,0,0,b,-c,0,c,b)},tm.geom.Matrix33.rotateY=function(a){var b=Math.cos(a),c=Math.sin(a);return tm.geom.Matrix33(b,0,c,0,1,0,-c,0,b)},tm.geom.Matrix33.rotateZ=function(a){var b=Math.cos(a),c=Math.sin(a);return tm.geom.Matrix33(b,-c,0,c,b,0,0,0,1)},tm.geom.Matrix33.scale=function(a,b){var c=tm.geom.Matrix33();return b==undefined&&(b=a),c.set(a,0,0,0,b,0,0,0,1),c}}(),tm.geom=tm.geom||{},function(){tm.geom.Matrix44=tm.createClass({m:null,init:function(){this.m=[],arguments.length>=16?this.set.apply(this,arguments):this.identity()},set:function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p){return console.assert(arguments.length>=16,""),this.m00=a,this.m01=b,this.m02=c,this.m03=d,this.m10=e,this.m11=f,this.m12=g,this.m13=h,this.m20=i,this.m21=j,this.m22=k,this.m23=l,this.m30=m,this.m31=n,this.m32=o,this.m33=p,this},setArray:function(a){return this.set(a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]),this},setObject:function(a){return this.set(a.m00,a.m01,a.m02,a.m03,a.m10,a.m11,a.m12,a.m13,a.m20,a.m21,a.m22,a.m23,a.m30,a.m31,a.m32,a.m33),this},identity:function(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this},translate:function(a,b,c){return this.multiply(tm.geom.Matrix44.translate(a,b,c))},rotate:function(a){console.error("Unimplemented")},rotateX:function(a){return this.multiply(tm.geom.Matrix44.rotateX(a))},rotateY:function(a){return this.multiply(tm.geom.Matrix44.rotateY(a))},rotateZ:function(a){return this.multiply(tm.geom.Matrix44.rotateZ(a))},scale:function(a,b,c){return this.multiply(tm.geom.Matrix44.scale(a,b,c))},zero:function(){return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),this},multiply:function(a){var b=this.m00*a.m00+this.m01*a.m10+this.m02*a.m20+this.m03*a.m30,c=this.m00*a.m01+this.m01*a.m11+this.m02*a.m21+this.m03*a.m31,d=this.m00*a.m02+this.m01*a.m12+this.m02*a.m22+this.m03*a.m32,e=this.m00*a.m03+this.m01*a.m13+this.m02*a.m23+this.m03*a.m33,f=this.m10*a.m00+this.m11*a.m10+this.m12*a.m20+this.m13*a.m30,g=this.m10*a.m01+this.m11*a.m11+this.m12*a.m21+this.m13*a.m31,h=this.m10*a.m02+this.m11*a.m12+this.m12*a.m22+this.m13*a.m32,i=this.m10*a.m03+this.m11*a.m13+this.m12*a.m23+this.m13*a.m33,j=this.m20*a.m00+this.m21*a.m10+this.m22*a.m20+this.m23*a.m30,k=this.m20*a.m01+this.m21*a.m11+this.m22*a.m21+this.m23*a.m31,l=this.m20*a.m02+this.m21*a.m12+this.m22*a.m22+this.m23*a.m32,m=this.m20*a.m03+this.m21*a.m13+this.m22*a.m23+this.m23*a.m33,n=this.m30*a.m00+this.m31*a.m10+this.m32*a.m20+this.m33*a.m30,o=this.m30*a.m01+this.m31*a.m11+this.m32*a.m21+this.m33*a.m31,p=this.m30*a.m02+this.m31*a.m12+this.m32*a.m22+this.m33*a.m32,q=this.m30*a.m03+this.m31*a.m13+this.m32*a.m23+this.m33*a.m33;return this.set(b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q)},getAxisX:function(){return TM.Geom.Vector3(this.m00,this.m01,this.m02)},getAxisY:function(){return TM.Geom.Vector3(this.m10,this.m11,this.m12)},getAxisZ:function(){return TM.Geom.Vector3(this.m20,this.m21,this.m22)},setAxisX:function(a){this.m00=a.x,this.m01=a.y,this.m02=a.z},setAxisY:function(a){this.m10=a.x,this.m11=a.y,this.m12=a.z},setAxisZ:function(a){this.m20=a.x,this.m21=a.y,this.m22=a.z},toMatrix33:function(){},toArray:function(){return this.m.slice()},toString:function(){return"|{m00}, {m01}, {m02}, {m03}|\n|{m10}, {m11}, {m12}, {m13}|\n|{m20}, {m21}, {m22}, {m23}|\n|{m30}, {m31}, {m32}, {m33}|".format(this)}}),tm.geom.Matrix44.prototype.accessor("m00",{get:function(){return this.m[0]},set:function(a){this.m[0]=a}}),tm.geom.Matrix44.prototype.accessor("m10",{get:function(){return this.m[1]},set:function(a){this.m[1]=a}}),tm.geom.Matrix44.prototype.accessor("m20",{get:function(){return this.m[2]},set:function(a){this.m[2]=a}}),tm.geom.Matrix44.prototype.accessor("m30",{get:function(){return this.m[3]},set:function(a){this.m[3]=a}}),tm.geom.Matrix44.prototype.accessor("m01",{get:function(){return this.m[4]},set:function(a){this.m[4]=a}}),tm.geom.Matrix44.prototype.accessor("m11",{get:function(){return this.m[5]},set:function(a){this.m[5]=a}}),tm.geom.Matrix44.prototype.accessor("m21",{get:function(){return this.m[6]},set:function(a){this.m[6]=a}}),tm.geom.Matrix44.prototype.accessor("m31",{get:function(){return this.m[7]},set:function(a){this.m[7]=a}}),tm.geom.Matrix44.prototype.accessor("m02",{get:function(){return this.m[8]},set:function(a){this.m[8]=a}}),tm.geom.Matrix44.prototype.accessor("m12",{get:function(){return this.m[9]},set:function(a){this.m[9]=a}}),tm.geom.Matrix44.prototype.accessor("m22",{get:function(){return this.m[10]},set:function(a){this.m[10]=a}}),tm.geom.Matrix44.prototype.accessor("m32",{get:function(){return this.m[11]},set:function(a){this.m[11]=a}}),tm.geom.Matrix44.prototype.accessor("m03",{get:function(){return this.m[12]},set:function(a){this.m[12]=a}}),tm.geom.Matrix44.prototype.accessor("m13",{get:function(){return this.m[13]},set:function(a){this.m[13]=a}}),tm.geom.Matrix44.prototype.accessor("m23",{get:function(){return this.m[14]},set:function(a){this.m[14]=a}}),tm.geom.Matrix44.prototype.accessor("m33",{get:function(){return this.m[15]},set:function(a){this.m[15]=a}}),tm.geom.Matrix44.translate=function(a,b,c){return tm.geom.Matrix44(1,0,0,a,0,1,0,b,0,0,1,c,0,0,0,1)},tm.geom.Matrix44.rotateX=function(a){var b=Math.cos(a),c=Math.sin(a);return tm.geom.Matrix44(1,0,0,0,0,b,-c,0,0,c,b,0,0,0,0,1)},tm.geom.Matrix44.rotateY=function(a){var b=Math.cos(a),c=Math.sin(a);return tm.geom.Matrix44(b,0,c,0,0,1,0,0,-c,0,b,0,0,0,0,1)},tm.geom.Matrix44.rotateZ=function(a){var b=Math.cos(a),c=Math.sin(a);return tm.geom.Matrix44(b,-c,0,0,c,b,0,0,0,0,1,0,0,0,0,1)},tm.geom.Matrix44.scale=function(a,b,c){var d=tm.geom.Matrix44();return b==undefined&&(b=a),c==undefined&&(c=a),d.set(a,0,0,0,0,b,0,0,0,0,c,0,0,0,0,1),d}}(),tm.geom=tm.geom||{},function(){tm.geom.Rect=tm.createClass({x:0,y:0,width:0,height:0,init:function(a,b,c,d){this.set(a,b,c,d)},set:function(a,b,c,d){return this.x=a,this.y=b,this.width=c,this.height=d,this},move:function(a,b){return this.x=a,this.y=b,this},moveBy:function(a,b){return this.x+=a,this.y+=b,this},resize:function(a,b){return this.width=a,this.height=b,this},resizeBy:function(a,b){return this.width+=a,this.height+=b,this},padding:function(a,b,c,d){switch(arguments.length){case 1:a=b=c=d=arguments[0];break;case 2:a=c=arguments[0],b=d=arguments[1];break;case 3:a=arguments[0],b=d=arguments[1],c=arguments[2]}return this.x+=d,this.y+=a,this.width-=d+b,this.height-=a+c,this},clone:function(){},toCircle:function(){return tm.geom.Circle(this.centerX,this.centerY,this.widthd?(b.width=innerWidth+"px",b.height=innerWidth*e+"px"):(b.width=innerHeight/e+"px",b.height=innerHeight+"px")}.bind(this);b(),a&&window.addEventListener("resize",b,!1)},clear:function(a,b,c,d){return a=a||0,b=b||0,c=c||this.width,d=d||this.height,this.context.clearRect(a,b,c,d),this},clearColor:function(a,b,c,d,e){return b=b||0,c=c||0,d=d||this.width,e=e||this.height,this.save(),this.resetTransform(),this.fillStyle=a,this.context.fillRect(b,c,d,e),this.restore(),this},beginPath:function(){return this.context.beginPath(),this},closePath:function(){return this.context.closePath(),this},moveTo:function(a,b){return this.context.moveTo(a,b),this},lineTo:function(a,b){return this.context.lineTo(a,b),this},fill:function(){return this.context.fill(),this},stroke:function(){return this.context.stroke(),this},clip:function(){return this.context.clip(),this},drawPoint:function(a,b){return this.strokeRect(a,b,1,1)},line:function(a,b,c,d){return this.moveTo(a,b).lineTo(c,d)},drawLine:function(a,b,c,d){return this.beginPath().line(a,b,c,d).stroke()},drawDashLine:function(a,b,c,d,e){var f=null;typeof e=="string"?f=e:(e=e||61680,f=e.toString(2)),f=f.padding(16,"1");var g=c-a,h=d-b,i=Math.sqrt(g*g+h*h);g/=i,h/=i;var j=a,k=b;for(var l=0;lthis.width&&(g=this.width),h<0&&(h=0),i>this.height&&(i=this.height);var j=[],k=this.width;for(var l=h;l>>16,(b&65280)>>>8,(b&255)>>>0)},setPixel32FromNumber:function(a,b){return this.setPixel32(a,(b&16711680)>>>16,(b&65280)>>>8,(b&255)>>>0,(b&4278190080)>>>24)},setPixelFromObject:function(a,b){return this.setPixel(b.r,b.g,b.b)},setPixel32FromObject:function(a,b){return this.setPixel32(b.r,b.g,b.b,b.a)},setPixelFromString:function(a,b){},posToIndex:function(a,b){return b*this.imageData.width+a},filter:function(a){for(var b=0;bthis.duration?this.isLooping?(this.rewind(),this.update(),this.dispatchEvent(tm.event.TweenEvent("loop",this.time,this.now))):(this.time=this.duration,this.update(),this.stop(),this.dispatchEvent(tm.event.TweenEvent("finish",this.time,this.now))):(this.time=b,this.update())}})}(),function(){tm.anim.easing={"default":function(a,b,c,d){return c*a/d+b},linear:function(a,b,c,d){return c*a/d+b},swing:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},easeInQuad:function(a,b,c,d){return c*(a/=d)*a+b},easeOutQuad:function(a,b,c,d){return-c*(a/=d)*(a-2)+b},easeInOutQuad:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b},easeInCubic:function(a,b,c,d){return c*(a/=d)*a*a+b},easeOutCubic:function(a,b,c,d){return c*((a=a/d-1)*a*a+1)+b},easeInOutCubic:function(a,b,c,d){return(a/=d/2)<1?c/2*a*a*a+b:c/2*((a-=2)*a*a+2)+b},easeOutInCubic:function(a,b,c,d){return a0){var c=this.children.slice();for(var d=0,e=c.length;d0&&(b.shadowColor=this.shadowColor,b.shadowOffsetX=this.shadowOffsetX,b.shadowOffsetY=this.shadowOffsetY,b.shadowBlur=this.shadowBlur),b.translate(this.position.x,this.position.y),b.rotate(this.rotation*Math.DEG_TO_RAD),b.scale(this.scale.x,this.scale.y),this.draw(a);if(this.children.length>0){var c=this.children.slice();for(var d=0,e=c.length;d0){e.delay-=1e3/a.fps;continue}var f=e.time+1e3/a.fps;e._setTime(f);if(e.time>=e.duration){this.tweens.erase(e);if(this.tweens.length<=0){this.isAnimation=!1;var g=tm.event.Event("animationend");this.element.dispatchEvent(g)}}else e.update()}},addTween:function(a){a.target||(a.target=this.element);var b=tm.anim.Tween(a);b.delay=a.delay||0,this.tweens.push(b);if(this.isAnimation==0){this.isAnimation=!0;var c=tm.event.Event("animationstart");this.element.dispatchEvent(c)}return b},addTweens:function(a){for(var b=0,c=arguments.length;b