Edit in JSFiddle

setInterval(function() {
  $('#box').animate({
    left: 100, top: 250
  }, 400, function() {
    $(this).animate({
      left: 200, top: 0
    }, 400, function() {
      $(this).animate({
        left: 300, top: 100
      }, 400, function() {
        $(this).animate({
          left: 200, top: 0
        }, 400, function() {
          $(this).animate({
            left: 100, top: 250
          }, 400, function() {
            $(this).animate({
              left: 0, top: 0
            }, 400)
          })
        })
      })
    })
  })
}, 2400)
<div id="box"></div>
#box{
    position: absolute;
    top: 0;
    left: 0;
    width: 50px;
    height: 50px;
    background-color: cornflowerblue;
}