JSFiddle - React, Tailwind, and code Playground

HTML

<p id="wave">Welcome to the website!</p>

CSS

#wave em {
  position:relative;
}

JavaScript

$.fn.wave = function() {
    function goUp(element,idx,ary) {
      element.children("em:eq("+idx+")").animate({top:'0px'},500);
    }

    function goDown(element,idx,ary) {
      max = ary.length;
      element.children("em:eq("+idx+")").animate({top:'10px'},500,function()     {goUp(element,idx,ary);});
      if (idx < max) {
        setTimeout(function() {
          goDown(element,idx+1,ary);
        },100);
      } else {
       goDown(element,0,ary);
      }
    }
    
    arr = this.text().split("");
    this.text("");
    for ( var i in arr ) {
      this.append("<em>"+arr[i]+"</em>");
    }
    var i = 0;
    goDown(this,0,arr);
}
    
$("#wave").wave();