<svg width="500" height="350">
  <style>
    rect {
      -moz-transform-origin: 75px 75px;
      transform-origin: 50% 50%;
    }
  </style>
  <rect id="deepPink-rectangle" width="50" height="50" x="225" y="125" fill="deepPink"  transform="rotate(0) translate(0 0)"/>
  
  <animateTransform 
           xlink:href="#deepPink-rectangle"
           attributeName="transform" 
           attributeType="XML"
           type="rotate"
           from="0 250 150"
           to="360 250 150"
           dur="2s"
           begin="0s"
           repeatCount="indefinite"
           fill="freeze"
                    
           />
  <set xlink:href="#deepPink-rectangle" attributeName="fill"
       to="#0099AA" begin="click" dur="3s" />
  
</svg>
svg {
  border: 3px solid #eee;
  display: block;
  margin: 1em auto;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. //cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js