带有IE9的FakeSmile [英] FakeSmile with IE9

查看:111
本文介绍了带有IE9的FakeSmile的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 FakeSmile

我正在动态创建SVG元素,添加带有animate元素的rect元素并调用beginElement(). IE9给我一个错误: 对象不支持属性或方法"beginElement"

I'm creating the SVG element dynamically, adding a rect element with animate element and calling beginElement(). IE9 gives me an error: Object doesn't support property or method 'beginElement'

静态SVG的工作原理是: http://jsfiddle.net/FG3PG/1/

Static SVG works: http://jsfiddle.net/FG3PG/1/

如何使用FakeSmile修复它? 下面显示了我正在尝试做的事情: http://jsfiddle.net/DgMDV/13/

How do I use FakeSmile to fix it? The following shows what I'm trying to do: http://jsfiddle.net/DgMDV/13/

这是相同的代码:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE HTML><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <script type="text/javascript" src="http://bazaar.launchpad.net/~smilteam/smil/MAIN/download/head:/smil.user.js-20080305202719-59ane0zgfr5f3vz8-1/smil.user.js"></script>
</head>
<body>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=utf-8" />
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" baseProfile="full" height="200">
   <rect class="drag resize" x="10" y="10" width="100" height="50" fill="#c66" />
</svg>
<script type="text/javascript">
    var svg   = document.getElementsByTagName('svg')[0];
    var svgNS = svg.getAttribute('xmlns');
    var rect = document.getElementsByTagName('rect')[0];

    var animation = document.createElementNS(
        "http://www.w3.org/2000/svg", "animate");
    animation.setAttributeNS(null, 'attributeName', 'x');
    animation.setAttributeNS(null, 'dur', 0.5);
    animation.setAttributeNS(null, 'begin', 'indefinite');
    animation.setAttributeNS(null, 'fill', 'freeze');
    animation.setAttributeNS(null, 'to', 100);
    rect.appendChild(animation);
    animation.beginElement();
</script>
</body>
</html>

推荐答案

Fenring(leunen-d)表示fakesmil不支持动态动画 并且可以添加以下功能: https://answers.launchpad.net/smil/+question/203333

Fenring (leunen-d) anwered that fakesmil doesn't support dynamic animations and that it could be added with the following function: https://answers.launchpad.net/smil/+question/203333

function registerAnimation(anim) {
    var targets = getTargets(anim);
    var elAnimators = new Array();
    for(var i=0; i<targets.length ;i++) {
      var target = targets[i];
      var animator = new Animator(anim, target, i);
      animators.push(animator);
      elAnimators[i] = animator;
    }
    anim.animators = elAnimators;
    var id = anim.getAttribute("id");
    if (id)
      id2anim[id] = anim;
    for(var i=0; i<elAnimators.length ;i++)
      elAnimators[i].register();
}

这篇关于带有IE9的FakeSmile的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆