【发布时间】:2019-12-28 01:35:50
【问题描述】:
我想了解如何制作这样的动画:
我有这个 svg 代码(x1,x2,y1,y2 是动态赋值)
<svg id={props.id} class="connect" width="100%" height="100%" viewBox="100%">
<line lass="path_in" x1={x1} y1={y1} x2={x2} y2={y2} stroke="#5184AF" stroke-width="5" stroke-linecap="round" stroke-dasharray="1, 10"/>
</svg>
我试试这个:
svg .path_in {
stroke-dasharray: 1300;
animation: dash 4s linear;
-webkit-animation: dash 4s linear;
}
@keyframes dash {
from {
stroke-dashoffset: 1300;
}
to {
stroke-dashoffset: 0;
}
}
@-webkit-keyframes dash {
from {
stroke-dashoffset: 1300;
}
to {
stroke-dashoffset: 0;
}
}
【问题讨论】:
-
显然“lass”而不是“class”是复制粘贴错误,抱歉
标签: html css xml animation svg