https://github.com/rdsilver/
// Fish tank
numElements = $('*:visible').length;
function moveRandomElement() {
let elementNum = Math.floor(numElements * Math.random());
let $element = $('*:visible').eq(elementNum);
$element.css('position', 'relative');
let top = $element.css('top') ? parseInt($element.css('top')) : 0;
let left = $element.css('left') ? parseInt($element.css('left')) : 0;
if (Math.random() > .5) {
$element.animate({
'top': top + Math.cos(Math.random() * 100) * 50 + 'px'
}, 2000);
} else {
$element.animate({
'left': left + Math.cos(Math.random() * 100) * 50 + 'px'
}, 2000);
}
}
window.setInterval(function(){
moveRandomElement();
}, 10);