Mandelbrot explorer! Zoom in, zoom out, save locations. Click at any time, don't wait for a render.
function z(){function c(){for(px=0;px<700;px+=s){x=y=i=0;while(x*x+y*y<4&&i<767){xt=x*x-y*y+tx(px);y=2*x*y+ty(py);x=xt;i++}r=(i&7)*32;g=(i&31)*8;b=(i&63)*4;a.fillStyle="rgb("+r+","+g+","+b+")";a.fillRect(px,py,s,s)}py+=s;if(py>=400){py=0;s>>=1}to=s?window.setTimeout(c,0):0}if(to){w.clearTimeout(to)}j.value=cx+","+cy+","+m;s=16;py=0;c()}function ty(a){return m*(a/200-1)+cy}function tx(a){return m*(a/200-1.75)+cx}function ge(a){return n.getElementById(a)}c.width=700;c.height=400;s=c.style;s.position="absolute";w=window;k=w.innerWidth/2-350;t=w.innerHeight/2-200;s.left=k+"px";s.top=t+"px";n=document;d=n.createElement("div");d.innerHTML="Click: in Shift-Click: out<form id='f'><input size=40 id='j'/></form>";s=d.style;s.marginTop="20px";s.textAlign="center";b.appendChild(d);j=ge("j");cx=-.75;cy=to=0;m=1;z();c.onclick=function(a){cx=tx(a.clientX-k);cy=ty(a.clientY-t);m*=a.shiftKey?2:.5;z()};ge("f").onsubmit=function(a){p=j.value.split(",");if(p.length){cx=p[0]-0;cy=p[1]-0;m=p[2]-0}z();return false}
ZnVuY3Rpb24geigpe2Z1bmN0aW9uIGMoKXtmb3IocHg9MDtweDw3MDA7cHgrPXMpe3g9eT1pPTA7d2hpbGUoeCp4K3kqeTw0JiZpPDc2Nyl7eHQ9eCp4LXkqeSt0eChweCk7eT0yKngqeSt0eShweSk7eD14dDtpKyt9cj0oaSY3KSozMjtnPShpJjMxKSo4O2I9KGkmNjMpKjQ7YS5maWxsU3R5bGU9InJnYigiK3IrIiwiK2crIiwiK2IrIikiO2EuZmlsbFJlY3QocHgscHkscyxzKX1weSs9cztpZihweT49NDAwKXtweT0wO3M+Pj0xfXRvPXM/d2luZG93LnNldFRpbWVvdXQoYywwKTowfWlmKHRvKXt3LmNsZWFyVGltZW91dCh0byl9ai52YWx1ZT1jeCsiLCIrY3krIiwiK207cz0xNjtweT0wO2MoKX1mdW5jdGlvbiB0eShhKXtyZXR1cm4gbSooYS8yMDAtMSkrY3l9ZnVuY3Rpb24gdHgoYSl7cmV0dXJuIG0qKGEvMjAwLTEuNzUpK2N4fWZ1bmN0aW9uIGdlKGEpe3JldHVybiBuLmdldEVsZW1lbnRCeUlkKGEpfWMud2lkdGg9NzAwO2MuaGVpZ2h0PTQwMDtzPWMuc3R5bGU7cy5wb3NpdGlvbj0iYWJzb2x1dGUiO3c9d2luZG93O2s9dy5pbm5lcldpZHRoLzItMzUwO3Q9dy5pbm5lckhlaWdodC8yLTIwMDtzLmxlZnQ9aysicHgiO3MudG9wPXQrInB4IjtuPWRvY3VtZW50O2Q9bi5jcmVhdGVFbGVtZW50KCJkaXYiKTtkLmlubmVySFRNTD0iQ2xpY2s6IGluIFNoaWZ0LUNsaWNrOiBvdXQ8Zm9ybSBpZD0nZic+PGlucHV0IHNpemU9NDAgaWQ9J2onLz48L2Zvcm0+IjtzPWQuc3R5bGU7cy5tYXJnaW5Ub3A9IjIwcHgiO3MudGV4dEFsaWduPSJjZW50ZXIiO2IuYXBwZW5kQ2hpbGQoZCk7aj1nZSgiaiIpO2N4PS0uNzU7Y3k9dG89MDttPTE7eigpO2Mub25jbGljaz1mdW5jdGlvbihhKXtjeD10eChhLmNsaWVudFgtayk7Y3k9dHkoYS5jbGllbnRZLXQpO20qPWEuc2hpZnRLZXk/MjouNTt6KCl9O2dlKCJmIikub25zdWJtaXQ9ZnVuY3Rpb24oYSl7cD1qLnZhbHVlLnNwbGl0KCIsIik7aWYocC5sZW5ndGgpe2N4PXBbMF0tMDtjeT1wWzFdLTA7bT1wWzJdLTB9eigpO3JldHVybiBmYWxzZX0=
c.width = 700;
c.height = 400;
s = c.style;
s.position = 'absolute';
w = window;
k = w.innerWidth / 2 - 350;
t = w.innerHeight / 2 - 200;
s.left = k + 'px';
s.top = t + 'px';
n = document;
d = n.createElement('div');
d.innerHTML = "Click: in Shift-Click: out<form id='f'><input size=40 id='j'/></form>";
s = d.style;
s.marginTop = '20px';
s.textAlign = 'center';
b.appendChild(d);
j = ge('j');
function ge(s)
{
return n.getElementById(s);
}
cx = -0.75;
cy = to = 0;
m = 1.0;
function tx(x)
{
return m * (x / 200 - 1.75) + cx;
}
function ty(y)
{
return m * (y / 200 - 1) + cy;
}
function z()
{
if (to)
{
w.clearTimeout(to);
}
j.value = cx + ',' + cy + ',' + m;
s = 16;
py = 0;
rs();
function rs()
{
for (px = 0; (px < 700); px+=s)
{
x = y = i = 0;
while (x*x + y*y < 4 && i < 767)
{
xt = x*x - y*y + tx(px);
y = 2*x*y + ty(py);
x = xt;
i++;
}
r = (i & 7) * 32;
g = (i & 31) * 8;
b = (i & 63) * 4;
a.fillStyle = 'rgb(' + r + ',' + g + ',' + b + ')';
a.fillRect(px, py, s, s);
}
py += s;
if (py >= 400)
{
py = 0;
s >>= 1;
}
to = s ? window.setTimeout(rs, 0) : 0;
}
}
z();
c.onclick = function(e) {
cx = tx(e.clientX - k);
cy = ty(e.clientY - t);
m *= (e.shiftKey ? 2 : 0.5);
z();
};
ge('f').onsubmit = function(e) {
p = j.value.split(',');
if (p.length)
{
cx = p[0] - 0;
cy = p[1] - 0;
m = p[2] - 0;
}
z();
return false;
};