 Draw the ripple.
      drawRipple(elem, x, y, radius, waveColor, bgFillColor);

      // Determine whether there is any more rendering to be done.
      var shouldRenderWaveAgain = !waveDidFinish(wave, radius);
      shouldRenderNextFrame = shouldRenderNextFrame || shouldRenderWaveAgain;
      if (!shouldRenderWaveAgain) {
        deleteTheseWaves.push(wave);
      }
   }

    if (shouldRenderNextFrame) {
      window.requestAnimationFrame(onFrame);
    }  else {
      // If there is nothing to draw, clear