-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
30 lines (30 loc) · 19.1 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<!DOCTYPE html><meta charset=utf-8><title>Racer</title><meta name=viewport content="width=device-width,user-scalable=no"><link rel=icon type=image/png href=i.png><link rel=manifest href=manifest.json><script>if(navigator.serviceWorker&&!(navigator.mozApps&&navigator.mozApps.installPackage))navigator.serviceWorker.register('sw.js')</script>
<style>#c{display:none;position:absolute}html,body{margin:0;padding:0;overflow:visible;background:#000;color:#fff;font:23px monospace}input{display:none;}:checked~label{color:#000;background:#fff}ol li{display:inline-block;height:100%;float:left}li label{display:inline-block;height:100%;padding:0 0.75em;line-height:2.5em}ol{height:2.5em;display:inline-block;margin:0;padding:0;vertical-align:middle}p{clear:both}li,button{display:block}div{padding:0.5em}button{width:100%;font:inherit;background:#fff;color:#000;line-height:2}</style><section id=i><form autocomplete=off><div>Style: <ol><li><input id=r1 name=s value=0 type=radio checked><label for=r1>Forest</label><li><input id=r2 name=s value=1 type=radio><label for=r2>Desert</label><li><input id=r3 name=s value=2 type=radio><label for=r3>Snow</label></ol></div><div>Car: <ol><li><input id=r4 name=c value=0 type=radio checked><label for=r4>Red</label><li><input id=r5 name=c value=1 type=radio><label for=r5>Blue</label><li><input id=r6 name=c value=2 type=radio><label for=r6>Yellow</label><li><input id=r7 name=c value=3 type=radio><label for=r7>Green</label></ol></div><div>Road: <ol><li><input id=r8 name=r value=0 type=radio checked><label for=r8>Traditional</label><li><input id=r9 name=r value=1 type=radio><label for=r9>Oval</label><li><input id=r10 name=r value=2 type=radio><label for=r10>Short</label></ol></div></form><div>Best time: <span id=t></span></div><button id=g>Go!</button></section><canvas id=c></canvas><script>(function(F,Ha,l,p,zb,N,G){var ja,ka,la;function Xa(){try{navigator.vibrate(100)}catch(a){}}function Ab(a,b){var c;if(9<b.length)return!1;var g=Ya(a);if(!g||g>b)try{return c=JSON.parse(Ha[Ia]||"{}"),c[a]=b,Ha[Ia]=JSON.stringify(c),!0}catch(e){}return!1}function Ya(a){try{return JSON.parse(Ha[Ia])[a]}catch(b){}}function Za(a,b){if(null!==a){var c=parseInt(a,10);if(!isNaN(c))return c}return Za(b,0)}function ba(a){var b=l.random();return a[N(0+(a.length-1-0)*b)]}function ma(a,b,c){return a+(b-a)*(-l.cos(c*
l.PI)/2+.5)}function Q(a,b,c){for(a+=b;a>=c;)a-=c;for(;0>a;)a+=c;return a}function $a(a,b,c,g,e,f,h,m){a.c.x=(a.w.x||0)-b;a.c.y=(a.w.y||0)-c;a.c.z=(a.w.z||0)-g;a.s.s=e/a.c.z;a.s.x=N(f/2+a.s.s*a.c.x*f/2);a.s.y=N(h/2-a.s.s*a.c.y*h/2);a.s.w=N(a.s.s*m*f/2)}function na(a,b,c,g,e){e=(e||1)/2;return!(a+b*e<c-g*e||a-b*e>c+g*e)}function oa(a,b,c,g,e,f,h,m,k,d){a.fillStyle=d;a.beginPath();a.moveTo(b,c);a.lineTo(g,e);a.lineTo(f,h);a.lineTo(m,k);a.closePath();a.fill()}function Ja(a,b,c,g,e,f,h){h=h||0;var m=
e.w/2,k=e.h;f=e.x+G(e.w*(f||0));var d=e.y,t=l.min(m,e.x+e.w-f),v=G(t/m*c);if(t)a[r](b,f,d,t,k,0,h,v,g);if(t<m)a[r](b,e.x,d,m-t,k,v,h,c-v,g)}function Ka(a,b,c,g,e,f,h,m,k,d,t,v,u){c=h.w*m*b/2*J*e;b=h.h*m*b/2*J*e;k+=c*(t||0);d+=b*(v||0);t=u?l.max(0,d+b-u):0;if(t<b)a[r](f,h.x,h.y,h.w,h.h-h.h*t/b,k,d,c,b-t)}function Bb(a,b){ab={x:800,y:42*b,w:80,h:41};pa={x:880,y:42*b,w:80,h:41};bb={x:960,y:42*b,w:80,h:41};cb={x:880,y:0,w:80,h:41};db={x:880,y:42,w:80,h:41};eb={x:880,y:84,w:80,h:41};fb={x:880,y:126,w:80,
h:41};qa={x:5,y:0,w:350,h:285};ra={x:400,y:0,w:350,h:285};sa={x:30,y:310,w:385,h:400};La={x:470,y:310,w:360,h:400};gb={x:900,y:300,w:390,h:420};Ma={x:40,y:820,w:430,h:460};hb={x:500,y:810,w:260,h:240};ta={x:1400,y:5,w:30,h:700};ca=Na=J=void 0;Na=[cb,db,eb,fb];J=1/pa.w*.3;switch(a){case 0:da="#72D7EE";ua=va="#005108";ja="#be5";ka="#22a822";la="#1a1";wa={r:"#6B6B6B",g:"#1a1",R:"#555",l:"#ccc"};xa={r:"#696969",g:"#090",R:"#bbb"};ea={r:"#ccc",g:"#5f5",R:"#ccc"};ya={r:"#333",g:"#050",R:"#333"};ca=[qa,
ra,sa,La,La,ta];break;case 1:da="#77f";va="#880";ua="#884";ja="#ff5";ka="#ee3";la="#dd0";wa={r:"#6B6B6B",g:"#dd0",R:"#f00",l:"#ccc"};xa={r:"#696969",g:"#bb0",R:"#bbb"};ea={r:"#ccc",g:"#ff3",R:"#ccc"};ya={r:"#333",g:"#880",R:"#333"};ca=[qa,ra,Ma,Ma,hb,ta];break;case 2:da="#8af",va="#888",ua="#aaa",ja="#fff",ka="#ddd",la="#aaa",wa={r:"#bbb",g:"#eef",R:"#f00",l:"#ccc"},xa={r:"#aaa",g:"#dde",R:"#bbb"},ea={r:"#ccc",g:"#fff",R:"#ccc"},ya={r:"#555",g:"#555",R:"#555"},ca=[qa,ra,sa,sa,gb,ta]}}function O(a,
b){a=[["#e00","#d00","#c00","#a00"],["#00e","#00d","#00c","#00a"],["#ee0","#dd0","#cc0","#aa0"],["#0e0","#0d0","#0c0","#0a0"]][a];var c=ib+(b?'150" height="102"><g style="stroke:#000;stroke-width:0.5px"><path d="m 13,80 8,0 0,0 0,15 L 21,94 c 0,0 -5,0 -8,-1 -1,-4 1,-13 0,-13 z" style="fill:#222"/><path d="m 16,52 c -2,4 -6,22 -5,28 0,3 2,5 5,4 -1,-2 1,-4 1,-6 -2,-3 -3,-8 2,-10 -1,-4 0,-14 2,-20 -4,1 -3,1 -5,4 z" style="fill:#eee;stroke:none"/><path d="m 20,74 c 0,0 -2,-16 0,-25 1,-2 2,0 3,-2 19,-16 27,-31 36,-33 13,-4 65,-1 65,-1 6,2 24,29 21,31 3,8 -4,20 -7,29 -12,5 -78,8 -118,1 z" style="fill:#ddd;stroke:none"/><path d="m 147,61 c -2,-3 -6,-6 -4,-8 1,-13 0,-17 -2,-19 9,-3 6,23 6,27 z" style="fill:#eee;stroke:none"/><path d="m 132,43 c -1,-2 -9,-17 -9,-23 0,-2 1,-1 3,-5 3,2 6,5 13,16 0,4 -5,9 -7,12 z" style="fill:#222"/><path d="m 148,81 -10,0 0,0 -2,17 c -1,0 8,0 12,-1 1,-4 -1,-16 0,-16 z" style="fill:#222"/><path d="m 149,51 c 0,0 1,22 0,29 -1,2 -7,4 -10,3 1,-2 1,-3 1,-4 2,-4 5,-10 -1,-11 1,-4 1,-11 2,-17 3,-2 8,-1 8,0 z" style="fill:#eee;stroke:none"/><path d="m 15,73 c -1,8 -1,15 3,22 0,0 2,1 3,2 1,0 1,1 2,1 -4,1 65,7 111,2 2,0 3,-4 3,-4 4,-5 3,-12 5,-20 1,-1 -1,-2 0,-3 -43,3 -83,4 -127,0 z" style="fill:#aaa;stroke:none"/><path d="m 120,50 -96,-1 -6,9 c 0,8 1,16 1,16 1,0 3,0 4,0 l 0,0 c 11,0 74,1 103,1 5,-1 7,0 9,-1 1,-2 1,-6 1,-7 -1,-3 0,-6 -1,-10 z" style="fill:#ccc;stroke:none"/><path d="m 19,69 c -8,1 -4,7 3,8 4,1 101,5 114,2 5,-1 10,-7 4,-11 -2,-1 1,6 -10,7 -35,0 -72,0 -102,-2 -4,0 -10,0 -9,-4 z" style="fill:#ddd;stroke:none"/><path d="m 20,94 c 37,2 76,4 112,3 l 1,-6 c -39,2 -75,1 -115,-3 z" style="fill:#222"/><path d="m 19,58 c 0,2 13,0 18,2 3,1 6,8 3,9 -2,1 -12,3 -19,0 -4,-2 -2,-6 -2,-11 z" style="fill:#800"/><path d="m 135,60 c 0,2 -18,0 -23,2 -3,0 -7,8 -4,9 2,1 16,2 23,0 6,-3 4,-6 4,-11 z" style="fill:#800"/><rect x="57" y="57" width="46" height="9" transform="matrix(1,0.012,-0.012,1,0,0)" style="fill:#fff;fill-opacity:0.7"/><path d="m 34,41 c 3,-4 10,-12 19,-21 17,-2 58,-2 67,0 2,7 2,14 4,22 z" style="fill:#222"/><path d="m 125,17 13,18" style="fill:#aaa;stroke:#999"/><path d="m 24,49 10,-8" style="fill:none"/><path d="m 120,51 4,-9" style="fill:none"/><path d="m 141,38 -1,2 2,0 z" style="fill:#333"/><path d="m 138,36 c 2,3 4,10 3,15" style="fill:none"/></g></svg>':
'151" height="103"><g style="stroke-width:0.5px;stroke:#000"><path d="m 6,80 10,0 0,0 0,18 c 0,0 0,0 0,0 0,0 -6,1 -9,0 -1,-4 0,-18 -1,-18 z" style="fill:#222"/><path d="m 8,51 c -2,4 -4,23 -4,29 2,3 4,6 7,4 -1,-1 1,-5 0,-6 -1,-3 -3,-8 4,-10 -1,-4 0,-14 1,-20 -4,2 -5,0 -8,3 z" style="fill:#eee;stroke:none"/><path d="m 15,75 c 0,0 -3,-17 1,-27 15,-13 18,-25 27,-33 12,-4 51,-4 65,-1 10,8 18,31 26,33 2,9 4,17 1,27 -13,5 -79,8 -120,1 z" style="fill:#ddd;stroke:none"/><path d="m 144,80 -9,2 0,0 0,17 c 0,0 0,0 0,0 -1,-1 5,0 9,0 2,-5 0,-19 0,-19 z" style="fill:#222"/><path d="m 142,51 c 2,4 4,23 4,28 -2,3 -4,5 -7,4 1,-1 0,-5 1,-7 2,-2 2,-6 -5,-8 1,-4 0,-14 -1,-21 4,1 5,1 8,4 z" style="fill:#eee;stroke:none"/><path d="m 10,72 c 0,10 1,18 5,26 0,0 4,4 4,2 -3,2 65,6 112,0 3,0 5,-2 5,-2 4,-7 4,-16 4,-24 -42,2 -85,4 -130,-2 z" style="fill:#aaa;stroke:none"/><path d="m 124,50 -98,0 -12,8 c 0,8 1,16 1,16 1,0 3,0 4,1 0,0 0,0 0,0 11,0 75,0 103,0 6,-1 10,-1 12,-3 2,-5 2,-10 1,-16 l -11,-6 z" style="fill:#ccc;stroke:none"/><path d="m 15,68 c -8,2 -7,12 3,12 2,0 101,2 114,-1 6,0 14,-7 4,-11 -2,-1 0,6 -10,6 -35,1 -71,2 -102,1 -4,-1 -9,-1 -9,-7 z" style="fill:#ddd;stroke:none"/><path d="m 18,96 c 37,3 80,2 116,0 l 1,-5 c -40,3 -79,4 -120,0 z" style="fill:#222"/><path d="m 15,59 c -1,3 17,1 23,3 4,0 6,8 4,9 -3,1 -16,3 -24,0 -6,-3 -4,-7 -3,-12 z" style="fill:#800"/><path d="m 135,59 c 1,3 -17,1 -23,3 -4,0 -6,8 -4,9 3,0 16,1 24,0 6,-3 4,-7 3,-12 z" style="fill:#800"/><rect x="51" y="62" width="46" height="9" style="fill:#fff;fill-opacity:0.7;"/><path d="m 30,41 c 1,-5 2,-9 12,-21 20,-1 42,-1 68,0 4,7 9,13 10,21 z" style="fill:#222"/><path d="m 27,50 3,-9"/><path d="m 124,50 -4,-9"/></g></svg>').replace(/#eee/g,
a[0]).replace(/#ddd/g,a[1]).replace(/#ccc/g,a[2]).replace(/#aaa/g,a[3]);return jb+btoa(c)}function Cb(){var a=p.createElement("canvas");a.width=1290;a.height=1470;var b=a.getContext("2d"),c=b.createLinearGradient(0,0,0,485),g=b.createLinearGradient(5,495,5,975);c.addColorStop(.15,ja);c.addColorStop(.5,ka);c.addColorStop(1,la);b.fillStyle=c;b.beginPath();b.moveTo(5,485);b.lineTo(1285,485);b.lineTo(1285,120);b.bezierCurveTo(1100,180,1100,80,1E3,90);b.bezierCurveTo(900,100,900,130,800,140);b.bezierCurveTo(700,
150,700,85,650,85);b.bezierCurveTo(600,85,600,90,580,100);b.bezierCurveTo(560,110,460,30,390,40);b.bezierCurveTo(320,50,310,120,250,130);b.bezierCurveTo(190,140,190,60,5,120);b.closePath();b.fill();g.addColorStop(0,da);g.addColorStop(.4,"#fff");b.fillStyle=g;b.beginPath();b.moveTo(5,495);b.lineTo(5,975);b.lineTo(1285,975);b.lineTo(1285,495);b.closePath();b.fill();b.fillStyle="#fff";b.beginPath();b.arc(180,535,10,0,2*l.PI);b.arc(200,530,20,0,2*l.PI);b.arc(210,520,15,0,2*l.PI);b.arc(220,530,15,0,2*
l.PI);b.closePath();b.fill();b.beginPath();b.arc(380,545,10,0,2*l.PI);b.arc(400,540,20,0,2*l.PI);b.arc(410,530,10,0,2*l.PI);b.arc(420,540,15,0,2*l.PI);b.arc(430,540,10,0,2*l.PI);b.closePath();b.fill();b.beginPath();b.arc(680,545,10,0,2*l.PI);b.arc(695,540,20,0,2*l.PI);b.arc(710,535,15,0,2*l.PI);b.arc(720,540,15,0,2*l.PI);b.closePath();b.fill();b.beginPath();b.arc(980,555,10,0,2*l.PI);b.arc(1E3,550,20,0,2*l.PI);b.arc(1010,555,15,0,2*l.PI);b.closePath();b.fill();b.fillStyle=va;b.beginPath();b.moveTo(5,
1175);b.lineTo(5,1465);b.lineTo(1285,1465);b.lineTo(1285,1175);c=1175;for(g=1285;5<g;g--)c+=N(2*l.random()-1-(c-1175)/g),b.lineTo(g,c);b.closePath();b.fill();return a}function Db(a,b){for(var c=[],g=a.length,e=function(){0==--g&&b(c)},f=0;f<a.length;f++){var h=a[f];c[f]=p.createElement("img");c[f].onload=e;c[f].src=h}}function kb(){var a=p.documentElement,b=a.clientWidth,a=a.clientHeight,a=b/a>x/z?a/z:b/x;var c=fa.style;c.transform="scale("+a+")";c.top=(a-1)*z/2+"px";c.left=(a-1)*x/2+(b-x*a)/2+"px";
c.display="block"}function Eb(a){var b,c=P(E+K),g=pa.w*J;var e=A/I;var f=2*a*e;var h=E;for(b=0;b<za.length;b++){var m=za[b];var k=P(m.z);var d=m;var t=d.o;a:{var v=m;var n=k,x=c,q=g,V,y=void 0,r=void 0,z=v.sprite.w*J;if(n.n-x.n>ga)v=0;else{for(V=1;20>V;V++){var B=u[(n.n+V)%u.length];if(B===x&&v.speed>A&&na(H,q,v.o,z,1.2)){var p=.5<H?-1:-.5>H?1:v.o>H?1:-1;v=1*p/V*(v.speed-A)/I;break a}for(p=0;p<B.cars.length;p++)if(y=B.cars[p],r=y.sprite.w*J,v.speed>y.speed&&na(v.o,z,y.o,r,1.2)){p=.5<y.o?-1:-.5>y.o?
1:v.o>y.o?1:-1;v=1*p/V*(v.speed-y.speed)/I;break a}}v=-.9>v.o?.1:.9<v.o?-.1:0}}d.o=t+v;m.z=Q(m.z,a*m.speed,R);m.percent=m.z%C/C;d=P(m.z);k!=d&&(t=k.cars.indexOf(m),k.cars.splice(t,1),d.cars.push(m))}E=Q(E,a*A,R);W?H-=f:X&&(H+=f);H-=f*e*c.curve*Fb;A=ha?A+Gb*a:ia?A+Hb*a:A+Ib*a;if(-1>H||1<H)for(A>Jb&&(A+=lb*a),e=0;e<c.s.length;e++)if(f=c.s[e],b=f.source.w*J,na(H,g,f.o+b/2*(0<f.o?1:-1),b)){A>I/4&&Xa();A=I/5;E=Q(c.p1.w.z,-K,R);break}for(e=0;e<c.cars.length;e++)if(f=c.cars[e],b=f.sprite.w*J,A>f.speed&&na(H,g,
f.o,b,.8)){A=f.speed/A*f.speed;E=Q(f.z,-K,R);Xa();break}H=l.max(-3,l.min(H,3));A=l.max(0,l.min(A,I));mb(A/I);Oa=Q(Oa,nb*c.curve*(E-h)/C,1);Pa=Q(Pa,ob*c.curve*(E-h)/C,1);Qa=Q(Qa,pb*c.curve*(E-h)/C,1);Ra+=a;if(E>K&&h<K&&(Aa++,Aa>Y))return Aa=Y,!0}function qb(a){var b=G(a/60),c=G(a-60*b);a=G(10*(a-G(a)));10>b&&(b=" "+b);return b+":"+(10>c?"0":"")+c+"."+a}function rb(){var a=P(E),b=E%C/C,c=P(E+K),g=(E+K)%C/C,e=c.p1.w.y+(c.p2.w.y-c.p1.w.y)*g;var f=z;var h=0,m=-(a.curve*b);B.clearRect(0,0,x,z);Ja(B,Ba,
x,z,Kb,Oa,S*nb*e);Ja(B,Ba,x,z,Lb,Pa,S*ob*e);Ja(B,Ba,x,z,Mb,Qa,S*pb*e);for(var k,d,b=0;b<ga;b++)if(k=u[(a.n+b)%u.length],k.looped=k.n<a.n,k.f=1/l.pow(l.E,b/ga*(b/ga)*Nb),k.clip=f,$a(k.p1,H*M-h,e+Sa,E-(k.looped?R:0),T,x,z,M),$a(k.p2,H*M-h-m,e+Sa,E-(k.looped?R:0),T,x,z,M),h+=m,m+=k.curve,!(k.p1.c.z<=T||k.p2.s.y>=k.p1.s.y||k.p2.s.y>=f)){var t=B;var v=x;var n=Ob;var q=k.p1.s.x;d=k.p1.s.y;var p=k.p1.s.w,r=k.p2.s.x;var y=k.p2.s.y;var w=k.p2.s.w;f=k.f;var D=k.c,F=p/l.max(6,2*n),G=w/l.max(6,2*n),J=p/l.max(32,
8*n),L=w/l.max(32,8*n);t.fillStyle=D.g;t.fillRect(0,y,v,d-y);oa(t,q-p-F,d,q-p,d,r-w,y,r-w-G,y,D.R);oa(t,q+p+F,d,q+p,d,r+w,y,r+w+G,y,D.R);oa(t,q-p,d,q+p,d,r+w,y,r-w,y,D.r);if(D.l)for(F=2*p/n,G=2*w/n,p=q-p+F,r=r-w+G,w=1;w<n;p+=F,r+=G,w++)oa(t,p-J/2,d,p+J/2,d,r+L/2,y,r-L/2,y,D.l);n=d;d=y-d;1>f&&(t.globalAlpha=1-f,t.fillStyle=ua,t.fillRect(0,n,v,d),t.globalAlpha=1);f=k.p1.s.y}for(b=ga-1;0<b;b--){k=u[(a.n+b)%u.length];for(e=0;e<k.cars.length;e++)d=k.cars[e],h=k.p1.s.s+(k.p2.s.s-k.p1.s.s)*d.percent,m=k.p1.s.x+
(k.p2.s.x-k.p1.s.x)*d.percent+h*d.o*M*x/2,f=k.p1.s.y+(k.p2.s.y-k.p1.s.y)*d.percent,Ka(B,x,z,S,M,Ca,d.sprite,h,m,f,-.5,-1,k.clip);for(e=0;e<k.s.length;e++)d=k.s[e],h=k.p1.s.s,m=k.p1.s.x+h*d.o*M*x/2,f=k.p1.s.y,Ka(B,x,z,S,M,Ca,d.source,h,m,f,0>d.o?-1:0,-1,k.clip);k==c&&(k=B,e=x,h=z,m=S,f=M,d=Ca,q=A/I,y=T/K,v=x/2,t=z/2-T/K*(c.p1.c.y+(c.p2.c.y-c.p1.c.y)*g)*z/2,n=A*(W?-1:X?1:0),q=1.5*l.random()*q*m*ba([-1,1]),Ka(k,e,h,m,f,d,0>n?ab:0<n?bb:pa,y,v,t+q,-.5,-1))}B.font="12px monospace";B.fillStyle="#000";B.fillText((" "+
5*N(A/500)+" mph").slice(-7),10,15);B.fillText(qb(Ra),x/2-30,15);B.fillText("Lap "+Aa+" of "+Y,x-80,15)}function P(a){return u[G(a/C)%u.length]}function Ta(){return 0==u.length?0:u[u.length-1].p2.w.y}function Ua(a,b){var c=u.length;u.push({n:c,p1:{w:{y:Ta(),z:c*C},c:{},s:{}},p2:{w:{y:b,z:(c+1)*C},c:{},s:{}},curve:a,s:[],cars:[],c:G(c/sb)%2?xa:wa})}function n(a,b,c,g,e){var f=Ta();e=f+Za(e,0)*C;var h,m=a+b+c;for(h=0;h<a;h++)Ua(0+(g-0)*l.pow(h/a,2),ma(f,e,h/m));for(h=0;h<b;h++)Ua(g,ma(f,e,(a+h)/m));
for(h=0;h<c;h++)Ua(ma(g,0,h/c),ma(f,e,(a+b+h)/m))}function U(a){a=a||q;n(a,a,a,0,0)}function Da(a,b){a=a||q;b=b||Z;n(a,a,a,0,b)}function D(a,b,c){a=a||q;b=b||w;c=c||Va;n(a,a,a,b,c)}function tb(a,b){a=a||ub;b=b||Ea;n(a,a,a,0,b/2);n(a,a,a,0,-b);n(a,a,a,aa,b);n(a,a,a,0,0);n(a,a,a,-aa,b/2);n(a,a,a,0,0)}function Wa(){n(q,q,q,-aa,Va);n(q,q,q,w,Z);n(q,q,q,aa,-Ea);n(q,q,q,-aa,Z);n(q,q,q,-w,-Z)}function Fa(){n(10,10,10,0,5);n(10,10,10,0,-2);n(10,10,10,0,-5);n(10,10,10,0,8);n(10,10,10,0,5);n(10,10,10,0,-7);
n(10,10,10,0,5);n(10,10,10,0,-2)}function vb(a){a=a||200;n(a,a,a,-aa,-Ta()/C)}function wb(){U(ub);tb();Wa();D(q,w,Ea);Fa();tb();D(2*L,w,Z);U();Da(q,xb);Wa();D(L,-w,Va);Da(L,xb);D(L,w,-Ea);Fa();Da(L,-Z);U();Wa();vb();Y=2}function Pb(a){u=[];0===a?wb():1===a?(U(L),Fa(),U(L),D(0,-w),D(0,-w),Da(),D(0,-w),D(0,-w),U(L),Fa(),U(L),D(0,-w),D(0,-w),vb(),Y=4):(wb(),Y=1);for(a=0;a<u.length;a+=N(u.length/(20*yb))){var b=a+u.length;var c=N;var g=l.random();b=(b+c(-5+10*g))%u.length;c=ba(ca);g=ba([1,-1])*(1+2*l.random());
u[b].s.push({source:c,o:g})}za=[];for(a=0;a<Qb;a++){b=l.random()*ba([-.8,.8]);c=G(l.random()*u.length)*C;g=ba(Na);var e=I/4+l.random()*I/2;b={o:b,z:c,sprite:g,speed:e};c=P(b.z);c.cars.push(b);za.push(b)}u[P(K).n+2].c=ea;u[P(K).n+3].c=ea;for(a=0;a<sb;a++)u[u.length-1-a].c=ya;R=u.length*C}function Rb(a){var b=function(b,g){var c;for(c=0;c<a.length;c++){var f=a[c];f.k==b&&f.m==g&&f.a()}};p.onkeydown=function(a){b(a.keyCode,"d")};p.onkeyup=function(a){b(a.keyCode,"u")}}function Sb(){var a=!1,b=!1;F.ontouchstart=
function(c){c=c.changedTouches[0];var g=c.identifier+"";2*c.pageX<p.documentElement.clientWidth?b=g:a=g;ha=!!a;ia=!!b};F.ontouchend=F.ontouchcancel=function(c){c=c.changedTouches[0].identifier+"";b===c&&(b=!1);a===c&&(a=!1);ha=!!a;ia=!!b};F.ondeviceorientation=function(a){X=W=!1;-5>=a.beta?W=!0:5<=a.beta&&(X=!0)}}function Tb(a,b,c){function g(){e=Date.now();h=l.min(1,(e-f)/1E3);for(m+=h;m>Ga;)if(m-=Ga,Eb(Ga)){rb();mb(-1);B.fillText(Ab(a+"-"+b+"-"+c,qb(Ra))?"New record!":"You did it!",x/2-10,30);zb(function(){location.reload(!1)},
3E3);return}rb();f=e;Ub(g)}Bb(a,b);Ba=Cb();fa.style.backgroundColor=da;fa.width=x;fa.height=z;T=1/l.tan(Vb/2*l.PI/180);K=Sa*T;S=z/320;Pb(c);kb();F.onresize=kb;Rb([{k:37,m:"d",a:function(){W=!0}},{k:39,m:"d",a:function(){X=!0}},{k:38,m:"d",a:function(){ha=!0}},{k:40,m:"d",a:function(){ia=!0}},{k:37,m:"u",a:function(){W=!1}},{k:39,m:"u",a:function(){X=!1}},{k:38,m:"u",a:function(){ha=!1}},{k:40,m:"u",a:function(){ia=!1}}]);Sb();try{navigator.requestWakeLock('screen');}catch(e){}var e=null,f=Date.now(),h=0,m=0;g()}var J,ab,bb,pa,cb,db,eb,fb,qa,ra,sa,
La,gb,Ma,hb,ta,Na,ca,ua,da,va,wa,xa,ea,ya,Ub=F.requestAnimationFrame||F.mozRequestAnimationFrame,r="drawImage",mb=function(){var a=F.AudioContext||F.webkitAudioContext,b=0,c=0;if(!a)return function(){};var a=new a,g=a.createOscillator();g.frequency.value=220;var e=a.createGain();e.gain.value=0;g.connect(e);e.connect(a.destination);g.start();return function(a){if(0>a)c=0;else{g.frequency.value=220*l.pow(2,a);var f=c+10*l.abs(b-a)-.02;c=l.max(0,l.min(f,.5));b=a}e.gain.value=c}}(),Ia="racer-records";
var Lb={x:5,y:5,w:1280,h:480};var Kb={x:5,y:495,w:1280,h:480};var Mb={x:5,y:985,w:1280,h:480};var jb="data:image/svg+xml;base64,",ib='<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="',yb=2,Ga=1/60,x=320,z=240,Fb=.3,lb=.99,nb=.001,ob=.002,pb=.003,Oa=0,Pa=0,Qa=0,u=[],za=[],fa=p.getElementById("c"),B=fa.getContext("2d"),Ba=null,Ca=null,S=null,M=2E3,C=200,sb=3,R=null,Ob=3,Vb=100,Sa=1E3,T=null,ga=300,H=0,K=null,Nb=5,E=0,A=0,I=C/Ga,Gb=I/5,Hb=-I,Ib=-I/5,lb=-I/2,Jb=I/
4,Qb=10*yb,Aa=0,Ra=0,Y=1,W=!1,X=!1,ha=!1,ia=!1,ub=25,q=50,L=100,Va=0,Ea=20,Z=40,xb=60,aa=2,w=4;(function(){function a(){e.textContent=Ya(b.s+"-"+b.c+"-"+b.r)||"\u2014"}var b={s:0,c:0,r:0},c,g;Db([O(0),O(0,1),O(1),O(1,1),O(2),O(2,1),O(3),O(3,1),jb+btoa(ib+'430" height="333"><g fill="#050"><text font-family="sans-serif" x="0" y="117" font-size="117">🌲🌳🎄</text><text font-family="sans-serif" x="0" y="300" font-size="133">🌴</text><text font-family="sans-serif" x="167" y="233" font-size="67">🌵</text></g></svg>')],
function(a){var b=p.createElement("canvas");b.width=1492;b.height=1487;var d=b.getContext("2d"),e=d.createLinearGradient(0,5,0,255);e.addColorStop(0,"#ff0");e.addColorStop(1,"#c80");d.strokeStyle="#000";d.lineWidth=6;d.fillStyle=e;d.rect(5,5,350,250);d.fill();d.moveTo(5,255);d.lineTo(5,285);d.moveTo(355,255);d.lineTo(355,285);d.rect(400,5,350,250);d.fill();d.moveTo(400,255);d.lineTo(400,285);d.moveTo(750,255);d.lineTo(750,285);d.stroke();d.font="100px sans-serif";d.fillStyle="#c00";d.fillText("Fire!",
75,155);d.fillText("Fox!",475,155);d.fillStyle="#ccc";d.beginPath();d.rect(1400,5,30,700);d.fill();e=p.createElement("canvas");e.width=430;e.height=333;e.getContext("2d")[r](a[8],0,0);d[r](e,0,300,1290,999);d[r](a[0],880,0,80,41);d[r](a[1],960,0,80,41);d[r](a[2],880,42,80,41);d[r](a[3],960,42,80,41);d[r](a[4],880,84,80,41);d[r](a[5],960,84,80,41);d[r](a[6],880,126,80,41);d[r](a[7],960,126,80,41);d.scale(-1,1);d[r](a[1],-880,0,80,41);d[r](a[3],-880,42,80,41);d[r](a[5],-880,84,80,41);d[r](a[7],-880,
126,80,41);Ca=b;g&&g();c=1});var e=p.getElementById("t"),f=p.getElementsByTagName("input"),h;for(h=0;h<f.length;h++)f[h].onchange=function(){b[this.name]=+this.value;a()};p.getElementById("g").onclick=function(){p.getElementById("i").style.display="none";g=function(){Tb(b.s,b.c,b.r)};c&&g()};a()})()})(window,localStorage,Math,document,setTimeout,Math.round,Math.floor);</script>