RaphaelJS HTML5 Library: glow animate along the circle

不问归期 提交于 2019-12-24 21:19:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!