Skip to content

Instantly share code, notes, and snippets.

@julescarbon
Created July 31, 2014 22:29
Show Gist options
  • Save julescarbon/9288e05db868769b2f0a to your computer and use it in GitHub Desktop.
Save julescarbon/9288e05db868769b2f0a to your computer and use it in GitHub Desktop.
extraction of matraka demo
/*
<canvas id=c>
<img src=# onload=
for( a=c.getContext('2d'), i=e='', S=String.fromCharCode;
a.drawImage(this,i--,0),
t=a.getImageData(0,0,1,1).data[0];
) e += S(t);
(1,eval)(e)
>
*/
M = [R = Math.random,
Q = Math.cos,
c.style.cssText = 'position:fixed;top:0;left:0;width:100%;height:100%;background:#000',
e = 'data:audio/wav;base64,UklGRiQAAABXQVZFZm10IBAAAAABAAEAwF0AAMBdAAABAAgAZGF0YQAA'
];
for (t = 2560; t--;) M[t] = {
t: t,
u: t % 48 / 7.64,
v: t / 366.7,
x: 128 - R() * 256,
y: 64 - R() * 256,
z: 128 - R() * 256
};
for (t = 0; t++ < 8e5;) {
e += btoa(S('13107103135701314204' // there was a space here when i ran through beautifier
[(t >> 10 & 15) + (t >> 13 & 4)] * t & 96,
R() * 127 * (Math.pow(t / 144000 % 1, 16) / 4 + Math.pow(1 - t / 144000 % 1, 64)),
t >> 10 & 7 ^ 5 || R() * 127)
);
}
Z = new Audio(e);
Z.play(setInterval(function b(v, w) {
if (v) return w.W - v.W;
M.sort(b);
h = c.height = 0 | 300 * innerHeight / innerWidth;
C = Q(r = Z.currentTime / 2);
S = Q(r - 8);
a.rotate((r & 13) / 64 - .1);
B = r / 9;
A = Math.pow(B % 1, 64);
d = [1 - A, 0, A][0 | B++ % 3];
f = [1 - A, 0, A][0 | B++ % 3];
e = [1 - A, 0, A][0 | B++ % 3];
for (t = 2560; t--;) {
v = M[t];
if (v.W > 0) {
a.fillRect(150 - v.W * v.U, v.W * (v.y + Math.max(16 * Q(r), 150 - r * 42)) + h / 2,
v.W * 7,
v.W * 7,
a.fillStyle = 'hsl(' + [r * 17 - v.y + R() * 48, (16 + R() * 48) + '%',
v.W * 7 + 32 - 32 * Q(v.u * 2 - 8) * Q(v.v * 3 - 8)] + '%)');
}
if (v.t < 2304) {
Y = 96 - 30 * v.v,
D = 32 + 8 * Q(v.u * 2) * Q(v.v * 3),
v.x = (96 - 30 * v.u) * d + D * (Q(v.u) * e + Q(v.u) * Q(v.v / 2 - 8) * f),
v.z = Y * d + D * (Q(v.u - 8) * e + Q(v.u - 8) * Q(v.v / 2 - 8) * f),
v.y = D * d + Y * e + D * Q(v.v / 2) * f;
}
v.W = 128 / (v.z * C - v.x * S + 96);
v.U = v.x * C + v.z * S
}
a.fillText(['P01 4MAT', 'MATRAKA'][B & 1].substr(a.drawImage(c,
0,
r * h % h,
32,
h / 8 * (3 + A + Q(B + A)),
0,
r * h % h,
300,
h / 8 * (3 + A + Q(B + A))),
r * 8 - 48) + '|',
32,
h / 2)
}, Z.loop = 9))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment