rotate a svg

To animate a group of SVG elements and make them spin indefinitely, you can use the <g> element to group them together, and then use the <animateTransform> element within the <g> element to animate the group as a whole. Here is an example that shows how to create an infinitely spinning group of SVG elements:

<svg>   <g id="group">     <rect x="10" y="10" width="100" height="100" />     <circle cx="50" cy="50" r="40" />   </g>   <animateTransform xlink:href="#group"                     attributeName="transform"                     type="rotate"                     from="0"                     to="360"                     dur="3s"                     repeatCount="indefinite" /> </svg>

In this code, the <g> element is used to group the <rect> and <circle> elements together, and the <animateTransform> element is used to animate the group by rotating it indefinitely. The xlink:href attribute of the <animateTransform> element specifies the target of the animation (in this case, the <g> element with the id of "group"). The other animation attributes, such as attributeName, type, from, to, dur, and repeatCount, are used to control the animation in the same way as described in the previous answer.

rotate from the center of the svg

To rotate an SVG image from its center, you can use the transform-origin attribute and specify the center point of the rotation. Here is an example that shows how to rotate an SVG image from its center:

<svg>   
  <image xlink:href="image.svg"          transform="rotate(45)"          transform-origin="50% 50%" 
  /> 
</svg>

In this code, the transform-origin attribute is set to "50% 50%", which specifies the center of the rotation (i.e. the center of the image). The transform attribute is used to specify the rotation angle (in this case, 45 degrees).

Alternatively, you can use the <g> element and specify the rotation transformation and the transform-origin attribute on it, like this:


<svg>   
  <g 
 .  transform="rotate(45)"      
    transform-origin="50% 50%">     
  
	  <image xlink:href="image.svg" />   
  </g> 
</svg>

In this case, all the elements within the <g> element will be rotated by 45 degrees around the center of the group.