2017-11-09 14 views
0

私はSVG要素をアニメーション化していますが、しばらくするとアニメーションが停止します。アニメーションがこのように続きますようにお願いします。jsfiddle私のSVGはある時点でアニメーションを停止します

.path { 
 
    stroke-dasharray: 20; 
 
    animation: dash 10s linear; 
 
} 
 

 
@keyframes dash { 
 
    to { 
 
     stroke-dashoffset: 1000; 
 
    } 
 
}
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" 
 
    xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="340px" 
 
    height="333px" viewBox="0 0 340 333" enable-background="new 0 0 340 333" 
 
    xml:space="preserve"> 
 
    <path class="path" fill="#fff" stroke="#000" stroke-width="2" 
 
      d="m121.3,34.6c-1.6-1.6-4.2-1.6-5.8,0l-51,51.1-51.1-51.1c-1.6-1.6-4.2- 
 
      1.6-5.8,0-1.6,1.6-1.6,4.2 0,5.8l53.9,53.9c0.8,0.8 1.8,1.2 2.9,1.2 
 
      1,0 2.1-0.4 2.9-1.2l53.9-53.9c1.7-1.6 1.7-4.2 0.1-5.8z"/> 
 
</svg>

答えて

1

あなたが不足しているすべてはinfiniteキーワードです。詳細については、the docsを参照してください。

.path { 
 
    stroke-dasharray: 20; 
 
    animation: dash 10s linear infinite; 
 
} 
 

 
@keyframes dash { 
 
    to { 
 
     stroke-dashoffset: 1000; 
 
    } 
 
}
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" 
 
    xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="340px" 
 
    height="333px" viewBox="0 0 340 333" enable-background="new 0 0 340 333" 
 
    xml:space="preserve"> 
 
    <path class="path" fill="#fff" stroke="#000" stroke-width="2" 
 
      d="m121.3,34.6c-1.6-1.6-4.2-1.6-5.8,0l-51,51.1-51.1-51.1c-1.6-1.6-4.2- 
 
      1.6-5.8,0-1.6,1.6-1.6,4.2 0,5.8l53.9,53.9c0.8,0.8 1.8,1.2 2.9,1.2 
 
      1,0 2.1-0.4 2.9-1.2l53.9-53.9c1.7-1.6 1.7-4.2 0.1-5.8z"/> 
 
    </svg>

関連する問題