请问下老师首先 对于一个封闭图形的stroke-dasharray,它已经绘制完毕了。比如一个正方形周长是800,stroke-dasharray:800。那么已经绘制完成了,剩下的在哪里绘制?线段是无限延长,封闭图形呢?
在然后关于stroke-offset,线段是表示偏移量好理解,可是封闭图形的offeset是表示什么意思,图形整体偏移量?我不是很明白。
rect4的stroke-dashoffset:400px,如果是整体偏移量的话那么不应该是矩形整体向左移动400px吗。这里为什么是这个效果。请老师解惑
```<template>
<div id="app">
stroke-dashoffset: 600;
<svg height="400" width="400" viewBox="0 0 400 400">
<rect class="rect4" x="10" y="10" height="200px" width="200px" fill="white" stroke="red" />
</svg>
stroke-dashoffset: 800;
<svg height="400" width="400" viewBox="0 0 400 400">
<rect class="rect5" x="10" y="10" height="200px" width="200px" fill="white" stroke="red" />
</svg>
</div>
</template>
<style lang="scss">
#app {
width: 600px;
margin: 0 auto;
}
.rect4 {
stroke-dasharray: 800px;
stroke-dashoffset: 400px;
}
.rect5 {
// transition: all 2s;
// stroke-dasharray: 800px;
// stroke-dashoffset: 800px;
animation: test 10s infinite ease-in;
}
@keyframes test {
from {
stroke-dasharray: 800px;
stroke-dashoffset: 800px;
}
to {
stroke-dasharray: 800px;
stroke-dashoffset: 0;
}
}
// 0 0 - -200 -200
// 0 200 -200 0
</style>
