JSFiddle - React, Tailwind, and code Playground

HTML

<div class="container">
  <h2>HEY THERE THIS IS TEXT</h2>
  <h2>DIFFERENT TEXT</h2>
  <h2>THIS IS TEXT</h2>
  <h2>DIFFERENT LENGTHS OF TEXT</h2>
</div>

CSS

body {
  margin: 0;
}

.container {
  height: 100vh;
  text-align: center;
  background: linear-gradient(to right, #1e5799 0%, #ffffff 50%, #7db9e8 100%);
}

.container h2 {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  margin: 0;
  white-space: nowrap;
}

.container h2:nth-child(1) {
  animation: rotateWord 12s linear infinite 0s;
}

.container h2:nth-child(2) {
  animation: rotateWord 12s linear infinite 3s;
}

.container h2:nth-child(3) {
  animation: rotateWord 12s linear infinite 6s;
}

.container h2:nth-child(4) {
  animation: rotateWord 12s linear infinite 9s;
}

@keyframes rotateWord {
  0% {
    opacity: 0;
  }
  2% {
    opacity: 0;
    transform: translate(-50%, -30px);
  }
  5% {
    opacity: 1;
    transform: translate(-50%, 0px);
  }
  17% {
    opacity: 1;
    transform: translate(-50%, 0px);
  }
  20% {
    opacity: 0;
    transform: translate(-50%, 30px);
  }
  80% {
    opacity: 0;
  }
  100% {
    opacity: 0;
  }
}