问题
I have a circle which I move it around, how can I make for the glow effect to follow that circle.
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
});
I've tried with animate on the entire set
glowSet.animate({
x: coordX,
y: coordY
});
I've tried to apply to each item using forEach over the set
glowSet.forEach(function(item) {
item.animate({
x: coordX,
y: coordY
});
});
回答1:
The glow set and the circle remain independent. You should be able to achieve the effect you desire by simply combining them into a single set, like this:
circle = paper.circle(x, y, 5);
glowSet = paper.set(circle, circle.glow({
'fill': true,
'color': '#bbb'
}));
Then apply your animations to glowSet
.
来源:https://stackoverflow.com/questions/12724291/raphaeljs-html5-library-glow-animate-along-the-circle