JSFiddle - React, Tailwind, and code Playground

HTML

<div class='bonus' id="_div">

</div>

<button id="_b">
  animate
</button>

CSS

div {
  width: 200px;
  height: 200px;
  background: red;
}

.bonus {
opacity: 0;
    transform: translate3d(0, -20%, 0);
}

.active {
  animation: 1s activate forwards;
}

@keyframes activate {
  0% {
    opacity: 0;
    transform: translate3d(0, -20%, 0);
  }

  50% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  85% {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }

  100% {
    opacity: 0;
    transform: translate3d(0, -20%, 0);
  }
}

JavaScript

_b.onclick = () => {
  _div.classList.add('active')

  setTimeout(() => {
    _div.classList.remove('active')
  }, 1000)
}