在raphael.js中设置路径的笔画宽度

时间:2013-05-06 21:40:12

标签: javascript raphael

有没有办法在Raphael.js中为路径的stroke-width属性设置动画? 我希望一些弧形路径通过动画来增加和减少它们的宽度。

我编写了以下代码,但它没有用。

var path = paper.path(...).attr({stroke: color, "stroke-width": 20, "stroke-opacity": 0.6})
path.animate({"stroke-width": 10});

1 个答案:

答案 0 :(得分:0)

http://raphaeljs.com/reference.html#Element.animate

您应该指定一些动画参数,例如动画的计时和缓动。

path.animate({"stroke-width": 10}, 5000);

持续5秒的动画

相关问题