不知怎的,这行不通......
var paper = Raphael("test", 500, 500);
var testpath = paper.path('M100 100L190 190');
var a = paper.rect(0,0,10,10);
a.attr('fill', 'silver');
a.mousedown( function() {
testpath.animate({x: 400}, 1000);
});
我可以用这种方式 move 矩形但不能 move 路径,这是为什么,然后我该如何 move 路径对象?!
最佳答案
使用最新版本的 Raphael,您可以这样做:
var _transformedPath = Raphael.transformPath('M100 100L190 190', 'T400,0');
testpath.animate({path: _transformedPath}, 1000);
这使您免于必须克隆
临时对象的麻烦。
关于javascript - 拉斐尔 JS : how to move/animate a path object?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6282171/