Skip to content
Newer
Older
100644 22 lines (13 sloc) 1.78 KB
5d04fd8 README now has stuff in't
George Buckenham authored Aug 13, 2010
1 Hello,
2
3 This is a project to make a QR code you can scan and get a playable little JS game running on your phone/compatible device. I want to put this on stickers and sticker them in fun places.
4
68ac11b Working, if crufty
George Buckenham authored Aug 14, 2010
5 To use: python generateQR.py <javascript file>
6
7 The output is something like:
8 1088:21
9 link is javascript:D=document;D.write("<body>");C=D.createElement("canvas");D.body.appendChild(C);a=Math;b=25;s=b*b;c=D.body.children[0];c.width=c.height=s+b;x=c.getContext("2d");x.fillRect(0,0,s,s);x.fillStyle='#fff';f=a.floor;C=function(A){i=f(a.random()*A.length);r=A[i];A.splice(i,1);return(r)};D=function(c,j,J,k,K){x.strokeStyle='rgb(255,'+c+','+c+')';x.beginPath();x.moveTo(j,J);x.lineTo(k,K);x.stroke();c<s&&window.setTimeout(function(){D(c+b,j,J,k,K)},b)};m={'-1':0};p=[0];while(p.length){if(!(m[v=C(p)]||v<0||v>=s)){X=v%b;Y=f(v/b);n=X!=0?[v-1]:[v];n[1]=X!=b-1?v+1:v;n[2]=Y!=0?v-b:v;n[3]=Y!=b-1?v+b:v;m[v]=0;x.fillRect(b*X+3,b*Y+3,V=b-6,V);for(t=[0,1,2,3];t.length;){y=C(t);if(m[n[y]]){t=[];U=(y<2)?6:V;x.fillRect(b*X+3+((y==1)?V:(y==0)?-6:0),b*Y+3+((y==3)?V:(y==2)?-6:0),U,b-U)}}m[v]=1;p=p.concat(n)}}x.lineWidth=5;x.lineCap='round';d=u=v=f(b/2);X=a.min;Y=a.abs;Z=a.max;window.setInterval(function(){U=(d%2)?(d-2)*b:0;V=(d%2)?0:(d-1)*b;p=x.getImageData(Z(0,X(u,u+U)),Z(0,X(v,v+V)),Y(U)+1,Y(V)+1).data;for(i=1,m=255;i<p.length;m=X(m,p[i]),i+=4){}d=(d+1+2*!m)%4;m&&D(5,u,v,u+=U,v+=V)},b);
10 qrbf90fe6078712a86f0f224372196853a.png
11
12 The first line shows the number of characters in the code and the module level of the QR code
13 The second shows the text embedded within the QR code
14 The third shows the filename saved to (format qr<data hash>.png)
15
16 Also, if you have feh installed, it will display the QR code fullscreen. "Esc" to quit.
17
18 maze.js is modified from http://js1k.com/demo/162 - thanks to Will Scott (@willscott)
5d04fd8 README now has stuff in't
George Buckenham authored Aug 13, 2010
19
20
21 Have fun!
Something went wrong with that request. Please try again.