Skip to content

Instantly share code, notes, and snippets.

@Ajnasz
Created September 7, 2012 14:02
Show Gist options
  • Save Ajnasz/3666493 to your computer and use it in GitHub Desktop.
Save Ajnasz/3666493 to your computer and use it in GitHub Desktop.
/*jslint browser: true*/
(function () {
"use strict";
var d = document,
a = document.createElement('div'),
i = 0,
e = '1px solid #a0a',
f,
g,
b,
c,
z;
z = function (i, x, y) {
return function () {
var id = 'Ͼ' + i,
b,
t;
c = (i * 2);
b = d.getElementById(id);
f = parseInt(Math.sin(c) * 100, 10);
t = (f + y) + 'px';
if (!b) {
b = a.cloneNode(true);
b.id = id;
f = f > 0 ? f : -f;
f = f.toString(16);
g = f.length;
while (g++ < 6) {
f = '0' + f;
}
b.style.background = "#" + f;
}
b.style.left = (c * 2 + x) + 'px';
b.style.top = t;
d.body.appendChild(b);
}
};
a.style.position = "absolute";
a.style.width = "10px";
a.style.height = "10px";
a.style.borderRadius = "10px";
a.style.boxShadow = "2px 2px 2px #000";
a.style.borderTop = e;
a.style.borderLeft = e;
document.onmousemove = function (e) {
var i;
for (i = 0; i < 30; i += 1) {
setTimeout(z(i, e.pageX, e.pageY), 10 * i + 10);
}
};
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment