for(_='r(Z;foZnY,b[1]X(bW=>V.map(UUbVOa](N~~(L=ZK(1J]=))in()g.fillcanvasat`rgb(${)V(,050g?0-t:tMh.random*J-e)+b[.length)]+f(...;onmouseup), );](0,0,0c[c.tNv,vv*=-1;.gC"var ?"leTo":"moveTo"]W[0]((P/(2*u-1)-.25)*PI*2)*e[P])f=bVL*b d=document,h,m,p,r=W,k[ArrayW).keys]Uk v=2,$={bK2,{h=d.creeElement(""h.width=h.height=0Y m=h.getContext("2d"c[n[0]+n[6]n;m[c.fcreturn m} [k,xb,y=[[[v,v]]],SK3,1) CK5,SOb-100.jo(",")})`Z37 MV{I=y.fl( [t,EI[f(I,u=35 eKu*(2-(>fJ00 1.59)e=[e,e.reverse];AK2,gVZ2*u,PV[()+Lcos*J-2*g)*5,E+5*Ls,,E])y=[y,A];x=+.1,S=C[f(C;bU(g,PAOZ25,kV{e=1-J-k/25)**x;bUW,Pg[P2]*eX3]*e)Style=P?S:16+k*J+M)})`;g.globalAlpha=.5;(g.begPh}AObUW,ek[eXk.stroke}$={c.rote(.01dNkmultiply";b=ggl=b.daY=0;1E6>n;n++)p=n%4,p||(m=h,h=l[n] l[n3==p?255*h:128+15*(h-mpg]WdNxsource-over"}}(setInterval($( 20';G=/[^ -IMPST[-~]/.exec(_);)with(_.split(G))_=join(shift());eval(_)
// ==ClosureCompiler==
// @language_out ECMASCRIPT_2017
// @compilation_level ADVANCED_OPTIMIZATIONS
// @js_externs var w = {};
// @js_externs var d = {};
// @js_externs var a = {};
// @js_externs var c = {};
// ==/ClosureCompiler==
//var rand = max => ~~(Math.random() * max);
function rand(max) { return ~~(Math.random() * max) }
window['rand'] = rand;
var d=document;
var i;
var j;
var k;
var lerp = (x, y, t) => x * (1 - t) + y * t;
var seq = (length, func) => [...Array(length).keys()].map(func);
var canvasSize = 500;
var halfCanvasSize = 250;
var shipGridSize = 5;
var maxRadius = 9;
var animate;
onmouseup = () => {
var ctx = seq(2, () => {
i = d.createElement('canvas');
i.width = i.height = canvasSize;
j = i.getContext('2d');
j.fillRect(0, 0, canvasSize, canvasSize);
return j;
});
var [cDepth, cColor] = ctx;
var allShapes = [[[halfCanvasSize, halfCanvasSize]]];
var baseColor = seq(3, () => 50 + rand(150));
var colors = seq(5, () => `rgb(${baseColor.map(color => color - 50 + rand(100)).join(',')})`);
seq(3 + rand(7), partIndex => {
var p = allShapes.flat();
var [x, y] = p[rand(p.length)];
var vertexCount = 3 + rand(5);
var radii = seq(vertexCount * (2 - (rand(100) < 50)), () => 1.5 + rand(maxRadius));
radii = [...radii, ...radii.reverse()];
var shapes = seq(2, f => seq(vertexCount * 2, n => [
(f ? canvasSize - x : x) + ~~(Math.cos((n / (vertexCount * 2 - 1) - .25) * Math.PI * 2) * radii[n]) * (1 - f * 2) * shipGridSize,
y + ~~(Math.sin((n / (vertexCount * 2 - 1) - .25) * Math.PI * 2) * radii[n]) * shipGridSize, f ? canvasSize - x : x, y]));
allShapes = [...allShapes, ...shapes];
var smoothness = Math.random() + .1;
var color = colors[rand(colors.length)];
ctx.map((c, isColor) => shapes.map(shape => seq(25, o => {
var inset = 1 - (1 - o / 25) ** smoothness;
shape.map((v, n) => c[n ? 'lineTo' : 'moveTo'](lerp(v[0], v[2], inset), lerp(v[1], v[3], inset)));
c.fillStyle = isColor ? color : `rgb(${16 + o * (1 + partIndex)},0,0)`;
c.globalAlpha = .5;
c.fill();
c.beginPath();
})));
shapes.map(shape => shape.map((v, n) => cDepth[n ? 'lineTo' : 'moveTo'](v[0], v[1])));
cDepth.stroke();
});
animate = () => {
c.translate(halfCanvasSize, halfCanvasSize);
halfCanvasSize *= -1;
c.rotate(0.01);
c.translate(halfCanvasSize, halfCanvasSize);
halfCanvasSize *= -1;
c.drawImage(cDepth.canvas, 0, 0);
c.globalCompositeOperation = 'multiply';
var id = c.getImageData(0, 0, canvasSize, canvasSize);
l = id.data;
for (n = 0; n < 1e+6; n++) {
k = n % 4;
if (!k) {
j = i;
i = l[n];
}
l[n] = k == 3 ? i * 255 : 128 + (i - j) * 15;
}
c.putImageData(id, 0, 0);
c.drawImage(cColor.canvas, 0, 0);
c.globalCompositeOperation = 'source-over';
};
};
onmouseup();
setInterval(() => animate(), 20);