121
reputation
1
5

Vigrant

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);
0
answers
1
question
~4k
people reached
  • Austin, TX, USA
  • Member for 7 years, 4 months
  • 2 profile views
  • Last seen Oct 14 '19 at 19:22

Top tags (2)

Score 0
Posts 1
Score 0
Posts 1

Top posts (1)

Badges (6)

Gold

Silver

1

Rarest

Bronze

5

Rarest