const waveEffect = (evt, btn) => {
  const newRound = document.createElement('div');
  const x = btn.offsetWidth / 2;
  const y = btn.offsetHeight / 2;

  newRound.className = 'material-circle';
  btn.appendChild(newRound);

  newRound.style.left = x + "px";
  newRound.style.top = y + "px";
  newRound.className += " animated";

  setTimeout(() => {
    newRound.remove();
  }, 750);
};

document.addEventListener('click', evt => {
  const btn = evt.target.closest('.wave-effect');
  if (btn) {
    waveEffect(evt, btn);
  }
});

