The idea is to animate a cloud div and have it animated back and forth horizontally to infinity. This works, but unfortunately I think it is prone to memory leaks and user interface latency. Any advice would be appreciated, thanks.
function animateCloud() {
$('#cloud').animate({ right: '+=500' }, { duration: 35000, easing: "linear", queue: true });
animateOpposite();
}
function animateOpposite() {
$('#cloud').animate({ right: '-=500' }, { duration: 35000, easing: "linear", queue: true });
animateCloud();
}
$(document).ready(function() {
animateCloud();
});
source
share