D3.js SVG转换旋转组

<!DOCTYPE html>
   <html>
      <head>
         <script type = "text/javascript" src = "https://d3js.org/d3.v4.min.js"></script>
         <style>
            body { font-family: Arial; }
         </style>
      </head>

      <body>
         <div id = "svgcontainer">
         <svg width = "300" height = "300">
            <g transform = "translate(60,60) rotate(30)">
               <rect x = "20" 
                  y = "20" 
                  width = "60" 
                  height = "60" 
                  fill = "green">
               </rect>
               <circle cx = "0" 
                  cy = "0" 
                  r = "30" 
                  fill = "red"/>
            </g>
         </svg>
      </div>
   </body>
</html>

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/266095.html

(0)
上一篇 2022年6月7日
下一篇 2022年6月7日

相关推荐

发表回复

登录后才能评论