Javascript svg中的文本刚刚赢得';t使用<;动画>;

Javascript svg中的文本刚刚赢得';t使用<;动画>;,javascript,html,dom,timer,svg,Javascript,Html,Dom,Timer,Svg,我试图在svg和组中开发一个带有“text”标记的文本 使用“动画”标记制作动画 当试图建立一个简单的网页,它的工作正常 但是当我将SVG与HTMLDOM和Javascript一起应用到计时器中时 动画不会显示,但是svg和文本显示正确(没有动画) 动画: var Animate; Animate = document.createElementNS("http://www.w3.org/2000/svg", "animate"); Animate.setAttribut

我试图在svg和组中开发一个带有“text”标记的文本 使用“动画”标记制作动画 当试图建立一个简单的网页,它的工作正常 但是当我将SVG与HTMLDOM和Javascript一起应用到计时器中时 动画不会显示,但是svg和文本显示正确(没有动画)

动画:

    var Animate;
    Animate = document.createElementNS("http://www.w3.org/2000/svg", "animate");
    Animate.setAttribute("attributeName", "x");
    Animate.setAttribute("from", 500);
    Animate.setAttribute("to", 35);
    Animate.setAttribute("dur","1s");
    Animate.setAttribute("fill", "freeze");

    var SVG=document.createElementNS("http://www.w3.org/2000/svg", "svg");
    SVG.style.zIndex = 1;
    SVG.style.position = "absolute";

    var Group = document.createElementNS("http://www.w3.org/2000/svg", "g");
    Group.setAttribute("id","Effect1");

    var Component=document.createElementNS("http://www.w3.org/2000/svg", "text");
    Component.setAttribute("fill", "rgb(30,100,245)");
    Component.setAttribute("font-family", "Arial");
    Component.setAttribute("font-size", 20);
    Component.setAttribute("style", "dominant-baseline:hanging");


    var txt = document.createTextNode("Complete Trial");
    Component.appendChild(txt);

    Component.appendChild(Animate);
    Group.appendChild(Component);

    SVG.appendChild(Graph);
    document.body.appendChild(SVG);

有人能告诉我为什么动画没有出现吗?或者它只是无法与javascript计时器同步?

这可以在Firefox中正确设置动画。如果你使用的是基于Webkit的浏览器,看起来你有

是的,显然这个问题与我的相匹配,我使用的是Chrome,我需要Chrome至少能解决这个问题。。是否有任何解决方案可以让动画在Chrome上运行?您的选项似乎是:编写修补程序来修复错误:-),不要使用DOM创建元素,或者使用没有错误的浏览器。