Skip to content

Instantly share code, notes, and snippets.

@xulapp
Created September 10, 2010 11:50
Show Gist options
  • Select an option

  • Save xulapp/573503 to your computer and use it in GitHub Desktop.

Select an option

Save xulapp/573503 to your computer and use it in GitHub Desktop.
innocencer.js1k
<!doctype html>
<html>
<head>
<title>JS1k, 1k demo submission</title>
<meta charset="utf-8" />
</head>
<body>
<canvas id="c"></canvas>
<script type="text/javascript" src="innocencer.js1k.js"></script>
</body>
</html>
a=[];with(document.body.children[0])with(c=getContext('2d')){width=k=1e3;height=320;style.background='#000';onclick=function({layerX:x,layerY:y}){for(var e=new Date%4,b=Math.random(s=Math.sin)*6,r=j=0,d='RIFF$ \0\0WAVEfmt \20\0\0\0\1\0\1\0\0 \0\0\0 \0\0\1\0\10\0data\0 \0\0';j<8192;)d+=String.fromCharCode(128+32*(s(z=j++*(x+99)/652)+s(z*2)));Audio('data:audio/wav,'+escape(d)).play(a.push(function(){save();rotate(e+~translate(x,y)?b:r*.314);beginPath(lineWidth=e?r*4:40-r);restore(stroke(e?e-1?e-2?arc(0,0,r*30,0,7,0):closePath(moveTo(0,r*60)+lineTo(~rotate(2),r*60)+lineTo(~rotate(2),r*60)):rect(-r*30,-r*30,r*60,r*60):moveTo(-k,0)+lineTo(k,0)));++r-40||a.splice(--i,1)}))};strokeStyle='rgba(68,232,176,.5)'}setInterval('for(c.clearRect(i=0,0,k,320);;)a[i++]()',30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment