🏠 Games Tutorials Dev blog JS code golf Other projects

MiniFourier

February 2018

An interactive 2D Fourier (2D FFT) tracer, submitted to JS1k 2018.

- Github

- Demo

- Commented source code

- making-of

<body id=b style=margin:0>
<canvas id=a width=522 height=256></canvas>
<script>
c = a.getContext`2d`;
d = document;
b = d.body;
for(_="[j]~e~R=0;Qfor(PPLQL<On-N),JNL-1JIvalueH]=GGd[F+3FE+2FC4*(Be.A)}@,n%[L$n/2u[-y]'#fff''#000'n;](=ApageXX,YYc[c.;fc+1F[i],f);PiQi<i++)PyQy<;yBy*n+0,0%onmouse=B(Ny-1)*n+	><input type=r=Math.[j+h][y]=(e)=>$]=[];y]OLPL in c)c$[0]+$[6]]GL;d.write`<pange H=9 id=xeset up=fyG%q()>`;g{{jQh=i;Pk=k>>=1;h>>=1)j=j<<1|h&1;j>i&&([R,e~G[e,R~]@Ph=1;2*h<=h*=2)+=2*h)Pj=i;j<i+h;jk=3.1Bj-i)/h,lcos(kJmsin(kJo=e*l+f*m,p=-e*m+f*l,e=R-o=f~-p,R+=o~+=p};q{T=gg%d=T.data;rsuPy=tQy<y{rs[o move and R to restart a puzzle. Can you beat the r=d[L)],sQg(r,s@vw{v=v[Ny]w=w[Nv=r$],w=s$];g(v,wu=u[Nuhypot(v,wJtmax(t,u@Slog(tO;LU=LJD=IK	LJM	I&&(d[UFUUCDFDDCKFKKCMFMM+2G[-L]/SJd[UEDEKEM+3GpgT%+9,0@=256%fyG120,120,16,16q(X=Y=bQa.down=a.move{Abuttons?(ldG+x.H+1,b=b||Awhich,lpGAaltKey?`square`:`round`,sSGb<3?:,lX,YJl+1Jc.stroke(Jq()):(baJ,b=0@;oncontextmenuApreventDefault()";G=/[^ #&-?DK-MS-}]/.exec(_);)with(_.split(G))_=join(shift());eval(_)
</script>