JSFiddle - React, Tailwind, and code Playground

HTML

<button class='anistop'>anistop</button>
<div class='block'></div>

CSS

.block {
  width: 10em;
  height: 10em;
  background: gray;
  margin: 20px;
  animation: rotate 10s infinite linear;
}

@keyframes rotate {
  100% {
    transform: rotateY(360deg);
  }
}

JavaScript

$('.anistop').click(function() {
  $('.block').stop();
});