JSFiddle - React, Tailwind, and code Playground

HTML

<svg id="svg">
  <g id="g">
    <path d="M 50,50 l 100,0 0,100 -100,0 Z" stroke="#2A5"></path>
  </g>
  <g id="rectGroup">
    <rect id="rect" x="200" y="50" width="100" height="100"></rect>
  </g>
</svg>

CSS

#svg {
  width: 500px;
  height: 500px;
}
svg,g,path,rect {
  transition: all 1s linear 1s;
}

JavaScript

var group = document.getElementById('g')
var rect = document.getElementById('rectGroup');

group.style.transformOrigin = '100px 100px'
group.style.transform = 'rotate(90deg)'

rect.style.transformOrigin = '250px 100px';
rect.style.transform = 'rotate(90deg)'