Raphael JS : how to move/animate a path object?

后端 未结 6 933
别跟我提以往
别跟我提以往 2020-12-08 08:53

Somehow this doesn\'t work...

var paper = Raphael(\"test\", 500, 500);

var testpath = paper.path(\'M100 100L190 190\');

var a = paper.rect(0,0,10,10);
a.at         


        
6条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-08 09:18

    With the latest version of Raphael, you can do this:

    var _transformedPath = Raphael.transformPath('M100 100L190 190', 'T400,0');
    testpath.animate({path: _transformedPath}, 1000);
    

    This saves you from the trouble of having to clone a temp object.

提交回复
热议问题