您可以使用此基本 SVG 在浏览器中创建一个,无需其他工具:
<svg xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 100 100">
<defs>
<!-- change the two 20 values to make rays thicker or thinner -->
<path id="ray" d="M-20,0 L0,-50 L20,0 Z"/>
</defs>
<g style="stroke:none; fill: black" transform="translate(50,50)">
<!-- five points of star -->
<use xlink:href="#ray"/>
<use transform="rotate(72)" xlink:href="#ray"/>
<use transform="rotate(144)" xlink:href="#ray"/>
<use transform="rotate(216)" xlink:href="#ray"/>
<use transform="rotate(288)" xlink:href="#ray"/>
<!-- star will be centred on this circle in the green bounding box -->
<circle r="1" fill="red" stroke="none"/>
<rect x="-50" y="-50" width="100" height="100" fill="none" stroke="green"/>
</g>
</svg>
它定义了一个三角形作为射线,它围绕正方形的中心点以 72 度旋转 (360/5) 创建五个副本。