Mouse over water to draw land. Click to export/save island. Drag and drop saved file to load island.
for(_='c[c.~~fy]=|)}zon`z;`dr_25^/^Wx[iW]VJSON.Ur[nLreK&&Ifor(He(G+1E],C){B];^*Math.:floor(b.pagedatafc #=0;;i+=^)H,1functi`(bB~ta](0,G{x2,=^2==~gg](),~fc](Ct==s?itt<w;t+=aba234 # ).[2]);random()Hii<h==bI=b.pKventDefault()|A[^)V[tW]Hi in c)c[i[0]+i[6]]=i;r=[--4,6,8,-6,4-6,68,-4,4,2-3A="#f4edc4 #73de5fca 4ac2 36bddfd995".split(" "w=a.width;h=a.height;`click=(Bx=[-12V=[CtEiE2?0:1;open(":text/js`;,"+Ustringify(x)z;6w,h Gb,d,gBif(4!=bBc.savGd.x,d.yb?(1^,02^,^3^c.rotatG1.57*b)):(7C^,^)po=3.14*(1.5+.5*bvar k=d.xE2+cos(pol=d.yE2+sin(popk,l;0,,2Hmm<(2==b?4:3B2mHnn<r.length;)pILCLECL+2C2n+=3;m++}~K](GbE,d,g!pIgIkWylWz,0z};i+=10)Hs=1,10)2:i-12|.2>?A[1]:A[4-2:i-42s*=-1;`mousemove=XWyYWz_op;f=b.Transfer.files[0v=new FileReader;v.`load=(BKturn x=UparsGb.target.KsultI:t,y:i}z}(fv.KadAsText(f_agover};';G=/[^ -ADFJM-TX-\]a-y{}]/.exec(_);)with(_.split(G))_=join(shift());eval(_)
Zm9yKF89J2NbYy5+fmZ5XT18KX16b25gejtgZHJfMjVeL15XeFtpV11WSlNPTi5VcltuTHJlSyYmSWZvcihIZShHKzFFXSxDKXtCXTsfXipNYXRoLh46HmZsb29yKB0dYi5wYWdlHGRhdGEbZmMgIxo9MDsZO2krPV4pSBgsMRdmdW5jdGlgFhYoYkIVfnRhXSgUMCwTRxN7eBIyLBE9XjI9PX5nZ10oECksD35mY10oDkMOdBc9PXM/aQx0GXQ8dzt0Kz0LGmFiYTIzNCAjCRcXKS4bWzJdCCk7Bx5yYW5kb20oKQZIaRlpPGgFPT1iSRQEPR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, 12, -6, 6, 18, -4, 4, 22, -2, 3];
z = ['#f4edc4', '#73defc', '#5fcafc', '#aba234', '#4ac2fc', '#aba234', '#36bdfc', '#dfd995'];
//z = water blending was l1
//x = load and save array
//y = land function
//v = reader
//r = land shading
//t,i, m,n= loops
w = a.width;
h = a.height;
onclick = function() {
x = [];
for (i = 0; i < h - 12; i += 25) {
x[i / 25] = [];
for (t = 0; t < w; t += 25) {
x[i / 25][t / 25] = c.getImageData(t + 12, i + 12, 1, 1).data[2] == 252 ? 0 : 1;
}
}
open('data:text/json;,' + JSON.stringify(x));
}
//draw water color
c.fillStyle = z[6];
c.fillRect(0, 0, w, h);
////
function y(recursion, s, recur) {
if (recursion == 4) return;
c.save();
c.translate(s.x, s.y);
if (!recursion) {
c.fillStyle = z[7];
c.fillRect(0, 0, 25, 25);
} else {
if (recursion == 1) c.translate(25, 0); //right
if (recursion == 2) c.translate(25, 25); //bottom
if (recursion == 3) c.translate(0, 25); //left
c.rotate((3.14 * (recursion * .5)));
}
po = 3.14 * (1.5 + (recursion * .5));
var Mx = (s.x + 12) + 25 * Math.cos(po);
var My = (s.y + 12) + 25 * Math.sin(po);
var check = c.getImageData(Mx, My, 1, 1).data[2] == 252; //check neighboring tile for water
c.fillStyle = z[0]; ///sand spots
c.fillRect(Math.random() * 25, Math.random() * 25, 2, 2); ///sand spots
m = 0;
while (m < (recursion == 2 ? 4 : 3)) { //how much shading
c.translate(0, 2);
c.fillStyle = z[m];
n = 0
while (n < r.length) {
if (check) {
c.fillRect(r[n], r[n + 1], r[n + 2], 2);
} //draw transition if water is neighbor
n += 3;
}
m++;
}
c.restore();
y(recursion + 1, s, recur); ///continue recursion on current for all sides
if (!check && recur) {
y(0, {
x: Math.floor(Mx / 25) * 25,
y: Math.floor(My / 25) * 25
}, 0)
} ///recur for neighbor tile
}
/////static waves
for (i = 0; i < h; i += 10) {
s = 1;
for (t = 0; t < w; t += 10) {
c.fillStyle = z[2];
c.fillRect(t, (s == 1 ? i : i - 2), 10, 2);
c.fillStyle = Math.random() * 25 < .2 ? z[1] : z[4]; //random white caps
c.fillRect(t, (s == 1 ? i - 2 : i - 4), 10, 2);
s *= -1;
}
}
////
onmousemove = function(e) {
y(0, {
x: Math.floor(e.pageX / 25) * 25,
y: Math.floor(e.pageY / 25) * 25
}, 1); //draw based on 25 pixel tile
}
//load file, no space for checking valid file
ondrop = function(e) {
e.preventDefault();
f = e.dataTransfer.files[0];
v = new FileReader();
v.onload = (function(filein) {
return function(e) {
x = JSON.parse(e.target.result);
for (i = 0; i < h; i += 25) {
for (t = 0; t < w; t += 25) {
if (x[i / 25][t / 25]) y(0, {
x: t,
y: i
}, 1);
}
}
};
})(f);
v.readAsText(f);
}
ondragover = function(e) {
e.preventDefault();
}