使用transform设置动画SVG路径的关键帧:翻译不在IE中工作

时间:2014-05-22 00:27:32

标签: css internet-explorer svg transform keyframe

嘿,我试图围绕一些单词制作精美的边框动画,并且它在Firefox&amp ;; Chrome但不在IE中。我想知道是否有人知道它为什么不在IE中工作?动画不会发起。

我的HTML

<div class="box">
<svg xmlns="http://www.w3.org/2000/svg" width="100%" height="100%">
    <line class="top" x1="-146" y2="0" x2="400" y2="0" />
    <line class="left" x1="0" y1="60" x2="0" y2="-30" />
    <line class="bottom" x1="292" y1="30" x2="-264" y2="30" />
    <line class="right" x1="146" y1="-30" x2="146" y2="60" />
</svg>
 <h2>My Words</h2>

我的CSS

h2 {
font-family:'Source Sans Pro', sans-serif;
font-size: 1em;
text-align: center;
line-height: 30px;
color: black;
letter-spacing: 0.07em;
}

.box {
width: 146px;
height: 30px;
position: relative;
margin: 0 auto 15px auto;
color: #2c3e50;
padding-bottom: 0.05em;
padding-left: 1px;
padding-right: 0.05em;
}

.box svg {
position: absolute;
top: 0;
left: 0;
overflow:hidden;
}

.box svg line {
stroke-width: 3;
stroke: #000;
fill: none;
}

.box svg line.top, .box svg line.bottom, .box svg line.left, .box svg line.right {
-webkit-animation-delay: 0.25s !important;
-moz-animation-delay: 0.25s !important;
-ms-animation-delay: 0.25s !important;
-o-animation-delay: 0.25s !important;
animation-delay: 0.25s !important;
}

.box svg line.top {
stroke-dasharray: 146;
-webkit-animation: Topline 1s;
-moz-animation: Topline 1s;
-ms-animation: Topline 1s;
-o-animation: Topline 1s;
animation: Topline 1s;
-webkit-animation-fill-mode: forwards;
-moz-animation-fill-mode: forwards;
-o-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}

.box svg line.bottom {
stroke-dasharray: 146;
-webkit-animation: Bottomline 1s;
-moz-animation: Bottomline 1s;
-ms-animation: Bottomline 1s;
-o-animation: Bottomline 1s;
animation: Bottomline 1s;
-webkit-animation-fill-mode: forwards;
-moz-animation-fill-mode: forwards;
-o-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}

.box svg line.left {
stroke-dasharray: 30;
-webkit-animation: Leftline 1s;
-moz-animation: Leftline 1s;
-ms-animation: Leftline 1s;
-o-animation: Leftline 1s;
animation: Leftline 1s;
-webkit-animation-fill-mode: forwards;
-moz-animation-fill-mode: forwards;
-o-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}

.box svg line.right {
stroke-dasharray: 30;
-webkit-animation: Rightline 1s;
-moz-animation: Rightline 1s;
-ms-animation: Rightline 1s;
-o-animation: Rightline 1s;
animation: Rightline 1s;
-webkit-animation-fill-mode: forwards;
-moz-animation-fill-mode: forwards;
-o-animation-fill-mode: forwards;
animation-fill-mode: forwards;
}

@-webkit-keyframes Topline {
100% {
    -webkit-transform: translateX(-146px);
}
}

@keyframes Topline {
100% {
    -moz-transform: translateX(-146px);
    -ms-transform: translateX(-146px);
    -o-transform: translateX(-146px);
    transform: translateX(-146px);
}
}

@-webkit-keyframes Bottomline {
100% {
    -webkit-transform: translateX(146px);
}
}

@keyframes Bottomline {
100% {
    -moz-transform: translateX(146px);
    -ms-transform: translateX(146px);
    -o-transform: translateX(146px);
    transform: translateX(146px);
}
}

@-webkit-keyframes Leftline {
100% {
    -webkit-transform: translateY(30px);
}
}

@keyframes Leftline {
100% {
    -moz-transform: translateY(30px);
    -ms-transform: translateY(30px);
    -o-transform: translateY(30px);
    transform: translateY(30px);
}
}

@-webkit-keyframes Rightline {
100% {
    -webkit-transform: translateY(-30px);
}
}

@keyframes Rightline {
100% {
    -moz-transform: translateY(-30px);
    -ms-transform: translateY(-30px);
    -o-transform: translateY(-30px);
    transform: translateY(-30px);
}
}

以下是我要完成的设置:Fiddle

this是我大致遵循的演示。

0 个答案:

没有答案