gpt4 book ai didi

css - svg css 动画 无限

转载 作者:行者123 更新时间:2023-11-28 09:25:53 24 4
gpt4 key购买 nike

我正在尝试做一个类似的例子 https://css-tricks.com/svg-line-animation-works但我希望它无限旋转。

#path1 {
stroke-dasharray: 170;
-webkit-animation: animate1 5s infinite; /* Chrome, Safari, Opera */
animation: animate1 5s infinite;
}
@keyframes animate1 {
to {
stroke-dashoffset: 1000;
}
}

@-webkit-keyframes animate1 {
to {
stroke-dashoffset: 1000;
}
}

我做了一个例子http://jsfiddle.net/46cmu71t/ .我把代码放在无限的地方,但它变慢了,然后又重新开始了。有什么办法可以让它在不失速的情况下旋转?

最佳答案

很容易做到,在过渡线中加入linear方法:

#path1 {
stroke-dasharray: 170;
-webkit-animation: animate1 5s infinite linear; /* Chrome, Safari, Opera */
animation: animate1 5s infinite linear;
}

More about CSS transition timing
More about CSS transitions

JSFiddle Demo

关于css - svg css 动画 无限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29651964/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com