JS1K

#2: the original

Source for demo by antimatter15. See also description.

var c=document.getElementById("c"),e=c.getContext("2d"),g=Math.cos,i=Math.sin;c.width=innerWidth;c.height=innerHeight;var j=c.width/2,k=c.height/2,l=[],m=0,n=0;c.onmousemove=function(d){m=d.clientX;n=d.clientY};(c.onclick=function(d){l=[];d=new Function("x,y","return "+(d?prompt("function","Math.PI*Math.sin(Math.sqrt(x*x+y*y))/Math.sqrt(x*x+y*y)"):"Math.PI*Math.sin(Math.sqrt(x*x+y*y))/Math.sqrt(x*x+y*y)"));for(var f=-10;f<10;f+=0.5)for(var a=-10;a<10;a+=0.5)l.push({x:f*10,y:a*10,a:20*d(f,a)})})();
setInterval(function(){var d=1.0E-4*(m-j),f=g(d);d=i(d);var a=1.0E-4*(n-k),o=g(a),p=i(a),b,h;for(a=l.length;a--;){b=l[a];h=b.a*f+b.x*d;b.x=b.x*f-b.a*d;b.a=h*o+b.y*p;b.y=b.y*o-h*p;h=200/(200+b.a);b.b=j+b.x*h;b.c=k+b.y*h}e.clearRect(0,0,c.width,c.height);if(l.length){e.strokeStyle="rgb(40,50,20)";e.beginPath();e.moveTo(l[0].b,l[0].c);f=l.length;for(a=1;a<f;a++)try{a%40?e.lineTo(l[a].b,l[a].c):e.moveTo(l[a].b,l[a].c)}catch(q){}e.stroke()}e.fillText("Click to edit equation",99,99)},0);