This SVG image that I have created presents a unique design.
<svg width="250px" height="250px" viewBox="0 0 250 250" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<def>
</def>
<g id="i-define-a-black-ring-yellow" fill="#img10" transform="translate(20.000000, 20.000000)">
<g id="Group">
<circle id="Oval" stroke="#ff0000" stroke-width="2" cx="100" cy="100" r="100">
</circle>
<circle id="Oval" fill="#228B22" fill-rule="nonzero" cx="171" cy="31" r="16">
</circle>
<animateTransform attributeName="transform" type="rotate" from="0 100 100" to="360 100 100" begin="0s" dur="10s" repeatDur="indefinite"/>
</g>
</g>
</svg>
View the fiddle here: http://jsfiddle.net/9zkfodwp/1377/
I attempted to insert an image inside the circle using a clip-path1
, however, the image did not display as expected. The following code snippet shows my approach:
<svg width="250px" height="250px" viewBox="0 0 250 250" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<def>
<clipPath id="myCircle">
<circle id="Oval" fill="#228B22" fill-rule="nonzero" cx="171" cy="31" r="16">
</circle>
</clipPath>
</def>
<g id="i-define-a-black-ring-yellow" fill="#img10" transform="translate(20.000000, 20.000000)">
<g id="Group">
<circle id="Oval" stroke="#ff0000" stroke-width="2" cx="100" cy="100" r="100">
</circle>
<image width="50" height="35" xlink:href="https://www.tutorialspoint.com/videotutorials/images/coding_ground_home.jpg" clip-path="url(#myCircle)" />
<animateTransform attributeName="transform" type="rotate" from="0 100 100" to="360 100 100" begin="0s" dur="10s" repeatDur="indefinite"/>
</g>
</g>
</svg>
View the modified fiddle here: http://jsfiddle.net/9zkfodwp/1380/
I have a couple of questions regarding this setup:
- Why is Chrome not displaying the image correctly in the live preview?
https://i.sstatic.net/jT1lA.png
- The image inserted into the circle does not conform to a circular shape. Instead, it appears as a square within the circle in the fiddle.
https://i.sstatic.net/q2fbU.png
Shouldn't the rectangular book image fit neatly inside the circle since we are filling the circle with the image?
If you have any insights or suggestions on how to address these issues, I would greatly appreciate your input.