Skip to content

Instantly share code, notes, and snippets.

@rangedsp
Created January 18, 2019 09:49
Show Gist options
  • Save rangedsp/9ef75a303bab8a86b48c7a87832a455c to your computer and use it in GitHub Desktop.
Save rangedsp/9ef75a303bab8a86b48c7a87832a455c to your computer and use it in GitHub Desktop.
AnimatedUrl
var f = ['πŸŒ‘', '🌘', 'πŸŒ—', 'πŸŒ–', 'πŸŒ•', 'πŸŒ”', 'πŸŒ“', 'πŸŒ’'],
d = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
m = 0;
function loop() {
var s = '', x = 0;
if (!m) {
while (d[x] == 4) {
x ++;
}
if (x >= d.length) m = 1;
else {
d[x] ++;
}
}
else {
while (d[x] == 0) {
x ++;
}
if (x >= d.length) m = 0;
else {
d[x] ++;
if (d[x] == 8) d[x] = 0;
}
}
d.forEach(function (n) {
s += f[n];
});
location.hash = s;
setTimeout(loop, 50);
}
loop();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment