Raphaël.js动画简历()在集合上失败

Dan*_*Lee 6 html javascript resume animation raphael

我有这段代码(在jsfiddle上)

var paper = new Raphael('holder', 400, 100);

var set = paper.set();

for(var i = 0; i < 10; i++) {
    var circle = paper.circle((i * 30) + 30, 20, 5);
    circle.attr({ fill: '#ff0' });
    circle.animate(Raphael.animation({ transform: 's2,2' }, 2000).repeat('Infinity'));

    set.push(circle);
}

set.hover(function() {
    set.pause();
}, function() {
    set.resume(); // <- things get nasty here
});?
Run Code Online (Sandbox Code Playgroud)

现在当鼠标进入集合时,set.pause()正确调用并停止所有动画.
但是当离开悬停区域时它不会恢复动画,而是在控制台中出现以下错误:

未捕获的TypeError:无法读取未定义的属性'transform'

我不知道为什么会这样; 有人能帮忙吗?

biz*_*lop 6

在Safari/Firefox上,在停留一段时间后,我收到此错误消息(使用https://raw.github.com/DmitryBaranovskiy/raphael/master/raphael.js中的未压缩源代码):

`raphael.js`, line 2946: `e.totalOrigin is undefined`
Run Code Online (Sandbox Code Playgroud)

设置的唯一地方totalOriginrunAnimation功能:

line 3072: function runAnimation(anim, element, percent, status, totalOrigin, times) {
Run Code Online (Sandbox Code Playgroud)

您的代码首先调用elproto.pause()(第3352行),然后调用elproto.resume()(第3361行).pause()将该paused属性设置为true,resume()删除此属性.但是在删除标志后立即resume调用该status()方法paused:

var e = animationElements[i];
if (eve("raphael.anim.resume." + this.id, this, e.anim) !== false) {
    delete e.paused;
    this.status(e.anim, e.status);
}
Run Code Online (Sandbox Code Playgroud)

奇怪的,正在进行中的elproto.status方法(第3323行)仅由elproto.setTime()和调用elproto.resume().此函数构造一些复杂的返回值,但没有活动代码使用其返回值,只有从第2980行开始的注释掉的行.

如果函数runAnimationvalue参数,该函数也会调用该函数:

 runAnimation(anim, this, -1, mmin(value, 1)     );
          totalOrigin should be passed here! ^^^
Run Code Online (Sandbox Code Playgroud)

不幸的是,它没有传递任何东西totalOrigin,这就是bug的原因.

我尝试添加totalOrigin基于3312行的参数:

 runAnimation(anim, this, -1, mmin(value, 1), this.attr());
Run Code Online (Sandbox Code Playgroud)

虽然它似乎有用,但它有点儿麻烦.

作为第二次尝试,我评论了整条线:

 // runAnimation(anim, this, -1, mmin(value, 1));
Run Code Online (Sandbox Code Playgroud)

结果:它工作正常,但时间错误,可能应该在某处更新动画开始时间.

http://jsfiddle.net/7nGcR/26/ https://raw.github.com/gist/3067995/1e82de48eeacf98697b572efdc74c11a9b1d9d03/gistfile1.js