【发布时间】:2019-10-21 16:52:18
【问题描述】:
我正在尝试让里面的圆圈旋转。在 animateTransform 的 from 和 to 中使用 50% 不起作用。
我正在尝试的另一件事是将多边形放在圆的中心。
body {
margin: 0;
background: black;
}
#container {
background: rgba(0, 155, 255, 0.3);
padding: 10px;
}
#circle1 {
}
#circle2 {
stroke-dasharray: 20 3 55;
}
#circle3 {
stroke-dasharray: 22;
}
<div id="container">
<svg xmlns="http://www.w3.org/2000/svg" height=207px width=207px stroke="#00bd80" fill="none">
<circle id="circle1" r="100" cx="50%" cy="50%" stroke-width="7px"/>
<circle id="circle2" r="96" cx="50%" cy="50%" stroke-width="5px">
<animateTransform attributeType="xml"
attributeName="transform"
type="rotate"
from="0 98.5 98.5"
to="360 98.5 98.5"
dur="20s"
repeatCount="indefinite"/> <!-- how to center correctly -->
</circle>
<circle id="circle3" r="80" cx="50%" cy="50%" stroke-width="5px"/>
<polygon points="30,15 22.5,28.0 7.5,28.0 0,15 7.5,2.0 22.5,2.0"></polygon>
</svg>
</div>
【问题讨论】: