I am trying to create an effect of bubbles slowly rising to the top of the screen, what I have at the moment is this,
(Not sure why it isn't working, but you get the jist of the way I am currently planning on tackling this.)
function bubbles() {
$(".bubble").animate({
'background': "rgba(0,0,0,0.4)",
'top': '-300px'
}, 200);
}
bubbles();
setInterval(function () {
bubbles();
}, 200);
My question is that is there an effective way of being able to reuse the elements that go off the screen? For example when bubble A isn't view-able by the browser window, it goes to the bottom and repeats its cycle again?
Also as a brief side question, is it best to animate it via jQuery, wrap it in a function and constantly call it using setInterval?