【发布时间】:2015-12-05 16:25:06
【问题描述】:
我正在尝试反转这条 SVG 线的动画效果。我需要这条线从左到右绘制,但只能让它从右到左工作。我尝试在 illustrator 中更改终点,但这只会导致它从两侧绘制。我该怎么做呢?你可以在这里看到动画:http://mckeever02.github.io/voxbit/
这是 SVG:
<svg viewBox="0 0 759.7 234.2">
<path class="phone-line" stroke="#fff" stroke-width="4" stroke-dashoffset="20" fill="none" class="st0" d="M755.6,229.7H540.1c-31.9,0-57.6-27-57.6-58.9l0-5.8V61.6c0-31.9-26.1-58-58-58h-40.8h-7.9H335
M755.6,229.7H540.1c-31.9,0-57.6-27-57.6-58.9l0-5.8V61.6c0-31.9-26.1-58-58-58h-40.8h-7.9H335
c-31.9,0-58,26.1-58,58v103.3v6.8c0,31.9-26.1,58-58,58H11.55" />
</svg>
以及用于动画的 CSS:
.phone-line {
stroke-dasharray:1400;
-webkit-animation: draw 4s ease-in;
}
@-webkit-keyframes draw {
from {
stroke-dashoffset: 1400;
}
to {
stroke-dashoffset: 0;
}
}
【问题讨论】:
-
在我的浏览器 (Firefox/Linux) 上,这条线根本没有动画效果(与图标相反)。
-
@rr- 在 Chrome 中查看。他只有 webkit 关键帧规则。
-
是的,我的错误忘记了我的非供应商前缀。
标签: css animation svg css-animations