我很可能会滥用此回调功能,但在以下代码中," testCircle"在消失之前不执行任何动画。
var paper = Raphael(0, 0, 1280,600);
var testCircle = paper.circle(300, 300, 50);
testCircle.animate({
cx: 700
}, 1000, testCircle.remove())
我希望在移除圆圈之前实际完成动画。我误用了这个功能吗?
答案 0 :(得分:2)
您可以: DEMO
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();
}