-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
eliminated 2 letter variables fix road width bug move object collision check
- Loading branch information
1 parent
ebb62f2
commit 8cdfc12
Showing
3 changed files
with
19 additions
and
17 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<body style=margin:0 onload="P=1e5;t=(t,i=0,n=0,e=1)=>`hsl(${n+m},${i}%,${t}%,${e})`;i=(t,i)=>t<i?t:i;n=(t,i)=>t>i?t:i;e=(t,e,h)=>e+i(n(t,0),1)*(h-e);h=t=>(t+Math.PI)%(2*Math.PI)+(0>t+Math.PI?Math.PI:-Math.PI);o=(t=1,i=0)=>e(1e5*(Math.sin(++b)+1)%1,i,t);function a(t=0,i=0,n=0){this.x=t,this.y=i,this.z=n}d=(t,i)=>new a(t.x+(i<P?i:i.x),t.y+(i<P?i:i.y),t.z+(i<P?i:i.z));w=(t,i)=>new a(t.x*(i<P?i:i.x),t.y*(i<P?i:i.y),t.z*(i<P?i:i.z));z=(t,i,n,e,h,o,a)=>{B.beginPath(B.fillStyle=a),B.lineTo(t-n|0,0|i),B.lineTo(t+n|0,0|i),B.lineTo(e+o|0,0|h),B.fill(B.lineTo(e-o|0,0|h))};ct=new a(window.innerWidth/2);for(onmousedown=e=>r=1,onmouseup=e=>r=0,onmousemove=t=>ct=t,x=new a(J=u=m=B=L=E=r=s=f=j=K=N=0),p=v=b=Date.now(g=[]),F=R=500;P>N;++N)I=Math.sin(N*B)*J,S=Math.sin(N*E)*K,W=i(n(L/j,0),1),g[N]=g[N]?g[N]:{x:I,y:S,a:F},g[N].x=e(W,g[N].x,I),g[N].y=e(W,g[N].y,S),g[N].z=100*N,g[N].a=N>1e4?0:e(W,g[N].a,F),g[N].b=g[N-1]?Math.atan2(g[N-1].y-g[N].y,100):0,L++>R&&(F=500*o(1-.7*(k=i(1,100*N/P/9)),3-2*k),B=o(e(k,.01,.02)),E=o(e(k,.01,.03)),J=N>1e4?0:o(e(k,.2,.5)),K=o(e(k,1e3,2e3)),L=0,l=R=(j=0|o(99,500))+o(99,500),N-=j);y=new a(g[0].x,g[0].y+150),f=g[0].b,k=O=>{B=c.getContext`2d`;c.width=window.innerWidth,c.height=window.innerHeight,V=e(U=y.z/100%1,g[Q=0|y.z/100].x,g[Q+1].x),X=e(U,g[Q].y,g[Q+1].y)+150,Y=e(U,g[Q].b,g[Q+1].b),Z=d(x,0),x.y--,x.x*=.7,x.z=p?n(0,.999*x.z):0,y=d(y,x),T=(ct.x/c.width*2-1)*e(x.z/300,.2,0),x.x+=T*x.z-.002*x.z**2*V,y.x=i(n(y.x,-2e3),2e3),y.y<X&&(y.y=X,x=d(w(new a(J=0,Math.cos(Y),Math.sin(Y)),-1.2*(Math.cos(Y)*x.y+Math.sin(Y)*x.z)),x),x.z+=r?-3:e(x.z/300,1,0),Math.abs(y.x)>g[Q].a&&(x.z*=.98,s+=Math.sin(y.z/99)**4/99)),J++<6&r&&K&&K<9&&p?x.y=25:K=r?0:K+1,G=(y.y-X)/99,u+=e(G,0,x.y/4e4),u+=(x.z-Z.z)/2e3,u-=.01*s,s+=u*=.9,f=e(.1,f,e(G,-Y,0)),M=s+f,nt=w(new a(1,-1,1),c.width/2),b=v,l=h(l+x.z*V*5e-5),$=2*T,_=Math.sin($)/2,tt=Math.cos(l),it=c.height/2-Math.tan(M)*nt.y,(A=B.createLinearGradient(0,it-c.height/2,0,it)).addColorStop(0,t(39+25*tt,49+19*tt,230-19*tt)),A.addColorStop(1,t(5,79,250-9*tt)),z(c.width/2,0,c.width/2,c.width/2,c.height,c.width/2,A);for(N=2;N--;z(c.width/2,0,c.width/2,c.width/2,c.height,c.width/2,A))A=B.createRadialGradient(I=c.width*(.5+e((l/Math.PI/2+.5+N/2)%1,4,-4)-_),S=it-c.height/3,c.width/25,I,S,N?c.width/23:c.width),A.addColorStop(0,t(N?70:99)),A.addColorStop(1,t(0,0,0,0));for(N=30;N--;)G=h(l+o(19)),ot=Math.cos(G-l),z(I=c.width*(.5+e(G/Math.PI/2+.5,4,-4)-_),S=it,F=o(.2,.8)**2*c.height,I+F*o(-.5,.5),S-o(.5,.8)*F,0,t(o(15,25)+N/3-9*ot,N/2+o(19),o(220,230)));for(z(c.width/2,it,c.width/2,c.width/2,c.height,c.width/2,t(25,30,95)),I=F=N=0;801>N;)W=d(new a(I+=F+=g[Q+N].x,g[Q+N].y,g[Q+N].z),w(y,-1)),W.x=W.x*Math.cos($)-W.z*Math.sin($),C=1/(W.z*Math.cos(M)-W.y*Math.sin(M)),W.y=W.y*Math.cos(M)-W.z*Math.sin(M),W.z=C,g[Q+N++].p=d(w(w(W,new a(C,C,1)),nt),new a(c.width/2,c.height/2));for(N=800,ht=g[Q+N];N--;)et=g[Q+N],b=v+Q+N,ot=Math.sin(et.b)*Math.cos(l)*99,q=et.p,D=ht.p,C=(o(2)|0)*400,(H=.2<o()?0:o(1e4,-1e4)*o(9))&&!et.c&&200>Math.abs(y.x-H)&&200>Math.abs(y.z+99-et.z)&&y.y<et.y+300+C&&(x=w(x,et.c=.1)),0<q.z&&P>q.z&&(0==N%(0|e(N/800,1,9))&&(z(c.width/2,q.y,c.width/2,c.width/2,D.y,c.width/2,t(25+ot,30,95)),400<et.a&&z(q.x,q.y,q.z*(et.a+150),D.x,D.y,D.z*(ht.a+150),t((9>(N+Q)%19?50:20)+ot)),z(q.x,q.y,q.z*et.a,D.x,D.y,D.z*ht.a,t((500>et.z%P?70:7)+ot)),300<et.a&&0==(N+Q)%9&&N<800/3&&z(q.x,q.y,9*q.z,D.x,D.y,9*D.z,t(70+ot)),ht=et),H&&(G=e(N/800,4,0),C?(z(I=q.x+q.z*H,q.y,29*q.z,I,q.y-99*q.z,29*q.z,t(o(9)+5,50+o(9),29+o(9),G)),z(I,q.y-o(50,99)*q.z,q.z*o(199,250),I,q.y-o(600,800)*q.z,0,t(o(9)+25,80+o(9),9+o(29),G))):z(I=q.x+q.z*H,q.y,q.z*o(200,250),I+q.z*o(99,-99),q.y-o(200,250)*q.z,q.z*o(99),t(o(9)+55,30+o(9),209+o(9),G))));y.z>P&&(p+=10,P+=1e5,m+=40),p=i(n(p-1/60,0),20),B.font=`7em'`,B.fillStyle=t(99,0,0,.5),B.fillText(p.toFixed(2),9,89),B.strokeText(p.toFixed(2),9,89),B.textAlign=`right`,B.fillText(y.z/1e3|0,c.width-9,89),B.strokeText(y.z/1e3|0,c.width-9,89),requestAnimationFrame(k)};k()"><canvas id=c> | ||
<body style=margin:0 onload="P=1e5;t=(t,i=0,n=0,e=1)=>`hsl(${n+m},${i}%,${t}%,${e})`;i=(t,i)=>t<i?t:i;n=(t,i)=>t>i?t:i;e=(t,e,h)=>e+i(n(t,0),1)*(h-e);h=t=>(t+Math.PI)%(2*Math.PI)+(0>t+Math.PI?Math.PI:-Math.PI);o=(t=1,i=0)=>e(1e5*(Math.sin(++b)+1)%1,i,t);function a(t=0,i=0,n=0){this.x=t,this.y=i,this.z=n}d=(t,i)=>new a(t.x+(i<P?i:i.x),t.y+(i<P?i:i.y),t.z+(i<P?i:i.z));w=(t,i)=>new a(t.x*(i<P?i:i.x),t.y*(i<P?i:i.y),t.z*(i<P?i:i.z));z=(t,i,n,e,h,o,a)=>{B.beginPath(B.fillStyle=a),B.lineTo(t-n|0,0|i),B.lineTo(t+n|0,0|i),B.lineTo(e+o|0,0|h),B.lineTo(e-o|0,0|h),B.fill()};O=window.innerWidth/2;for(onmousedown=e=>r=1,onmouseup=e=>r=0,onmousemove=t=>O=t.x,x=new a(J=u=m=B=L=E=r=s=f=j=K=N=0),p=v=b=Date.now(g=[]),F=R=500;P>N;++N)I=Math.sin(N*B)*J,S=Math.sin(N*E)*K,W=i(n(L/j,0),1),g[N]=g[N]?g[N]:{x:I,y:S,a:F},g[N].x=e(W,g[N].x,I),g[N].y=e(W,g[N].y,S),g[N].z=100*N,g[N].a=N>1e4?0:e(W,g[N].a,F),g[N].b=g[N-1]?Math.atan2(g[N-1].y-g[N].y,99):0,g[N].o=.2<o()?0:o(1e4,-1e4)*o(9),L++>R&&(F=500*o(1-.7*(k=i(1,N/9e3)),3-2*k),B=o(e(k,.01,.02)),E=o(e(k,.01,.03)),J=N>1e4?0:o(e(k,.2,.5)),K=o(e(k,1e3,2e3)),L=0,l=R=(j=0|o(99,500))+o(99,500),N-=j);y=new a(g[0].x,g[0].y+150),f=g[0].b,k=L=>{c.width=window.innerWidth,c.height=window.innerHeight,V=e(U=y.z/100%1,g[Q=0|y.z/100].x,g[Q+1].x),X=e(U,g[Q].y,g[Q+1].y)+150,Y=e(U,g[Q].b,g[Q+1].b),Z=d(x,0),x.y--,x.x*=.7,x.z=p?n(0,.999*x.z):0,y=d(y,x),T=(O/c.width*2-1)*e(x.z/300,.2,0),x.x+=T*x.z-.002*x.z**2*V,y.x=i(n(y.x,-2e3),2e3),y.y<X&&(y.y=X,x=d(w(new a(J=0,Math.cos(Y),Math.sin(Y)),-1.2*(Math.cos(Y)*x.y+Math.sin(Y)*x.z)),x),x.z+=r?-3:e(x.z/300,1,0),Math.abs(y.x)>g[Q].a&&(x.z*=.98,s+=Math.sin(y.z/99)**4/99)),J++<6&r&&K&&K<9&&p?x.y=25:K=r?0:K+1,G=(y.y-X)/99,u+=e(G,0,x.y/4e4),u+=(x.z-Z.z)/2e3,u-=.01*s,s+=u*=.9,f=e(.1,f,e(G,-Y,0)),M=s+f,L=w(new a(1,-1,1),c.width/2),b=v,l=h(l+x.z*V*5e-5),$=2*T,_=Math.sin($)/2,j=Math.cos(l),R=c.height/2-Math.tan(M)*L.y,(A=B.createLinearGradient(0,R-c.height/2,0,R)).addColorStop(0,t(39+25*j,49+19*j,230-19*j)),A.addColorStop(1,t(5,79,250-9*j)),z(c.width/2,0,c.width/2,c.width/2,c.height,c.width/2,A);for(N=2;N--;z(c.width/2,0,c.width/2,c.width/2,c.height,c.width/2,A))A=B.createRadialGradient(I=c.width*(.5+e((l/Math.PI/2+.5+N/2)%1,4,-4)-_),S=R-c.height/3,c.width/25,I,S,N?c.width/23:c.width),A.addColorStop(0,t(N?70:99)),A.addColorStop(1,t(0,0,0,0));for(N=30;N--;)G=h(l+o(19)),j=Math.cos(G-l),z(I=c.width*(.5+e(G/Math.PI/2+.5,4,-4)-_),S=R,F=o(.2,.8)**2*c.height,I+F*o(-.5,.5),S-o(.5,.8)*F,0,t(o(15,25)+N/3-9*j,N/2+o(19),o(220,230)));for(z(c.width/2,R,c.width/2,c.width/2,c.height,c.width/2,t(25,30,95)),I=F=N=0;801>N;)W=d(new a(I+=F+=g[Q+N].x,g[Q+N].y,g[Q+N].z),w(y,-1)),W.x=W.x*Math.cos($)-W.z*Math.sin($),C=1/(W.z*Math.cos(M)-W.y*Math.sin(M)),W.y=W.y*Math.cos(M)-W.z*Math.sin(M),W.z=C,g[Q+N++].p=d(w(w(W,new a(C,C,1)),L),new a(c.width/2,c.height/2));for(N=800,E=g[Q+N];N--;)L=g[Q+N],b=v+Q+N,j=Math.sin(L.b)*Math.cos(l)*99,q=L.p,D=E.p,0<q.z&&P>q.z&&(0==N%(0|e(N/800,1,9))&&(z(c.width/2,q.y,c.width/2,c.width/2,D.y,c.width/2,t(25+j,30,95)),400<L.a&&z(q.x,q.y,q.z*(L.a+150),D.x,D.y,D.z*(E.a+150),t((9>(N+Q)%19?50:20)+j)),z(q.x,q.y,q.z*L.a,D.x,D.y,D.z*E.a,t((500>L.z%P?70:7)+j)),300<L.a&&0==(N+Q)%9&&N<266&&z(q.x,q.y,9*q.z,D.x,D.y,9*D.z,t(70+j)),E=L),L.o&&(C=(o(2)|0)*400,!L.h&&200>Math.abs(y.x-L.o)&&200>Math.abs(y.z+99-L.z)&&y.y<L.y+300+C&&(x=w(x,L.h=.1)),G=e(N/800,4,0),C?(z(I=q.x+q.z*L.o,q.y,29*q.z,I,q.y-99*q.z,29*q.z,t(o(9)+5,50+o(9),29+o(9),G)),z(I,q.y-o(50,99)*q.z,q.z*o(199,250),I,q.y-o(600,800)*q.z,0,t(o(9)+25,80+o(9),9+o(29),G))):z(I=q.x+q.z*L.o,q.y,q.z*o(200,250),I+q.z*o(99,-99),q.y-o(200,250)*q.z,q.z*o(99),t(o(9)+55,30+o(9),209+o(9),G))));y.z>P&&(p+=10,P+=1e5,m+=40),p=i(n(p-1/60,0),20),B.font=`7em'`,B.fillStyle=t(99,0,0,.5),B.fillText(p.toFixed(2),9,89),B.strokeText(p.toFixed(2),9,89),B.textAlign=`right`,B.fillText(y.z/1e3|0,c.width-9,89),B.strokeText(y.z/1e3|0,c.width-9,89),requestAnimationFrame(k)};k(B=c.getContext`2d`)"><canvas id=c> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters