Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
css动画和动画方向在IE11中不起作用_Css_Svg - Fatal编程技术网

css动画和动画方向在IE11中不起作用

css动画和动画方向在IE11中不起作用,css,svg,Css,Svg,我试图在SVG路径中显示动画虚线。 使用d3动态生成路径,动画可以在两个方向上进行。它可以在除IE之外的所有浏览器中工作。 我的问题类似于。但我无法从那里得到解决方案 <path id="pathOriginal" class="animation" style="animation-direction:reverse" d="M535,73C33.75,73 33.75,-20 -467.5,-20" stroke="red" stroke-width="1.5px" fill="non

我试图在SVG路径中显示动画虚线。 使用d3动态生成路径,动画可以在两个方向上进行。它可以在除IE之外的所有浏览器中工作。 我的问题类似于。但我无法从那里得到解决方案

<path id="pathOriginal" class="animation" style="animation-direction:reverse" d="M535,73C33.75,73 33.75,-20 -467.5,-20" stroke="red" stroke-width="1.5px" fill="none">

IE不支持所有SVG元素上的CSS动画。
您必须修改SVG元素的内联属性,即不支持所有SVG元素上的CSS动画。
您必须修改SVG元素的内联属性

最后的办法是使用一些javascript魔术

var myPath=document.getElementById('pathOriginal');
var i=1000;
var intervalID=window.setInterval(myCallback,20);
函数myCallback(){
//你的代码在这里
如果(i==0){i=1000}
setAttribute('stroke-dashoffset',i);
--一,;
}

最后的办法是使用一些javascript魔术

var myPath=document.getElementById('pathOriginal');
var i=1000;
var intervalID=window.setInterval(myCallback,20);
函数myCallback(){
//你的代码在这里
如果(i==0){i=1000}
setAttribute('stroke-dashoffset',i);
--一,;
}


是否有其他方式显示动画路径?Greensock的drawSVG附带订阅成本(加上学习曲线)与下面7行编码来替代CSS动画,是否有其他方式显示动画路径?Greensock的drawSVG附带订阅成本(加上学习曲线)下面的7行代码取代CSS动画,欢迎使用。如果解决方案有效,请单击“接受”复选标记,以便将来的读者可以在类似场景中重用此解决方案。欢迎使用。如果解决方案有效,请单击“接受”复选标记,以便将来的读者可以在类似场景中重用此解决方案。
    @keyframes dash {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
    }
@-webkit-keyframes dash {
    from {
        stroke-dashoffset: 1000;
    }
    to {
        stroke-dashoffset: 0;
    }
}
.animation {
    stroke-dasharray: 4;
    stroke-dashoffset: 4;
    animation: dash 50s linear infinite;
    -webkit-animation: dash 2s linear infinite;
}