document.onkeypress=function(a){a=a||window.event;kcode=a.keyCode||a.which;if(kcode==32&&K==0){L=8;b.innerHTML=parseInt(b.innerHTML)+1;}console.log(kcode);};var a=document.getElementById("scene");var b=document.getElementById("score");var c=a.getContext("2d");var d=a.width;var e=a.height;var f=d/2;var g=e/2;var h=c.createLinearGradient(0,g,0,e);c.lineWidth=10;c.strokeStyle='#ff0000';var i=10;var j=d;var k=6.0;var l=30.0;var m=parseFloat(d);var n=m/k;var o=1;window.addEventListener('resize',p,false);function p(){a.width=window.innerWidth;d=a.width;e=a.height;y=e/2;f=d/2;g=e/2;h=c.createLinearGradient(0,g,0,e);h.addColorStop(0,"#0087A8");h.addColorStop(1,"#0087A8");c.fillStyle=h;}p();var q=0;var r=Math.PI*2.0;var s=r*k;function t(a,b){var c=0;wavelength_max=Math.ceil(a/b);while(true){if(c>wavelength_max)c=0;c+=b;}}function u(a,b,c){wavelength_max=Math.ceil(b/c)*c;a+=c;if(a>wavelength_max)a=c;return a;}function v(a,b,c,d,e,f){cr=Math.cos((s*((b+a)/f)));new_y=c+d*cr;return [b,new_y,cr];}function w(a,b){a1=b[0]-a[0];a2=b[1]-a[1];length=Math.sqrt((a1*a1)+(a2*a2));return [a1/length,a2/length];}function x(a,b,c){}function y(a,b,c){a=w(a,b);b=w(a,c);dot=a[0]*b[0]+a[1]*b[1];return Math.acos(dot);}function z(a,b){if(a[1]>b[1])F=-y([a[0]-10,a[1]],b,a);else F=y([a[0]-10,a[1]],b,a);return F;}function A(a,b){c.save();c.translate(a[0],a[1]-16);c.rotate(b);c.drawImage(H,-16,-16,32,32);c.restore();}function B(){c.beginPath();c.moveTo(0,e);for(p=0;p<D.length;p=p+1)c.lineTo(parseInt(D[p][0]),parseInt(D[p][1]));c.lineTo(d,e);c.lineWidth=10;c.stroke();c.fill();}function C(){c.beginPath();for(p=0;p<D.length;p=p+1)c.arc(parseInt(D[p][0]),parseInt(D[p][1]),2,0,2*Math.PI);c.stroke();}var D=new Array();var E=null;for(x_pos=0;x_pos<d+1;x_pos=x_pos+10){for(p=0;p<D.length;p=p+1)D[p][0]=D[p][0]-i;E=v(time=q,x=d,y=g,l=l,k=k,j=j);D.push([E[0],E[1]]);q=u(q,n,o);}var F=null;var G=Math.ceil(D.length/2);var H=new Image();H.src='/static/images/icon.png';var I=0;var J=0.75;var K=0;var L=0;function M(){c.clearRect(0,0,d,e);for(p=0;p<D.length;p=p+1)D[p][0]=D[p][0]-i;D.shift();D.push(v(time=q,x=d,y=g,l=l,k=k,j=j));if(K>0||L>0){K+=L;L-=J;}else{L=0;K=0;}I=I+0.1;A([D[G][0],D[G][1]-K],I);B();q=u(q,n,o);requestAnimationFrame(M);}M();