JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://d3js.org/d3.v3.min.js"></script>
<body>
</body>

CSS

#vis{
			background-color: steelblue;
		}

JavaScript

width = 200 ;
height = 200 ;

    //svg
var svg = d3.select("body").append("svg").attr("id","vis")
            .attr("width", width )
            .attr("height", height );

var rotate=10;
   
svg.append("rect")
       .attr("id","myRect")
       .attr("fill","red")
       .attr("width",30).attr("height",10)
       .attr("x",-80)
       .attr("y",-5)
       .attr("transform","translate("+width/2+","+height/2+")rotate("+rotate+")");

    svg.append("circle").attr("cx",width/2).attr("cy",height/2).attr("r","5");

//rotation function called every second
	setInterval(function(){
        rotate+=100;
             d3.select("#myRect").transition().duration("900").attr("transform","translate("+width/2+","+height/2+")rotate("+rotate+")");

  },1000);