gpt4 book ai didi

html - 在 CSS3 中逐步绘制虚线 - 动画

转载 作者:太空宇宙 更新时间:2023-11-04 13:22:23 27 4
gpt4 key购买 nike

我发现以下代码使用 css3 动画和 svg Canvas 逐步绘制一条线。唯一的问题是我希望这条线是虚线,但我不确定如何修改它,更改 stroke-dasharray 似乎没有任何作用。谢谢!

<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="300px">
<style type="text/css">
path {
animation-name:animateDash;
animation-duration:5s;
animation-iteration-count:infinite;
}
@keyframes animateDash {
from{stroke-dasharray:0,2305}
to {stroke-dasharray:2305,0}
}
</style>
<path d="m 7.1428565,220.9336 c 0,0 13.6660115,54.75386 218.5714335,51.42857 C 430.61971,269.03688 478.47682,99.194335 206.69537,110.78149 -65.086093,122.36866 45.497658,213.22607 210.28635,207.29759 375.07503,201.3691 429.75297,97.468925 207.14285,82.362175 -15.467268,67.255425 64.868608,160.66909 210,153.79075 c 145.13139,-6.87834 137.69998,-93.087405 11.42857,-99.999995 -126.271412,-6.9126 -150.382292,28.03248 -24.28571,35.71428 126.09659,7.6818 72.6601,-44.83727 -5.71429,-84.2857095"
stroke-width="3" stroke-linecap="round" fill="none" stroke="black" stroke-dasharray="0,2305"/>
</svg>

http://jsfiddle.net/G4b6b/

最佳答案

这篇文章可能对您有所帮助:SVG Stroke Proprieties .更新后的 fiddle 是 Fiddle Updated . stroke-dasharray 属性是你想要玩的东西,以达到你想要的结果。

@keyframes animateDash {
from{stroke-dasharray:10,10}
to {stroke-dasharray:15,15}
}

如果这不是您想要的,并且您需要更多帮助,请提供更多详细信息。

希望对您有所帮助。

    path {
animation-name:animateDash;
animation-duration:3s;
animation-iteration-count:3;
}
@keyframes animateDash {
from{stroke-dasharray:10,10}
to {stroke-dasharray:15,15}
}
<svg xmlns="http://www.w3.org/2000/svg" width="400px" height="300px">
<style type="text/css">
</style>
<path d="m 7.1428565,220.9336 c 0,0 13.6660115,54.75386 218.5714335,51.42857 C 430.61971,269.03688 478.47682,99.194335 206.69537,110.78149 -65.086093,122.36866 45.497658,213.22607 210.28635,207.29759 375.07503,201.3691 429.75297,97.468925 207.14285,82.362175 -15.467268,67.255425 64.868608,160.66909 210,153.79075 c 145.13139,-6.87834 137.69998,-93.087405 11.42857,-99.999995 -126.271412,-6.9126 -150.382292,28.03248 -24.28571,35.71428 126.09659,7.6818 72.6601,-44.83727 -5.71429,-84.2857095"
stroke-width="3" stroke-linecap="round" fill="none" stroke="red" stroke-dasharray="10,10" d="M5 60 l215 0"/>
</svg>

关于html - 在 CSS3 中逐步绘制虚线 - 动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15065558/

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