【发布时间】:2015-03-24 01:32:11
【问题描述】:
这个 svg 动画在 chrome 中运行良好,但在 safari 和 firefox 中运行良好。我有这个 CSS:
#one{
fill:#97e8da;
stroke: $green;
}
#two{
fill: #46ceb4;
stroke: $green;
}
#one,#two{
stroke-width: 0;
-webkit-animation:load 3s linear;
animation:load 3s linear;
}
@-webkit-keyframes load {
0% {
stroke-width: 7pt;
stroke: #46ceb4;
stroke-dashoffset: 1300;
fill-opacity: 0;
}
20%{
fill-opacity: .3;
stroke-width: 2pt;
stroke: #fff;
}
50%{
stroke-width: 1pt;
}
90%{
stroke-width: 0;
stroke-dashoffset: 500;
}
100%{
stroke-dashoffset:0;
fill-opacity: 1;
}
}@keyframes load {
0% {
stroke-width: 7pt;
stroke: #46ceb4;
stroke-dashoffset: 1300;
fill-opacity: 0;
}
20%{
fill-opacity: .3;
stroke-width: 2pt;
stroke: #fff;
}
50%{
stroke-width: 1pt;
}
90%{
stroke-width: 0;
stroke-dashoffset: 500;
}
100%{
stroke-dashoffset:0;
fill-opacity: 1;
}
}
我的内联 svg 看起来像这样:
<svg id="svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Layer_1" x="0px" y="0px" width="130px" height="113px" viewBox="-10.062 -10.34 130 113" enable-background="new -10.062 -10.34 130 113" xml:space="preserve">
<path id="one" stroke-dasharray="1200 1000" d="M120,81.456L39.094 81.456 50.188 64.799 88.688 64.799 46.472 -10.184 66.943 -10.184 109.18 62.635 z"/>
<path id="two" stroke-dasharray="1200 1000" d="M0.011,101.998L-10 83.913 44.068 -8.737 84.229 62.414 63.607 62.414 43.62 27.393 z"/>
</svg>
在 safari 中,我可以看到出现破折号动画,但路径没有颜色,它只是剪裁了形状。在这两种情况下,填充不透明度都有效
【问题讨论】:
标签: svg safari css-animations mozilla