0

这个答案已被接受,但它不起作用,因为 gloomSet.animate({cx: 100}) 不会像圆圈一样移动发光。此外,要为焕发集路径对象设置动画,您需要应用一个转换,类似这样,但一个简单的移动转换会将辉光路径缩小到 0。

当前方法作为js fiddle,还是有更聪明的方法来实现相同的目标?:

paper = Raphael(0, 0, 200, 200);
circle = paper.circle(10, 10, 10);
glow = circle.glow();
glow.push(circle);
all = glow;
all.attr("stroke", "#f00");

// Animation
delay = 300
speed = 1000

// Will only animate the glow paths and not the circle
// Also shrinks the glow paths to nothing.
_transformedPath = Raphael.transformPath('M100 100');
animGlow = Raphael.animation({path: _transformedPath}, speed);
all.animate(animGlow.delay(delay + 200));

//We shouldn't want or need to do this.  You can apply an
//element.matrix.translate(x, y), followed by a //element.transform(element.matrix.toTransformString()) for 
//each of the elements in the glowSet
anim = Raphael.animation({cx: 100, cy: 100}, speed);
circle.animate(anim.delay(delay));
4

1 回答 1

0

对于动画,您只需要使用translate而不是matrix, 进行变换

// Animation
delay = 300
speed = 1000

_transformedPath = Raphael.transformPath('t100 100');
animGlow = Raphael.animation({transform: _transformedPath}, speed, '<>');
all.animate(animGlow.delay(delay));
于 2013-11-06T08:01:59.220 回答