SVG stroke-dashoffset not working on safari

2020-02-06 08:05发布

Stroke-dashoffset is not working on safari even if I add -webkit- prefix. please help me. Thanks!....

Here is my sample code....

#path1 {
  stroke-dasharray: 500;
  -webkit-animation: dash 2s ease;
  animation: dash 2s ease;
  display:inline-block;
}
.path2 {
  stroke-dasharray: 500;
  -webkit-animation: dash 2s ease;
  animation: dash 2s ease;
  display:inline-block;
}

@keyframes dash {
  from {
  stroke-dashoffset: -500;
  }
}

@-webkit-keyframes dash {
  from {
  stroke-dashoffset: -500;
  }
}

标签: css svg safari
2条回答
做自己的国王
2楼-- · 2020-02-06 08:35

Safari does not support negative stroke-dashoffset......

查看更多
干净又极端
3楼-- · 2020-02-06 08:35

As above, negative values don‘t work for stroke-dashoffset. If you shift your values to positive numbers this should work (you’ll need to shift your initial value too):

.path2 {
  stroke-dasharray: 1500;
}

@keyframes dash {
  from {
  stroke-dashoffset: 500;
  }
}

@-webkit-keyframes dash {
  from {
  stroke-dashoffset: 500;
  }
}
查看更多
登录 后发表回答