我有下面的代碼,其中包含使用(路徑)和一個圓圈繪製的三角形。我想在所有四個軸上放置三角形45度。我不知道如何在數學上做到這一點。圓的半徑可能會有所不同。那麼如何將三角形分別放置在四個位置上,如下圖所示?(三角形應該是圓圈內的單個像素)。在SVG中放置一定角度的路徑
.st0{fill:#F24343;}
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
\t style="enable-background:new 0 0 22 14;" xml:space="preserve">
<style type="text/css">
\t .st0{fill:#F24343;}
</style>
<circle cx="40" cy="40" r="20" fill="green"/>
<path class="st0" d="M22,0H0l9.4,12.8c0.8,1.1,2.4,1.1,3.2,0L22,0z" style="transform: translate(22px,44px) rotate(45deg)"/>
</svg>
<circle cx="40" cy="40" r="20" fill="green"/>
角度值是在'旋轉()'函數的第一個參數。你不必做任何數學。 –
明白了@PaulLeBeau謝謝。 :) –