【发布时间】:2023-01-28 18:07:30
【问题描述】:
我制作的动画适用于 Firefox,但不适用于 Chrome。我已经尝试了十几种解决方案,但我似乎无法让它发挥作用。
这是我的代码:
#path {
animation-name: turn;
transform-origin: 50px 50px;
-webkit-animation: turn;
-webkit-transform-origin: 50px 50px;
-webkit-animation: turn 2s infinite;
animation: turn 2s infinite;
}
@-webkit-keyframes turn {
100% {
-webkit-transform: rotate(1080deg);
}
}
@keyframes turn {
100% {
transform:rotate(1080deg);
}
}
<svg viewbox="0 0 100 100" id="svg">
<defs>
<linearGradient id="gradient">
<stop offset="26%" stop-color="#632ef4"/>
<stop offset="100%" stop-color="#12ead5"/>
</linearGradient>
</defs>
<path id="path" stroke-linecap="round" stroke-width="15" stroke="url(#gradient)" fill="none" stroke-dasharray="200, 250.2" d="M50 10 a 40 40 0 0 1 0 80 a 40 40 0 0 1 0 -80" transform="scale(1,1) translate(0,0)">
</path>
</svg>
有人可以帮我吗?我究竟做错了什么?
-- 编辑:我发现我实际上可以旋转,但我必须输入一个小于 360 度的值才能使其工作。我不知道为什么我不能像 Firefox 那样将它旋转 1080 度...
【问题讨论】:
-
请提供足够的代码,以便其他人可以更好地理解或重现问题。
-
@Community 我刚刚做了! :)
-
@Dwenya 我已经更新了我的答案,这似乎解决了这个问题。
标签: css css-animations webkit-animation