RaphaelJS HTML5库:沿着圆圈发光 [英] RaphaelJS HTML5 Library: glow animate along the circle

查看:108
本文介绍了RaphaelJS HTML5库:沿着圆圈发光的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个圆圈,我可以移动它,如何使光圈效果跟随该圆圈。

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
});

我试过整套动画

glowSet.animate({
    x: coordX,
    y: coordY
});

我试图在套装上使用forEach申请每件商品

I've tried to apply to each item using forEach over the set

glowSet.forEach(function(item) {
    item.animate({
        x: coordX,
        y: coordY
    });
});


推荐答案

发光组和圆圈保持独立。你应该能够通过简单地将它们组合成一组来达到你想要的效果,如下所示:

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'
}));

然后将动画应用于 glowSet

这篇关于RaphaelJS HTML5库:沿着圆圈发光的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆