0

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

我写了下面的代码,但没有用。

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

1 回答 1

0

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

You are supposed to specify some animation parameters such as timing and easing of the animation.

try

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

for an animation lasting 5 seconds

于 2013-05-07T00:22:00.977 回答