RaphaelJS HTML5库:沿着圆圈发光
我有一个圆圈,我可以移动它,我怎么能使辉光效果跟随那个圆圈。
circle = paper.circle(x, y, 5); glowSet = circle.glow({ 'fill': true, 'color': '#bbb' }); // ... // I animate the circle later on using circle.animate({ cx: coordX, cy: coordY });
我试过整套动画
glowSet.animate({ x: coordX, y: coordY });
我已经尝试使用forEach在集合上应用每个项目
glowSet.forEach(function(item) { item.animate({ x: coordX, y: coordY }); });
发光组和圆圈保持独立。 您应该能够通过简单地将它们组合成一个集合来实现您想要的效果,如下所示:
circle = paper.circle(x, y, 5); glowSet = paper.set(circle, circle.glow({ 'fill': true, 'color': '#bbb' }));
然后将您的动画应用于glowSet
。