【发布时间】:2013-11-05 09:31:44
【问题描述】:
这个answer has been accepted 但它不起作用,因为glowSet.animate({cx: 100}) 不会像圆圈一样移动光晕。此外,要为焕发集路径对象设置动画,您需要应用 a transformation, something like this,但一个简单的移动转换会将辉光路径缩小到 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));
【问题讨论】:
-
你能对你已经玩过的东西做一个 jsfiddle 吗?
-
当然,完成。好主意@Ian。
标签: animation raphael glow svg-animate