JSFiddle - React, Tailwind, and code Playground

HTML

<div class="scene">
  <div class="box"></div>
</div>

CSS

.scene {
  width: 500px;
  height: 500px;
  position: absolute;
  background: #efefef;
}

.box {
  position: absolute;
  left: 250px;
  top: 100px;
  width: 70px;
  height: 140px;
  background: #000;
  transform: rotate(0deg);
  transform-origin: bottom left;
  transition: transform 600ms linear;
  transform: scale(1);
}

.box-transform {
  transform: rotate(-96deg);
}

JavaScript

$('.scene').on('click', function() {
  $('.box').toggleClass('box-transform');
});