Skip to content

Instantly share code, notes, and snippets.

@Cycymomo
Last active December 23, 2015 08:19
Show Gist options
  • Save Cycymomo/6607140 to your computer and use it in GitHub Desktop.
Save Cycymomo/6607140 to your computer and use it in GitHub Desktop.
World by @aemkei, refacto original : http://aem1k.com/world/
// run this function to update the spinning globe for another iteration
var updateWorld = function updateWorld() {
var e, x, r, t;
var newSource = "<pre>";
var worldParts = [
"zw2",
"l6k\n",
"e3t",
"jnt",
"qj2",
"xh2 x",
"2kty2",
"wrt",
"13n2",
"3n9h2\n",
"3pdxt",
"1csb yz",
"3iyb6k",
"3pk72",
"3nm\nr2",
""
];
for (var y in worldParts) {
e = x = r = [];
var t = String(parseInt(worldParts[y], 36));
for (var a in t) {
for (r = !r, i = 0; t[a] > i; i += .05) {
with(Math) {
x -= .05;
var o = (new Date() / 1e3) + (x / PI);
if (cos(o) < 0) {
e[~~ (32 * sin(o) * sin(.5 + y / 7)) + 60] = -~r;
}
}
}
for (x = 0; 122 > x;) {
newSource += " *#"[e[x++] + e[x++]] || (S = ("eval(updateWorld=\'" + updateWorld.split(B = "\\\\").join(B + B).split(Q = "\'").join(B + Q) + Q + ")//m1k")[x / 2 + 61 * y - 1]).fontcolor(/\\w/.test(S) && "#03B");
}
}
newSource = newSource + B + "\\n";
document.body.innerHTML = newSource;
}
};
// BUTTTTT it has to be a string, or we won't be able to manipulate it as a string
var updateWorld = updateWorld.toString();
// update as fast as we can (minimum browser timeout = 4ms)
setInterval(updateWorld, 4);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment