I am employing a ripple effect on a background image of a web page. As it sits right now, the effect is present on page load and creates ripples in the background as a user moves the mouse cursor. I am trying to figure out a way to stop the effect after a set amount of time (20s).
I have tried utilizing the setInterval() and clearInterval(), as well as combining/nesting these into a setTimeout(). I reviewed a similar question but attempts at the various solutions did not work.
My most recent attempt was:
var animateBackground = setInterval(function() {
$('body').ripples({
resolution: 1297,
dropRadius: 10,
perturbance: 0.04,
});
}, 1000);
setTimeout(function(){
clearInterval(animateBackground);
}, 20000);
I am relatively new into web design/coding, and really appreciate any help the community can provide.