【发布时间】:2018-08-20 07:22:15
【问题描述】:
我对 SVG 动画有一些疑问。我想从 SVG 路径中的选定点开始动画。现在我的动画从上边中间开始。但我想从圆圈的左侧或右侧中间开始动画。 有什么技术可以选择动画起点吗? 下面是我的笔,你可以在其中看到我的代码。
<div class="step-1-wrapper steps ">
<div class="step-1-inner">
<div class="step-1-icon-wrap anim-step-1" >
<svg class="circular-chart orange step-1-circle">
<line stroke-dasharray="5, 5" x1="250" y1="255" x2="330" y2="255" class="step-1-2-line-mvr"></line>
<line x1="250" y1="255" x2="330" y2="255" class="step-1-2-line-mvr-anim"></line>
<path class="circle-bg" d="M165 170
a 85 85 0 0 1 0 170
a 85 85 0 0 1 0 -170"></path>
<path class="anim-circle" d="M165 170
a 85 85 0 0 1 0 170
a 85 85 0 0 1 0 -170"></path>
</svg>
</div>
</div>
</div>
.steps {
display: inline-block;
width: 24%;
vertical-align: middle;
text-align: center;
margin-right: -2px;
margin-left: -2px;
}
.step-1-icon-wrap {
height: 155px;
width: 155px;
background-color: #ffffff;
border-radius: 100%;
-webkit-box-shadow: 0px 0px 10px 0px rgba(26,122,171,0.25);
-moz-box-shadow: 0px 0px 10px 0px rgba(26,122,171,0.25);
box-shadow: 0px 0px 10px 0px rgba(26,122,171,0.25);
margin: 0 auto;
margin-left: 30px;
}
.circular-chart {
position: absolute;
height: 100%;
width: 100%;
left: -57px;
top: 3px;
}
.anim-circle {
fill: transparent;
stroke: #f8fcff;
stroke-width: 3;
stroke-dasharray: 1000;
stroke-dashoffset: 1000;
}
.anim-circle {
fill: transparent;
stroke: #f8fcff;
stroke-width: 3;
stroke-dasharray: 1000;
stroke-dashoffset: 1000;
}
.circle-bg {
fill: none;
stroke: #57c1f8;
stroke-width: 2;
stroke-dasharray: 6;
}
.step-1-2-line-mvr {
stroke: #57c1f8;
stroke-width: 2;
}
.step-1-2-line-mvr-anim {
stroke: #f8fcff;
stroke-width: 3;
stroke-dasharray: 1000;
stroke-dashoffset: 1000;
}
.anim-step-1 .step-1-2-line-mvr-anim {
animation: dash 3s linear 1.5s normal 1;
}
.anim-step-1 .anim-circle {
animation: dash 3s linear 1s normal 1;
}
.step-1-inner{
position: relative;
min-height: 430px;
padding-top: 180px;
}
@keyframes dash {
0% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 1000;
}
}
【问题讨论】: