拉斐尔动画回调函数不工作

Raphael animation callback function not working?

本文关键字:函数 工作 回调 动画      更新时间:2023-09-26

我很可能误用了这个回调功能,但是在下面的代码中,"testCircle"在消失之前不执行动画。

var paper = Raphael(0, 0, 1280,600);

    var testCircle = paper.circle(300, 300, 50);
    testCircle.animate({
        cx: 700
    }, 1000, testCircle.remove())

我希望动画在圆圈被移除之前完成。我是否误用了这个函数?

给你:演示

var paper = Raphael(0, 0, 1280,600);
var testCircle = paper.circle(300, 300, 50).attr('fill','red');
testCircle.animate({cx: 700}, 1000, hideCircle);
function hideCircle()
{
    testCircle.remove();
}